Re: [PyQt] how to wrap anonymous enums
On Sat, 29 Aug 2009 19:43:24 +0200, Diez B. Roggisch de...@web.de wrote: Phil Thompson schrieb: On Sat, 29 Aug 2009 17:48:11 +0200, Diez B. Roggisch de...@web.de wrote: Hi, I've got a struct like this: struct SJoystickInfo { u8 Joystick; u32 Buttons; u32 Axes; enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN } PovHat; }; // struct SJoystickInfo So the type of PovHat is an anonymous enum. How to wrap that? I also tried to just give PovHat an int-value, but that didn't work either. It should just work - what problem are you seeing? A simple syntax eror at the line of PovHat. Hmm - one for the TODO list. The workaround is what I think you tried... enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN }; int PovHat; ...so what problem did you have with that? Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] how to wrap anonymous enums
Phil Thompson schrieb: On Sat, 29 Aug 2009 19:43:24 +0200, Diez B. Roggisch de...@web.de wrote: Phil Thompson schrieb: On Sat, 29 Aug 2009 17:48:11 +0200, Diez B. Roggisch de...@web.de wrote: Hi, I've got a struct like this: struct SJoystickInfo { u8 Joystick; u32 Buttons; u32 Axes; enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN } PovHat; }; // struct SJoystickInfo So the type of PovHat is an anonymous enum. How to wrap that? I also tried to just give PovHat an int-value, but that didn't work either. It should just work - what problem are you seeing? A simple syntax eror at the line of PovHat. Hmm - one for the TODO list. The workaround is what I think you tried... enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN }; int PovHat; ...so what problem did you have with that? This is in my sip-file: enum { POV_HAT_PRESENT, POV_HAT_ABSENT, POV_HAT_UNKNOWN }; struct SJoystickInfo { irr::u8 Joystick; irr::core::stringc Name; irr::u32 Buttons; irr::u32 Axes; int PovHat; }; This is the compiler error: sipirrlichtirrSJoystickInfo.cpp: In function ‘int varset_irr_SJoystickInfo_PovHat(void*, PyObject*, PyObject*)’: sipirrlichtirrSJoystickInfo.cpp:215: error: invalid conversion from ‘int’ to ‘irr::SJoystickInfo::anonymous enum’ error: command 'gcc-4.2' failed with exit status 1 Diez ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] how to wrap anonymous enums
On Mon, 31 Aug 2009 23:07:54 +0200, Diez B. Roggisch de...@web.de wrote: Phil Thompson schrieb: On Sat, 29 Aug 2009 19:43:24 +0200, Diez B. Roggisch de...@web.de wrote: Phil Thompson schrieb: On Sat, 29 Aug 2009 17:48:11 +0200, Diez B. Roggisch de...@web.de wrote: Hi, I've got a struct like this: struct SJoystickInfo { u8 Joystick; u32 Buttons; u32 Axes; enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN } PovHat; }; // struct SJoystickInfo So the type of PovHat is an anonymous enum. How to wrap that? I also tried to just give PovHat an int-value, but that didn't work either. It should just work - what problem are you seeing? A simple syntax eror at the line of PovHat. Hmm - one for the TODO list. The workaround is what I think you tried... enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN }; int PovHat; ...so what problem did you have with that? This is in my sip-file: enum { POV_HAT_PRESENT, POV_HAT_ABSENT, POV_HAT_UNKNOWN }; struct SJoystickInfo { irr::u8 Joystick; irr::core::stringc Name; irr::u32 Buttons; irr::u32 Axes; int PovHat; }; This is the compiler error: sipirrlichtirrSJoystickInfo.cpp: In function ‘int varset_irr_SJoystickInfo_PovHat(void*, PyObject*, PyObject*)’: sipirrlichtirrSJoystickInfo.cpp:215: error: invalid conversion from ‘int’ to ‘irr::SJoystickInfo::anonymous enum’ error: command 'gcc-4.2' failed with exit status 1 Maybe the lack of support for anonymous enums was intentional because of the casting problem. The only thing I can think of at the moment is to implement %SetCode for int PovHat to do whatever hackery is needed to work around the casting problem (eg. a switch statement assigning each possible value explicitly). Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] how to wrap anonymous enums
Hi, I've got a struct like this: struct SJoystickInfo { u8 Joystick; u32 Buttons; u32 Axes; enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN } PovHat; }; // struct SJoystickInfo So the type of PovHat is an anonymous enum. How to wrap that? I also tried to just give PovHat an int-value, but that didn't work either. Diez ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] how to wrap anonymous enums
On Sat, 29 Aug 2009 17:48:11 +0200, Diez B. Roggisch de...@web.de wrote: Hi, I've got a struct like this: struct SJoystickInfo { u8 Joystick; u32 Buttons; u32 Axes; enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN } PovHat; }; // struct SJoystickInfo So the type of PovHat is an anonymous enum. How to wrap that? I also tried to just give PovHat an int-value, but that didn't work either. It should just work - what problem are you seeing? Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] how to wrap anonymous enums
Phil Thompson schrieb: On Sat, 29 Aug 2009 17:48:11 +0200, Diez B. Roggisch de...@web.de wrote: Hi, I've got a struct like this: struct SJoystickInfo { u8 Joystick; u32 Buttons; u32 Axes; enum { //! A hat is definitely present. POV_HAT_PRESENT, //! A hat is definitely not present. POV_HAT_ABSENT, //! The presence or absence of a hat cannot be determined. POV_HAT_UNKNOWN } PovHat; }; // struct SJoystickInfo So the type of PovHat is an anonymous enum. How to wrap that? I also tried to just give PovHat an int-value, but that didn't work either. It should just work - what problem are you seeing? A simple syntax eror at the line of PovHat. Diez ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt