[PyQt] how to wrap anonymous enums
Diez B. Roggisch
deets at web.de
Mon Aug 31 22:07:54 BST 2009
Phil Thompson schrieb:
> On Sat, 29 Aug 2009 19:43:24 +0200, "Diez B. Roggisch" <deets at web.de>
> wrote:
>> Phil Thompson schrieb:
>>> On Sat, 29 Aug 2009 17:48:11 +0200, "Diez B. Roggisch" <deets at 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
More information about the PyQt
mailing list