From 9bc6037c5d89d13d93c43ea41d317c74ec7f69bf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 29 Jan 2024 13:21:54 +0100 Subject: 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 --- .../shiboken6/ApiExtractor/abstractmetalang.cpp | 42 +++++++++++++++------- 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 d; -- cgit v1.2.3