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/generator | |
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/generator')
-rw-r--r-- | sources/shiboken2/generator/generator.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp index ec227bd83..154a16ed3 100644 --- a/sources/shiboken2/generator/generator.cpp +++ b/sources/shiboken2/generator/generator.cpp @@ -176,19 +176,13 @@ Generator::~Generator() bool Generator::setup(const ApiExtractor& extractor) { m_d->apiextractor = &extractor; - const auto &allEntries = TypeDatabase::instance()->entries(); - TypeEntry* entryFound = 0; - for (auto it = allEntries.cbegin(), end = allEntries.cend(); it != end; ++it) { - TypeEntry *entry = it.value(); - if (entry->type() == TypeEntry::TypeSystemType && entry->generateCode()) { - entryFound = entry; - break; - } - } - if (entryFound) - m_d->packageName = entryFound->name(); - else + const auto moduleEntry = TypeDatabase::instance()->defaultTypeSystemType(); + if (!moduleEntry || !moduleEntry->generateCode()) { qCWarning(lcShiboken) << "Couldn't find the package name!!"; + return false; + } + + m_d->packageName = moduleEntry->name(); collectInstantiatedContainersAndSmartPointers(); |