[PyQt] Re: [PyKDE] Re: Use of enum in a namespace with SIP

Diez B. Roggisch deets at web.de
Thu Aug 2 09:41:15 BST 2007


Hi,

I found this 2 year old post:

Phil Thompson schrieb:
 > On Tuesday 03 May 2005 10:34 pm, Claus, Richard wrote:
 >> Hello,
 >>
 >>   The following sip code does not produce compilable code with sip 4.2
 >> (4.2rc2-289, Windows XP SP2).
 >>
 >> %Module MyTest
 >>
 >> namespace MyNamespace {
 >>
 >> enum MyEnum {a, b, c, d};
 >>
 >> };
 >>
 >> The generated sipMyTestMyNamespace.cpp code contains references to
 >> MyNamespace::a, etc., where the namespace MyNamespace is undefined.  I
 >> can't seem to figure out how to get a "#include" directive to appear 
in the
 >> generated code that would define the namespace.
 >
 > From tonight's snapshot you can use %TypeHeaderCode in namespaces. 
Let me know if you need anything more.


I'm in the same situation - a nested namespace contains an enum. The 
necessary header isn't included. However, a

     enum E_VIDEO_DRIVER_FEATURE
       {
%TypeHeaderCode
#include <EDriverFeatures.h>
%End

     EVDF_RENDER_TO_TARGET,
     EVDF_HARDWARE_TL,
     EVDF_MULTITEXTURE,
     EVDF_BILINEAR_FILTER,
     EVDF_MIP_MAP,
     EVDF_MIP_MAP_AUTO_UPDATE,
     EVDF_STENCIL_BUFFER,
     EVDF_VERTEX_SHADER_1_1,
     EVDF_VERTEX_SHADER_2_0,
     EVDF_VERTEX_SHADER_3_0,
     EVDF_PIXEL_SHADER_1_1,
     EVDF_PIXEL_SHADER_1_2,
     EVDF_PIXEL_SHADER_1_3,
     EVDF_PIXEL_SHADER_1_4,
     EVDF_PIXEL_SHADER_2_0,
     EVDF_PIXEL_SHADER_3_0,
     EVDF_ARB_VERTEX_PROGRAM_1,
     EVDF_ARB_FRAGMENT_PROGRAM_1,
     EVDF_ARB_GLSL,
     EVDF_HLSL,
     EVDF_TEXTURE_NPOT,
     EVDF_FRAMEBUFFER_OBJECT
       };

leads to a sip-error. I was able to remedy that using

%ModuleHeaderCode
#include <EDriverFeatures.h>
%End

but that's not really desirable..

I'm using the latest sip, 4.7, with pyhton2.5 under OSX Tiger.

Any suggestions?

Regards,

Diez



More information about the PyQt mailing list