diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-26 13:29:35 +0100 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-03-26 20:29:54 +0000 |
commit | 066dfadf24b64628fabe25097a86a41f62e73526 (patch) | |
tree | 2b59f2caecddc29532489ca845bdafb5e9a93127 /sources/shiboken2/ApiExtractor/typedatabase.cpp | |
parent | e6b746dc70203689960b8f57d9d6ef0463482415 (diff) |
shiboken/Typedatabase: Store type system entries separately
This makes it easier to access the default type system entry,
which will always be the first one in the list.
Change-Id: Ie0844cef5fa4f0cd8bc50c28898e54a42845c830
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typedatabase.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/typedatabase.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp index c0999e7ab..4ce2790f5 100644 --- a/sources/shiboken2/ApiExtractor/typedatabase.cpp +++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp @@ -182,16 +182,31 @@ FunctionTypeEntry* TypeDatabase::findFunctionType(const QString& name) const return 0; } +void TypeDatabase::addTypeSystemType(const TypeSystemTypeEntry *e) +{ + m_typeSystemEntries.append(e); +} + const TypeSystemTypeEntry *TypeDatabase::findTypeSystemType(const QString &name) const { - const auto entries = findTypes(name); - for (const TypeEntry *entry : entries) { - if (entry->type() == TypeEntry::TypeSystemType) - return static_cast<const TypeSystemTypeEntry *>(entry); + for (auto entry : m_typeSystemEntries) { + if (entry->name() == name) + return entry; } return nullptr; } +const TypeSystemTypeEntry *TypeDatabase::defaultTypeSystemType() const +{ + return m_typeSystemEntries.value(0, nullptr); +} + +QString TypeDatabase::defaultPackageName() const +{ + Q_ASSERT(!m_typeSystemEntries.isEmpty()); + return m_typeSystemEntries.constFirst()->name(); +} + TypeEntry* TypeDatabase::findType(const QString& name) const { const auto entries = findTypes(name); |