[PyKDE] SIP- 4.2.1 (snapshot-20050625-332) less smart than g++ in identifying abstract classes

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Sun Jun 26 15:57:32 BST 2005


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?

Small demo module attached.

Gerard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Virtual-0.0.1.tar.gz
Type: application/octet-stream
Size: 1884 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050626/551ee5a1/Virtual-0.0.1.tar.obj


More information about the PyQt mailing list