aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typeparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typeparser.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/typeparser.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/typeparser.cpp b/sources/shiboken2/ApiExtractor/typeparser.cpp
index 67120a1ac..09439a210 100644
--- a/sources/shiboken2/ApiExtractor/typeparser.cpp
+++ b/sources/shiboken2/ApiExtractor/typeparser.cpp
@@ -286,7 +286,7 @@ QString TypeParser::Info::instantiationName() const
QString s(qualified_name.join(QLatin1String("::")));
if (!template_instantiations.isEmpty()) {
QStringList insts;
- foreach (const Info &info, template_instantiations)
+ for (const Info &info : template_instantiations)
insts << info.toString();
s += QLatin1String("< ") + insts.join(QLatin1String(", ")) + QLatin1String(" >");
}
@@ -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