diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-12-14 10:24:41 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-12-14 14:14:29 -0300 |
commit | cdcb5567c77b3f703541839101cad564605b7f61 (patch) | |
tree | ea3ad5751a0ab5f3a3b14bc6b85da82c019463d5 /shibokengenerator.cpp | |
parent | 0f31a28bcb0d802f461fd2012dd2a239decb81b0 (diff) |
All wrapped classes now inherit from the SbkBaseWrapper of the metatype SbkBaseWrapperType.
The wrapped classes are described with a SbkBaseWrapperType structure which
extends the PyTypeObject with information about multiple inheritance and
parenting ownership. This works well for the classes produced by the generator
but inheriting classes written in Python continues using the PyTypeObject to
describe themselves. To fix this the SbkBaseWrapperType is now a metatype for
all the wrapped classes and anyone inheriting from them.
In addition all the wrapped classes now inherit from SbkBaseWrapper, since
Python's PyType_Ready method need that multiple inheriting classes have a
common base class with the same size of the classes involved in the multiple
inheritance, which disqualifies Python's base "object" class.
The metatype and the base wrapper type are initialized by calling the new
Shiboken::init_shiboken() function. This is done by all the imported binding
modules, but it is really run only in the first call.
Another noteworthy change is the replacement of PyTypeObject as a basis for
SbkBaseWrapperType by the PyHeapTypeObject, since the latter is the proper
choice for types created on the heap, e.g. user defined classes extending
the generated wrapper classes.
Reviewed by Hugo Lima <hugo.lima@openbossa.org>
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r-- | shibokengenerator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp index ba3d03e35..b7644593d 100644 --- a/shibokengenerator.cpp +++ b/shibokengenerator.cpp @@ -879,7 +879,7 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s, if (context) { // replace template variable for the Python Type object for the // class context in which the variable is used - code.replace("%PYTHONTYPEOBJECT", cpythonTypeName(context) + ".pytype"); + code.replace("%PYTHONTYPEOBJECT", cpythonTypeName(context) + ".super.ht_type"); } // replace "toPython "converters @@ -956,7 +956,7 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s, // replace template variable for the Python Type object for the // class implementing the method in which the code snip is written if (func->isStatic()) { - code.replace("%PYTHONTYPEOBJECT", cpythonTypeName(func->implementingClass()) + ".pytype"); + code.replace("%PYTHONTYPEOBJECT", cpythonTypeName(func->implementingClass()) + ".super.ht_type"); } else { code.replace("%PYTHONTYPEOBJECT.", QString("%1->ob_type->").arg(pySelf)); code.replace("%PYTHONTYPEOBJECT", QString("%1->ob_type").arg(pySelf)); |