summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdebug.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-05-02 19:23:13 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-03-17 10:01:04 +0100
commit165de1002719175c75df61913d36c2189538a84b (patch)
tree39f3be146633ad2f25b1a55d000edb1475149082 /src/corelib/io/qdebug.h
parent7ef382649754c261ca9eb99dd50b67050e748efb (diff)
Introduce helper class QTaggedPointer
Useful for attaching small bits of information in the alignment bits of a naked pointer. For use in the new property system as well as in qtdeclarative (where currently a similar class exists as private API). Change-Id: Idf9b93e714e15129f302e16425dbeda94bcd207b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/io/qdebug.h')
-rw-r--r--src/corelib/io/qdebug.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index e14d31f38a..aa69a1ae23 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -356,6 +356,16 @@ inline QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
return debug;
}
+template <typename T, typename Tag> class QTaggedPointer;
+
+template <typename T, typename Tag>
+inline QDebug operator<<(QDebug debug, const QTaggedPointer<T, Tag> &ptr)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace() << "QTaggedPointer(" << ptr.pointer() << ", " << ptr.tag() << ")";
+ return debug;
+}
+
Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value);
template <typename Int>