diff options
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/shibokengenerator.cpp')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/shibokengenerator.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index 9793998b9..170cbd74e 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -96,7 +96,7 @@ static QString resolveScopePrefix(const QStringList &scopeList, const QString &v static inline QStringList splitClassScope(const AbstractMetaClass *scope) { - return scope->qualifiedCppName().split(QLatin1String("::"), QString::SkipEmptyParts); + return scope->qualifiedCppName().split(QLatin1String("::"), Qt::SkipEmptyParts); } static QString resolveScopePrefix(const AbstractMetaClass *scope, const QString &value) @@ -322,6 +322,15 @@ bool ShibokenGenerator::shouldGenerateCppWrapper(const AbstractMetaClass *metaCl return result; } +bool ShibokenGenerator::shouldWriteVirtualMethodNative(const AbstractMetaFunction *func) +{ + // PYSIDE-803: Extracted this because it is used multiple times. + const AbstractMetaClass *metaClass = func->ownerClass(); + return (!avoidProtectedHack() || !metaClass->hasPrivateDestructor()) + && ((func->isVirtual() || func->isAbstract()) + && (func->attributes() & AbstractMetaAttributes::FinalCppMethod) == 0); +} + void ShibokenGenerator::lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumList &enumList, const AbstractMetaClass *metaClass) { Q_ASSERT(metaClass); @@ -355,6 +364,15 @@ QString ShibokenGenerator::wrapperName(const AbstractMetaType *metaType) const return metaType->cppSignature(); } +QString ShibokenGenerator::wrapperName(const TypeEntry *type) const +{ + QString name = type->name(); + int pos = name.lastIndexOf(QLatin1String("::")); + if (pos >= 0) + name = name.remove(0, pos + 2); + return name + QLatin1String("Wrapper"); +} + QString ShibokenGenerator::fullPythonClassName(const AbstractMetaClass *metaClass) { QString fullClassName = metaClass->name(); @@ -2167,6 +2185,13 @@ bool ShibokenGenerator::injectedCodeUsesArgument(const AbstractMetaFunction *fun return false; } +bool ShibokenGenerator::useOverrideCaching(const AbstractMetaClass *metaClass) +{ + return metaClass->isPolymorphic() + && !metaClass->typeEntry()->typeFlags().testFlag(ComplexTypeEntry::NoOverrideCaching); + +} + ShibokenGenerator::AttroCheck ShibokenGenerator::checkAttroFunctionNeeds(const AbstractMetaClass *metaClass) const { AttroCheck result; @@ -2177,6 +2202,8 @@ ShibokenGenerator::AttroCheck ShibokenGenerator::checkAttroFunctionNeeds(const A result |= AttroCheckFlag::GetattroOverloads; if (usePySideExtensions() && metaClass->qualifiedCppName() == QLatin1String("QObject")) result |= AttroCheckFlag::SetattroQObject; + if (useOverrideCaching(metaClass)) + result |= AttroCheckFlag::SetattroMethodOverride; } return result; } |