[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    RE: [PyKDE] SIP - support for #define?
From:       Jim Bublitz <jbublitz () nwinternet ! com>
Date:       2002-11-01 20:52:12
[Download RAW message or body]

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


_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic