summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-11-15 23:34:40 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-18 09:22:51 -0300
commit2807ddf87ab5d85698011a4260c833c7fc577fe2 (patch)
tree615853c2acaa83d31834c38e934ad5a219517f0b
parentd20e2dd6a0212b2d8a89cbdc9dc99faabb61bd0c (diff)
downloadshiboken-2807ddf87ab5d85698011a4260c833c7fc577fe2.tar.gz
shiboken-2807ddf87ab5d85698011a4260c833c7fc577fe2.tar.xz
shiboken-2807ddf87ab5d85698011a4260c833c7fc577fe2.zip
modified the unused method ShibokenGenerator::getBaseClasses to
return an AbstractMetaClassList (AbstractMetaClass does not provide such a method)
-rw-r--r--cppgenerator.cpp4
-rw-r--r--shibokengenerator.cpp26
-rw-r--r--shibokengenerator.h4
3 files changed, 9 insertions, 25 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index bd3adc52..e3574d7c 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -1868,10 +1868,8 @@ void CppGenerator::writeClassRegister(QTextStream& s, const AbstractMetaClass* m
s << metaClass->baseClassNames().size();
s << ',' << endl;
QStringList bases;
- foreach (QString baseName, metaClass->baseClassNames()) {
- const AbstractMetaClass* base = classes().findClass(baseName);
+ foreach (const AbstractMetaClass* base, getBaseClasses(metaClass))
bases << QString("(PyTypeObject*)&%1").arg(cpythonTypeName(base->typeEntry()));
- }
Indentation indent(INDENT);
s << INDENT << bases.join(", ") << ");" << endl << endl;
}
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index 3e6d6ff3..f26c872c 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -952,28 +952,12 @@ bool ShibokenGenerator::injectedCodeCallsCppFunction(const AbstractMetaFunction*
return false;
}
-QStringList ShibokenGenerator::getBaseClasses(const AbstractMetaClass* metaClass)
+AbstractMetaClassList ShibokenGenerator::getBaseClasses(const AbstractMetaClass* metaClass)
{
- QStringList baseClass;
-
- if (!metaClass->baseClassName().isEmpty() &&
- (metaClass->name() != metaClass->baseClassName()))
- baseClass.append(metaClass->baseClassName());
-
- foreach (AbstractMetaClass* interface, metaClass->interfaces()) {
- AbstractMetaClass* aux = interface->primaryInterfaceImplementor();
- if (!aux)
- continue;
-
- //skip templates
- if (!aux->templateArguments().isEmpty())
- continue;
-
- if (!aux->name().isEmpty() && (metaClass->name() != aux->name()))
- baseClass.append(aux->name());
- }
-
- return baseClass;
+ AbstractMetaClassList baseClasses;
+ foreach (QString parent, metaClass->baseClassNames())
+ baseClasses << classes().findClass(parent);
+ return baseClasses;
}
const AbstractMetaClass* ShibokenGenerator::getMultipleInheritingClass(const AbstractMetaClass* metaClass)
diff --git a/shibokengenerator.h b/shibokengenerator.h
index dd1d521d..1acf9d20 100644
--- a/shibokengenerator.h
+++ b/shibokengenerator.h
@@ -154,7 +154,9 @@ public:
int arg_count = -1) const;
bool hasInjectedCodeOrSignatureModification(const AbstractMetaFunction* func);
- QStringList getBaseClasses(const AbstractMetaClass* metaClass);
+
+ /// Returns a list of parent classes for a method.
+ AbstractMetaClassList getBaseClasses(const AbstractMetaClass* metaClass);
const AbstractMetaClass* getMultipleInheritingClass(const AbstractMetaClass* metaClass);