From a80ae396c4e497a64c3fed57a9c4628436ad40a4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 12 Jul 2018 15:19:47 +0200 Subject: shiboken: Make targetLangPackage() a normal property of TypeEntry Normally, only the root typesystem element has a package specification; there is no need to have virtual functions for it. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: I3b86c8418cf16ce372c1953279a115e2eff0e984 Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/typesystem.cpp | 40 +-------------------------- sources/shiboken2/ApiExtractor/typesystem.h | 22 ++------------- 2 files changed, 4 insertions(+), 58 deletions(-) diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp index 849351a15..93199d5dc 100644 --- a/sources/shiboken2/ApiExtractor/typesystem.cpp +++ b/sources/shiboken2/ApiExtractor/typesystem.cpp @@ -616,6 +616,7 @@ void Handler::addFlags(const QString &name, QString flagName, { FlagsTypeEntry *ftype = new FlagsTypeEntry(QLatin1String("QFlags<") + name + QLatin1Char('>'), since); ftype->setOriginator(m_currentEnum); + ftype->setTargetLangPackage(m_currentEnum->targetLangPackage()); // Try to get the guess the qualified flag name const int lastSepPos = name.lastIndexOf(colonColon()); if (lastSepPos >= 0 && !flagName.contains(colonColon())) @@ -2131,20 +2132,6 @@ void PrimitiveTypeEntry::setPreferredConversion(bool b) m_preferredConversion = b; } -typedef QHash PrimitiveTypeEntryTargetLangPackageMap; -Q_GLOBAL_STATIC(PrimitiveTypeEntryTargetLangPackageMap, primitiveTypeEntryTargetLangPackages); - -void PrimitiveTypeEntry::setTargetLangPackage(const QString& package) -{ - primitiveTypeEntryTargetLangPackages()->insert(this, package); -} -QString PrimitiveTypeEntry::targetLangPackage() const -{ - if (!primitiveTypeEntryTargetLangPackages()->contains(this)) - return this->::TypeEntry::targetLangPackage(); - return primitiveTypeEntryTargetLangPackages()->value(this); -} - CodeSnipList TypeEntry::codeSnips() const { return m_codeSnips; @@ -2181,11 +2168,6 @@ FieldModification ComplexTypeEntry::fieldModification(const QString &name) const return mod; } -QString ComplexTypeEntry::targetLangPackage() const -{ - return m_package; -} - QString ComplexTypeEntry::targetLangName() const { return m_targetLangName.isEmpty() ? @@ -2212,11 +2194,6 @@ bool ComplexTypeEntry::hasDefaultConstructor() const return complexTypeEntryDefaultConstructors()->contains(this); } -QString ContainerTypeEntry::targetLangPackage() const -{ - return QString(); -} - QString ContainerTypeEntry::targetLangName() const { @@ -2291,11 +2268,6 @@ bool FlagsTypeEntry::preferredConversion() const return false; } -QString FlagsTypeEntry::targetLangPackage() const -{ - return m_enum->targetLangPackage(); -} - QString FlagsTypeEntry::qualifiedTargetLangName() const { return targetLangPackage() + QLatin1Char('.') + m_enum->targetLangQualifier() @@ -2723,16 +2695,6 @@ EnumTypeEntry::EnumTypeEntry(const QString &nspace, const QString &enumName, { } -QString EnumTypeEntry::targetLangPackage() const -{ - return m_packageName; -} - -void EnumTypeEntry::setTargetLangPackage(const QString &package) -{ - m_packageName = package; -} - QString EnumTypeEntry::targetLangName() const { return m_targetLangName; diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h index 2924d5913..e344e07b4 100644 --- a/sources/shiboken2/ApiExtractor/typesystem.h +++ b/sources/shiboken2/ApiExtractor/typesystem.h @@ -747,10 +747,8 @@ public: } // The package - virtual QString targetLangPackage() const - { - return QString(); - } + QString targetLangPackage() const { return m_targetLangPackage; } + void setTargetLangPackage(const QString &p) { m_targetLangPackage = p; } virtual QString qualifiedTargetLangName() const { @@ -891,6 +889,7 @@ public: CustomConversion* customConversion() const; private: QString m_name; + QString m_targetLangPackage; Type m_type; uint m_codeGeneration = GenerateAll; CustomFunction m_customConstructor; @@ -1031,8 +1030,6 @@ public: m_preferredTargetLangType = b; } - void setTargetLangPackage(const QString& package); - QString targetLangPackage() const override; private: QString m_targetLangName; QString m_targetLangApiName; @@ -1048,9 +1045,6 @@ public: explicit EnumTypeEntry(const QString &nspace, const QString &enumName, const QVersionNumber &vr); - QString targetLangPackage() const override; - void setTargetLangPackage(const QString &package); - QString targetLangName() const override; QString targetLangQualifier() const; QString qualifiedTargetLangName() const override; @@ -1203,8 +1197,6 @@ public: m_enum = e; } - QString targetLangPackage() const override; - private: QString m_originalName; QString m_targetLangName; @@ -1288,12 +1280,6 @@ public: return m_fieldMods; } - QString targetLangPackage() const override; - void setTargetLangPackage(const QString &package) - { - m_package = package; - } - bool isQObject() const { return m_qobject; @@ -1405,7 +1391,6 @@ private: AddedFunctionList m_addedFunctions; FunctionModificationList m_functionMods; FieldModificationList m_fieldMods; - QString m_package; QString m_defaultSuperclass; QString m_qualifiedCppName; QString m_targetLangName; @@ -1455,7 +1440,6 @@ public: QString typeName() const; QString targetLangName() const override; - QString targetLangPackage() const override; QString qualifiedCppName() const override; static Type containerTypeFromString(QString typeName) -- cgit v1.2.3