Advance wrapping enumerations C++ --> Python

classic Classic list List threaded Threaded
1 message Options
Zm
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Advance wrapping enumerations C++ --> Python

Zm
This post has NOT been accepted by the mailing list yet.
I have enumeration such as:

enum MyEnum {
   item1 = 'A'
   item2 = 'B'
   ...
   itemN = 'etc"
}

I want to get in "py" wrap next statements:

...
itemN = _{module_name}.itemN
...

And in "cpp":

...
SWIG_Python_SetConstant(d, "itemN",SWIG_From_int(static_cast< int >(itemN)));
...

But by default now I have chars instead of ints:

...
SWIG_Python_SetConstant(d, "itemN",SWIG_From_char(static_cast< char >(itemN)));
...

What directives I could type to get "ints"? I have learned about %typemap, but I've never seen information about this type of enums, and how to wrap it. Before updating SWIG version all works fine, but after I get this little bug...
Loading...