diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-06-30 09:13:47 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-07-11 13:13:29 +0000 |
commit | 1c5a5cc67d8f80bd542a166b6861a234529c5c43 (patch) | |
tree | 9ec342e9ff02c00f220ead08c3fea09d66f323df /sources/shiboken2/ApiExtractor/typeparser.cpp | |
parent | 29ea7a10b743976b471ccc3d1749db2d7df2e321 (diff) |
Shiboken: Improve debug operators of the type system
- Add debug operator for TypeParser::Info
- Add verbose mode to AbstractMetaType
- Output more information for TypeEntry
Task-number: PYSIDE-354
Task-number: PYSIDE-516
Change-Id: Id9882e89f9b5a51929f27b100d28396d3f6c4198
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typeparser.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/typeparser.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/typeparser.cpp b/sources/shiboken2/ApiExtractor/typeparser.cpp index 8165bfe44..09439a210 100644 --- a/sources/shiboken2/ApiExtractor/typeparser.cpp +++ b/sources/shiboken2/ApiExtractor/typeparser.cpp @@ -316,3 +316,47 @@ QString TypeParser::Info::toString() const } return s; } + +#ifndef QT_NO_DEBUG_STREAM + +static void formatTypeInfo(QDebug &d, const TypeParser::Info &i) +{ + if (i.is_busted) { + d << "busted"; + return; + } + + d << '"' << i.qualified_name << '"'; + if (!i.arrays.isEmpty()) { + d << ", arrays="; + for (const QString &a : i.arrays) + d << '[' << a << ']'; + } + if (!i.template_instantiations.isEmpty()) { + d << ", template_instantiations=["; + for (int t = 0, size = i.template_instantiations.size(); t < size; ++t) { + if (t) + d << ", "; + formatTypeInfo(d, i.template_instantiations.at(t)); + } + d << ']'; + } + if (i.referenceType != NoReference) + d << ", refType=" << i.referenceType; + if (i.is_constant) + d << ", [const]"; + if (i.indirections > 0) + d << ", indirections=" << i.indirections; +} + +QDebug operator<<(QDebug d, const TypeParser::Info &i) +{ + QDebugStateSaver saver(d); + d.noquote(); + d.nospace(); + d << "TypeParser::Info("; + formatTypeInfo(d, i); + d << ')'; + return d; +} +#endif // !QT_NO_DEBUG_STREAM |