[PyKDE] SIP- 4.2.1 (snapshot-20050625-332) less smart than g++ in
identifying abstract classes
Phil Thompson
phil at riverbankcomputing.co.uk
Thu Jun 30 17:55:20 BST 2005
On Sunday 26 June 2005 3:57 pm, Gerard Vermeulen wrote:
> Here is an example where the sip specification matches exactly the
> corresponding header files:
>
> -- start header file --
> #ifndef V_H
> #define V_H
>
> class A
> {
> public:
> A();
> virtual ~A();
> virtual int getTypeId() = 0;
> };
>
> class B: public A // abstract by derivation
> {
> public:
> B();
> virtual ~B();
> virtual int bStuff();
> };
>
> class C: public B // abstract by derivation
> {
> public:
> C();
> virtual ~C();
> virtual int cStuff();
> };
>
> class D: public C
> {
> public:
> D();
> virtual ~D();
> virtual int getTypeId();
> virtual int dStuff();
> };
>
>
> #endif // V_H
> -- end header file --
>
> -- start sip file --
> %Module v 0
>
> class A
> {
> %TypeHeaderCode
> #include <v.h>
> %End
>
> public:
> A();
> virtual ~A();
> virtual int getTypeId() = 0;
> };
>
> class B: A
> {
> %TypeHeaderCode
> #include <v.h>
> %End
>
> public:
> B();
> virtual ~B();
> virtual int bStuff();
> // SIP must have the information so that I do not have to copy
> // virtual int getTypeId() = 0;
> // from a base class since that may be tedious in huge libraries
> };
>
> class C: B /Abstract/ // prevents subclassing
> {
> %TypeHeaderCode
> #include <v.h>
> %End
>
> public:
> C();
> virtual ~C();
> virtual int cStuff();
> };
>
> class D: C
> {
> %TypeHeaderCode
> #include <v.h>
> %End
>
> public:
> D();
> virtual ~D();
> virtual int getTypeId();
> virtual int dStuff();
> };
> -- end sip file
>
> For C++, classes A, and B and C by inheritance are abstract because of the
> pure virtual getTypeId() declared in A.
>
> SIP does not look for pure virtual functions in base classes of a class but
> it should have all the information isn't it?
Should be fixed in tonight's snapshot.
Thanks,
Phil
More information about the PyQt
mailing list