summaryrefslogtreecommitdiffstats
path: root/headergenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-09-02 01:19:58 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-09-02 01:19:58 -0300
commit9e00e39dca65935df280b35ccffce84287e1f4c4 (patch)
treeed25ef1b4ae606e5419894277ac61a721fc3ae84 /headergenerator.cpp
parentfd761144e6ae4c24b3f77fae7047eaa26dbb8764 (diff)
downloadshiboken-9e00e39dca65935df280b35ccffce84287e1f4c4.tar.gz
shiboken-9e00e39dca65935df280b35ccffce84287e1f4c4.tar.xz
shiboken-9e00e39dca65935df280b35ccffce84287e1f4c4.zip
- CppGenerator and HeaderGenerator modified to take classes with
private destructors into account - Removed ShibokenGenerator::canCreateWrapperFor(...) method - Minor improvements to ShibokenGenerator documentation - Expanded PrivateDtor case and added related unit test
Diffstat (limited to 'headergenerator.cpp')
-rw-r--r--headergenerator.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp
index 61358d16..5c74a7a1 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -59,7 +59,7 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met
s << "#ifndef " << wrapperName.toUpper() << "_H" << endl;
s << "#define " << wrapperName.toUpper() << "_H" << endl<< endl;
- if (!metaClass->isNamespace()) {
+ if (!metaClass->isNamespace() && !metaClass->hasPrivateDestructor()) {
s << "// The mother of all C++ binding hacks!" << endl;
s << "#define protected public" << endl << endl;
}
@@ -73,9 +73,7 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met
writeCodeSnips(s, metaClass->typeEntry()->codeSnips(),
CodeSnip::Declaration, TypeSystem::NativeCode);
- if (!metaClass->isNamespace()) {
- bool createWrapper = canCreateWrapperFor(metaClass);
-
+ if (!metaClass->isNamespace() && !metaClass->hasPrivateDestructor()) {
/*
* BOTOWTI (Beast of The Old World to be Investigated)
// detect the held type
@@ -92,8 +90,7 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met
// Class
s << "class SHIBOKEN_LOCAL " << wrapperName;
- if (createWrapper)
- s << " : public " << metaClass->qualifiedCppName();
+ s << " : public " << metaClass->qualifiedCppName();
s << endl << '{' << endl << "public:" << endl;
@@ -103,13 +100,11 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met
foreach (AbstractMetaFunction *func, filterFunctions(metaClass))
writeFunction(s, func);
- if (createWrapper) {
- //destructor
- s << INDENT << "~" << wrapperName << "();" << endl;
+ //destructor
+ s << INDENT << "~" << wrapperName << "();" << endl;
- if (metaClass->isQObject() && (metaClass->name() != "QObject"))
- s << INDENT << "using QObject::parent;" << endl;
- }
+ if (metaClass->isQObject() && (metaClass->name() != "QObject"))
+ s << INDENT << "using QObject::parent;" << endl;
writeCodeSnips(s, metaClass->typeEntry()->codeSnips(),
CodeSnip::PrototypeInitialization, TypeSystem::NativeCode);