diff options
-rw-r--r-- | sources/shiboken2/generator/generator.cpp | 22 | ||||
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 2 | ||||
-rw-r--r-- | sources/shiboken2/generator/shiboken2/shibokengenerator.cpp | 3 |
3 files changed, 14 insertions, 13 deletions
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp index 154a16ed3..91e940f51 100644 --- a/sources/shiboken2/generator/generator.cpp +++ b/sources/shiboken2/generator/generator.cpp @@ -156,7 +156,7 @@ struct Generator::GeneratorPrivate QString outDir; // License comment QString licenseComment; - QString packageName; + QString moduleName; QStringList instantiatedContainersNames; QStringList instantiatedSmartPointerNames; QVector<const AbstractMetaType *> instantiatedContainers; @@ -182,8 +182,6 @@ bool Generator::setup(const ApiExtractor& extractor) return false; } - m_d->packageName = moduleEntry->name(); - collectInstantiatedContainersAndSmartPointers(); return doSetup(); @@ -356,13 +354,16 @@ void Generator::setLicenseComment(const QString& licenseComment) QString Generator::packageName() const { - return m_d->packageName; + return TypeDatabase::instance()->defaultPackageName(); } QString Generator::moduleName() const { - QString& pkgName = m_d->packageName; - return QString(pkgName).remove(0, pkgName.lastIndexOf(QLatin1Char('.')) + 1); + if (m_d->moduleName.isEmpty()) { + m_d->moduleName = packageName(); + m_d->moduleName.remove(0, m_d->moduleName.lastIndexOf(QLatin1Char('.')) + 1); + } + return m_d->moduleName; } QString Generator::outputDirectory() const @@ -859,11 +860,12 @@ QString Generator::subDirectoryForClass(const AbstractMetaClass* clazz) const return subDirectoryForPackage(clazz->package()); } -QString Generator::subDirectoryForPackage(QString packageName) const +QString Generator::subDirectoryForPackage(QString packageNameIn) const { - if (packageName.isEmpty()) - packageName = m_d->packageName; - return QString(packageName).replace(QLatin1Char('.'), QDir::separator()); + if (packageNameIn.isEmpty()) + packageNameIn = packageName(); + packageNameIn.replace(QLatin1Char('.'), QDir::separator()); + return packageNameIn; } template<typename T> diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 039a2928b..2fedf9ae1 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -5508,7 +5508,7 @@ bool CppGenerator::finishGeneration() } TypeDatabase* typeDb = TypeDatabase::instance(); - const TypeSystemTypeEntry *moduleEntry = typeDb->findTypeSystemType(packageName()); + const TypeSystemTypeEntry *moduleEntry = typeDb->defaultTypeSystemType(); Q_ASSERT(moduleEntry); //Extra includes diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index c572a98d9..b5069db14 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -2489,7 +2489,6 @@ static void getCode(QStringList& code, const TypeEntry* type) bool ShibokenGenerator::doSetup() { - TypeDatabase* td = TypeDatabase::instance(); QStringList snips; const PrimitiveTypeEntryList &primitiveTypeList = primitiveTypes(); for (const PrimitiveTypeEntry *type : primitiveTypeList) @@ -2501,7 +2500,7 @@ bool ShibokenGenerator::doSetup() for (const AbstractMetaClass *metaClass : classList) getCode(snips, metaClass->typeEntry()); - const TypeSystemTypeEntry *moduleEntry = td->findTypeSystemType(packageName()); + const TypeSystemTypeEntry *moduleEntry = TypeDatabase::instance()->defaultTypeSystemType(); Q_ASSERT(moduleEntry); getCode(snips, moduleEntry); |