[PyKDE] SIP - support for #define?

Jim Bublitz jbublitz at nwinternet.com
Fri Nov 1 23:02:01 GMT 2002


On 01-Nov-02 Sato, Kristine wrote:
> I have code which uses a #define to reference a class by a
> different name:
 
>#define MpPoint3D      MpVector3D
 
> class MpVector3D
> {
> };
 
> class ObPosition
> {
>       u32 GetPosition(MpPoint3D&);
> };
> Does SIP support this? I've tried putting the #define line in my
> .sip file,
> and it gets a parse error.
 
sip doesn't handle any pre-processor directives (#if, #define, etc)
unless they are within a %<some sip directive>/%End block. #include
in a %HeaderCode block is legal, as is #define, #if, etc. in a
%MemberCode or %C++Code block.

> Any suggestions? I guess I can just do
 
> class MpPoint3D : MpVector3D
> {
> };

Good solution. You should also be able to do:

    typedef MpVector3D MpPoint3D;

which is really what you mean in the #define above. Semantically
it's the same thing, but I'm not sure if the class declaration
would generate a lot more code or not.

Jim





More information about the PyQt mailing list