aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-24 09:47:11 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-24 09:47:11 +0200
commit768541fb2e81a426daeffc2f81dcca42ecc43919 (patch)
treef887244a022ea8508055412cb3e85ba8158cf509 /sources/shiboken2/generator/shiboken2/cppgenerator.cpp
parent6ba23a245449aaa9c1a7ab8e954d93f5f4366530 (diff)
parent235092d72f57d42de04501b04f6a3ff4d77adf74 (diff)
Merge "Merge remote-tracking branch 'origin/5.13' into dev"
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 32b219fa2..5fbc6ed3e 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -4892,7 +4892,11 @@ void CppGenerator::writeFlagsUnaryOperator(QTextStream& s, const AbstractMetaEnu
QString CppGenerator::getSimpleClassInitFunctionName(const AbstractMetaClass *metaClass) const
{
- QString initFunctionName = metaClass->qualifiedCppName();
+ QString initFunctionName;
+ // Disambiguate namespaces per module to allow for extending them.
+ if (metaClass->isNamespace())
+ initFunctionName += moduleName();
+ initFunctionName += metaClass->qualifiedCppName();
initFunctionName.replace(QLatin1String("::"), QLatin1String("_"));
return initFunctionName;
}
@@ -4996,9 +5000,11 @@ void CppGenerator::writeClassRegister(QTextStream &s,
}
// 7:baseType
- if (metaClass->baseClass()) {
+ const auto base = metaClass->isNamespace()
+ ? metaClass->extendedNamespace() : metaClass->baseClass();
+ if (base) {
s << INDENT << "reinterpret_cast<SbkObjectType *>("
- << cpythonTypeNameExt(metaClass->baseClass()->typeEntry()) << ")," << endl;
+ << cpythonTypeNameExt(base->typeEntry()) << ")," << endl;
} else {
s << INDENT << "0," << endl;
}