summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdebug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qdebug.h')
-rw-r--r--src/corelib/io/qdebug.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index bc68599..093312f 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -254,6 +254,29 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
return debug.space();
}
+#if defined(FORCE_UREF)
+template <class T>
+inline QDebug &operator<<(QDebug debug, const QFlags<T> &flags)
+#else
+template <class T>
+inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
+#endif
+{
+ debug.nospace() << "QFlags(";
+ bool needSeparator = false;
+ for (uint i = 0; i < sizeof(T) * 8; ++i) {
+ if (flags.testFlag(T(1 << i))) {
+ if (needSeparator)
+ debug.nospace() << '|';
+ else
+ needSeparator = true;
+ debug.nospace() << "0x" << QByteArray::number(T(1 << i), 16).constData();
+ }
+ }
+ debug << ')';
+ return debug.space();
+}
+
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); }