From 066dfadf24b64628fabe25097a86a41f62e73526 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Mar 2019 13:29:35 +0100 Subject: 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 Reviewed-by: Cristian Maureira-Fredes --- sources/shiboken2/ApiExtractor/typedatabase.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/typedatabase.cpp') 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(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); -- cgit v1.2.3