diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-01-29 13:21:54 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-01-29 16:40:40 +0100 |
commit | 9bc6037c5d89d13d93c43ea41d317c74ec7f69bf (patch) | |
tree | cb718e0af215a807b50d1997a0891ca7405d14d3 | |
parent | d174ff9888069407a1042bce67ed63712ff1e69e (diff) |
shiboken6: Add more debug operators for AbstractMetaClass
Add versions for the non-const shared ptr and raw pointer.
Change-Id: I0562992474982fe7cb28d3fb146f67fbfe95c76b
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetalang.cpp | 42 | ||||
-rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetalang.h | 3 |
2 files changed, 33 insertions, 12 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp index 572b4f99d..020849b11 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp @@ -2006,20 +2006,38 @@ QDebug operator<<(QDebug debug, const UsingMember &d) return debug; } -QDebug operator<<(QDebug d, const AbstractMetaClassCPtr &ac) -{ - QDebugStateSaver saver(d); - d.noquote(); - d.nospace(); - d << "AbstractMetaClass("; - if (ac) { - ac->format(d); - if (d.verbosity() > 2) - ac->formatMembers(d); +void formatMetaClass(QDebug &ddebug, const AbstractMetaClass *ac) +{ + QDebugStateSaver saver(ddebug); + ddebug.noquote(); + ddebug.nospace(); + ddebug << "AbstractMetaClass("; + if (ac != nullptr) { + ac->format(ddebug); + if (ddebug.verbosity() > 2) + ac->formatMembers(ddebug); } else { - d << '0'; + ddebug << '0'; } - d << ')'; + ddebug << ')'; +} + +QDebug operator<<(QDebug d, const AbstractMetaClassCPtr &ac) +{ + formatMetaClass(d, ac.get()); return d; } + +QDebug operator<<(QDebug d, const AbstractMetaClassPtr &ac) +{ + formatMetaClass(d, ac.get()); + return d; +} + +QDebug operator<<(QDebug d, const AbstractMetaClass *ac) +{ + formatMetaClass(d, ac); + return d; +} + #endif // !QT_NO_DEBUG_STREAM diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.h b/sources/shiboken6/ApiExtractor/abstractmetalang.h index e9766a17b..3ba1afb59 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetalang.h +++ b/sources/shiboken6/ApiExtractor/abstractmetalang.h @@ -344,6 +344,9 @@ private: void format(QDebug &d) const; void formatMembers(QDebug &d) const; friend QDebug operator<<(QDebug d, const AbstractMetaClassCPtr &ac); + friend QDebug operator<<(QDebug d, const AbstractMetaClassPtr &ac); + friend QDebug operator<<(QDebug d, const AbstractMetaClass *ac); + friend void formatMetaClass(QDebug &, const AbstractMetaClass *); #endif QScopedPointer<AbstractMetaClassPrivate> d; |