aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-11-14 13:27:44 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-11-15 09:25:51 +0100
commit6ea4edb3a600e3e9b723f2d1a045e490171385a0 (patch)
treed13788c3619d48885178ddb5e865b4f5f117ae8c
parent154f823430720363412a47cb223359a3d433aca8 (diff)
shiboken: Refactor TypeEntry::addExtraInclude()
Remove the QHash<QString, bool> m_includesUsed and do a linear search for existing includes instead since the number is small and repack the members. Task-number: PYSIDE-454 Change-Id: I30cb08d271b56778a6964476f66602569e5c6ce5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp10
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h15
2 files changed, 12 insertions, 13 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index a1b98cd45..47feb2c19 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -80,6 +80,12 @@ CodeSnipList TypeEntry::codeSnips() const
return m_codeSnips;
}
+void TypeEntry::addExtraInclude(const Include &newInclude)
+{
+ if (!m_extraIncludes.contains(newInclude))
+ m_extraIncludes.append(newInclude);
+}
+
QString Modification::accessModifierString() const
{
if (isPrivate()) return QLatin1String("private");
@@ -713,8 +719,8 @@ bool TypeEntry::isCppPrimitive() const
TypeEntry::TypeEntry(const QString &name, TypeEntry::Type t, const QVersionNumber &vr) :
m_name(name),
- m_type(t),
- m_version(vr)
+ m_version(vr),
+ m_type(t)
{
}
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 48733053d..b55d5dac5 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -836,13 +836,7 @@ public:
{
m_extraIncludes = includes;
}
- void addExtraInclude(const Include &include)
- {
- if (!m_includesUsed.value(include.name(), false)) {
- m_extraIncludes << include;
- m_includesUsed[include.name()] = true;
- }
- }
+ void addExtraInclude(const Include &newInclude);
Include include() const
{
@@ -907,21 +901,20 @@ protected:
private:
QString m_name;
QString m_targetLangPackage;
- Type m_type;
- uint m_codeGeneration = GenerateAll;
CustomFunction m_customConstructor;
CustomFunction m_customDestructor;
CodeSnipList m_codeSnips;
DocModificationList m_docModifications;
IncludeList m_extraIncludes;
Include m_include;
- QHash<QString, bool> m_includesUsed;
QString m_conversionRule;
- bool m_stream = false;
QVersionNumber m_version;
CustomConversion *m_customConversion = nullptr;
+ uint m_codeGeneration = GenerateAll;
int m_revision = 0;
int m_sbkIndex = 0;
+ Type m_type;
+ bool m_stream = false;
};
class TypeSystemTypeEntry : public TypeEntry