aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-02-12 15:42:47 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-02-12 15:50:05 +0100
commit02018700e86a7eea18eac2952b819a9b77606d1b (patch)
tree5bd19b6d28405dc92655f10c9f7ed7157756bc15 /sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
parent431a945ab99b6977dd0feace2b4982b801d07cbd (diff)
parent125c35014aeb4ae6944f8d2b3cdc673dce7bee3e (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/shibokengenerator.cpp')
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index 320f19dcf..9793998b9 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -644,13 +644,13 @@ QString ShibokenGenerator::cpythonSpecialCastFunctionName(const AbstractMetaClas
}
QString ShibokenGenerator::cpythonWrapperCPtr(const AbstractMetaClass *metaClass,
- const QString &argName)
+ const QString &argName) const
{
return cpythonWrapperCPtr(metaClass->typeEntry(), argName);
}
QString ShibokenGenerator::cpythonWrapperCPtr(const AbstractMetaType *metaType,
- const QString &argName)
+ const QString &argName) const
{
if (!ShibokenGenerator::isWrapperType(metaType->typeEntry()))
return QString();
@@ -660,7 +660,7 @@ QString ShibokenGenerator::cpythonWrapperCPtr(const AbstractMetaType *metaType,
}
QString ShibokenGenerator::cpythonWrapperCPtr(const TypeEntry *type,
- const QString &argName)
+ const QString &argName) const
{
if (!ShibokenGenerator::isWrapperType(type))
return QString();
@@ -829,7 +829,7 @@ QString ShibokenGenerator::cpythonTypeName(const TypeEntry *type)
return cpythonBaseName(type) + QLatin1String("_TypeF()");
}
-QString ShibokenGenerator::cpythonTypeNameExt(const TypeEntry *type)
+QString ShibokenGenerator::cpythonTypeNameExt(const TypeEntry *type) const
{
return cppApiVariableName(type->targetLangPackage()) + QLatin1Char('[')
+ getTypeIndexVariableName(type) + QLatin1Char(']');
@@ -882,7 +882,7 @@ QString ShibokenGenerator::converterObject(const TypeEntry *type)
+ QLatin1Char('[') + getTypeIndexVariableName(type) + QLatin1Char(']');
}
-QString ShibokenGenerator::cpythonTypeNameExt(const AbstractMetaType *type)
+QString ShibokenGenerator::cpythonTypeNameExt(const AbstractMetaType *type) const
{
return cppApiVariableName(type->typeEntry()->targetLangPackage()) + QLatin1Char('[')
+ getTypeIndexVariableName(type) + QLatin1Char(']');
@@ -2167,9 +2167,18 @@ bool ShibokenGenerator::injectedCodeUsesArgument(const AbstractMetaFunction *fun
return false;
}
-bool ShibokenGenerator::classNeedsGetattroFunction(const AbstractMetaClass *metaClass)
+ShibokenGenerator::AttroCheck ShibokenGenerator::checkAttroFunctionNeeds(const AbstractMetaClass *metaClass) const
{
- return getGeneratorClassInfo(metaClass).needsGetattroFunction;
+ AttroCheck result;
+ if (metaClass->typeEntry()->isSmartPointer()) {
+ result |= AttroCheckFlag::GetattroSmartPointer | AttroCheckFlag::SetattroSmartPointer;
+ } else {
+ if (getGeneratorClassInfo(metaClass).needsGetattroFunction)
+ result |= AttroCheckFlag::GetattroOverloads;
+ if (usePySideExtensions() && metaClass->qualifiedCppName() == QLatin1String("QObject"))
+ result |= AttroCheckFlag::SetattroQObject;
+ }
+ return result;
}
bool ShibokenGenerator::classNeedsGetattroFunctionImpl(const AbstractMetaClass *metaClass)
@@ -2196,13 +2205,6 @@ bool ShibokenGenerator::classNeedsGetattroFunctionImpl(const AbstractMetaClass *
return false;
}
-bool ShibokenGenerator::classNeedsSetattroFunction(const AbstractMetaClass *metaClass)
-{
- if (!metaClass)
- return false;
- return metaClass->typeEntry()->isSmartPointer();
-}
-
AbstractMetaFunctionList ShibokenGenerator::getMethodsWithBothStaticAndNonStaticMethods(const AbstractMetaClass *metaClass)
{
AbstractMetaFunctionList methods;
@@ -2639,7 +2641,8 @@ static void appendIndexSuffix(QString *s)
s->append(QStringLiteral("IDX"));
}
-QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaClass *metaClass, bool alternativeTemplateName)
+QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaClass *metaClass,
+ bool alternativeTemplateName) const
{
if (alternativeTemplateName) {
const AbstractMetaClass *templateBaseClass = metaClass->templateBaseClass();
@@ -2655,7 +2658,7 @@ QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaClass *met
}
return getTypeIndexVariableName(metaClass->typeEntry());
}
-QString ShibokenGenerator::getTypeIndexVariableName(const TypeEntry *type)
+QString ShibokenGenerator::getTypeIndexVariableName(const TypeEntry *type) const
{
if (type->isCppPrimitive()) {
const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
@@ -2673,7 +2676,7 @@ QString ShibokenGenerator::getTypeIndexVariableName(const TypeEntry *type)
appendIndexSuffix(&result);
return result;
}
-QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaType *type)
+QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaType *type) const
{
QString result = QLatin1String("SBK");
if (type->typeEntry()->isContainer())