diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-03-14 12:54:45 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-03-17 12:13:31 +0000 |
commit | 625cc465df179040356cd49668ab69481a7f290c (patch) | |
tree | 819042ef845f08bc2c534f9f67b68533814eada1 | |
parent | 7afa0eff4341b70dc7317dd17e3eb3e7ef58e4ee (diff) |
Typedatabase: Improve debug output
Add debug operator for TemplateEntry and output sizes.
Task-number: PYSIDE-323
Change-Id: I6a03f5c908ea5a0a3e8f14b640b1575bc49b6bd8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | ApiExtractor/typedatabase.cpp | 83 |
1 files changed, 55 insertions, 28 deletions
diff --git a/ApiExtractor/typedatabase.cpp b/ApiExtractor/typedatabase.cpp index 59d34d80b..c80efcaba 100644 --- a/ApiExtractor/typedatabase.cpp +++ b/ApiExtractor/typedatabase.cpp @@ -570,34 +570,6 @@ bool TypeDatabase::checkApiVersion(const QString& package, const QByteArray& ver } #ifndef QT_NO_DEBUG_STREAM -void TypeDatabase::formatDebug(QDebug &d) const -{ - typedef TypeEntryHash::ConstIterator Eit; - typedef TemplateEntryHash::ConstIterator TplIt; - d << "TypeDatabase(" - << "entries="; - for (Eit it = m_entries.cbegin(), end = m_entries.cend(); it != end; ++it) { - d << '"' << it.key() << "\": ["; - for (int t = 0, cnt = it.value().size(); t < cnt; ++t) { - if (t) - d << ", "; - d << it.value().at(t); - } - d << "]\n"; - } - if (!m_templates.isEmpty()) { - d << "templates=["; - const TplIt begin = m_templates.cbegin(); - for (TplIt it = begin, end = m_templates.cend(); it != end; ++it) { - if (it != begin) - d << ", "; - d << it.value(); - } - d << "]\n"; - } - d <<"\nglobalUserFunctions=" << m_globalUserFunctions << ')'; -} - QDebug operator<<(QDebug d, const TypeEntry *te) { QDebugStateSaver saver(d); @@ -624,6 +596,61 @@ QDebug operator<<(QDebug d, const TypeEntry *te) return d; } +QDebug operator<<(QDebug d, const TemplateEntry *te) +{ + QDebugStateSaver saver(d); + d.noquote(); + d.nospace(); + d << "TemplateEntry("; + if (te) { + d << '"' << te->name() << "\", version=" << te->version(); + } else { + d << '0'; + } + d << ')'; + return d; +} + +void TypeDatabase::formatDebug(QDebug &d) const +{ + typedef TypeEntryHash::ConstIterator Eit; + typedef SingleTypeEntryHash::ConstIterator Sit; + typedef TemplateEntryHash::ConstIterator TplIt; + d << "TypeDatabase(" + << "entries[" << m_entries.size() << "]="; + for (Eit it = m_entries.cbegin(), end = m_entries.cend(); it != end; ++it) { + const int count = it.value().size(); + d << '"' << it.key() << "\" [" << count << "]: ("; + for (int t = 0; t < count; ++t) { + if (t) + d << ", "; + d << it.value().at(t); + } + d << ")\n"; + } + if (!m_templates.isEmpty()) { + d << "templates[" << m_templates.size() << "]=("; + const TplIt begin = m_templates.cbegin(); + for (TplIt it = begin, end = m_templates.cend(); it != end; ++it) { + if (it != begin) + d << ", "; + d << it.value(); + } + d << ")\n"; + } + if (!m_flagsEntries.isEmpty()) { + d << "flags[" << m_flagsEntries.size() << "]=("; + const Sit begin = m_flagsEntries.cbegin(); + for (Sit it = begin, end = m_flagsEntries.cend(); it != end; ++it) { + if (it != begin) + d << ", "; + d << it.value(); + } + d << ")\n"; + } + d <<"\nglobalUserFunctions=" << m_globalUserFunctions << ')'; +} + QDebug operator<<(QDebug d, const TypeDatabase &db) { QDebugStateSaver saver(d); |