summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdebug.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-09-03 12:21:46 +0200
committerLars Knoll <lars.knoll@qt.io>2020-09-11 19:32:36 +0200
commit1316a0aef287e47d63aab247751842a901d8f786 (patch)
treeaccd64be2c7bc3b8bcf946a364821d833b24aec4 /src/corelib/io/qdebug.h
parentdefc8414fde0ea9f52fe554e00fe2f04947b7578 (diff)
Fix Qt6 related comments in qdebug
Change-Id: I9861d29a6615863094cd007178f214a816865eb7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/corelib/io/qdebug.h')
-rw-r--r--src/corelib/io/qdebug.h59
1 files changed, 23 insertions, 36 deletions
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index b3787f9e78..2663fceb65 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -68,39 +68,26 @@ class Q_CORE_EXPORT QDebug : public QIODeviceBase
struct Stream {
enum { VerbosityShift = 29, VerbosityMask = 0x7 };
- Stream(QIODevice *device) : ts(device), ref(1), type(QtDebugMsg),
- space(true), message_output(false), flags(DefaultVerbosity << VerbosityShift) {}
- Stream(QString *string) : ts(string, WriteOnly), ref(1), type(QtDebugMsg),
- space(true), message_output(false), flags(DefaultVerbosity << VerbosityShift) {}
- Stream(QtMsgType t) : ts(&buffer, WriteOnly), ref(1), type(t),
- space(true), message_output(true), flags(DefaultVerbosity << VerbosityShift) {}
+ Stream(QIODevice *device)
+ : ts(device)
+ {}
+ Stream(QString *string)
+ : ts(string, WriteOnly)
+ {}
+ Stream(QtMsgType t)
+ : ts(&buffer, WriteOnly),
+ type(t),
+ message_output(true)
+ {}
QTextStream ts;
QString buffer;
- int ref;
- QtMsgType type;
- bool space;
- bool message_output;
+ int ref = 1;
+ QtMsgType type = QtDebugMsg;
+ bool space = true;
+ bool noQuotes = false;
+ bool message_output = false;
+ int verbosity = DefaultVerbosity;
QMessageLogContext context;
-
- enum FormatFlag { // Note: Bits 29..31 are reserved for the verbose level introduced in 5.6.
- NoQuotes = 0x1
- };
-
- // ### Qt 6: unify with space, introduce own version member
- bool testFlag(FormatFlag flag) const { return (context.version > 1) ? (flags & flag) : false; }
- void setFlag(FormatFlag flag) { if (context.version > 1) { flags |= flag; } }
- void unsetFlag(FormatFlag flag) { if (context.version > 1) { flags &= ~flag; } }
- int verbosity() const
- { return context.version > 1 ? (flags >> VerbosityShift) & VerbosityMask : int(DefaultVerbosity); }
- void setVerbosity(int v)
- {
- if (context.version > 1) {
- flags &= ~(uint(VerbosityMask) << VerbosityShift);
- flags |= (v & VerbosityMask) << VerbosityShift;
- }
- }
- // added in 5.4
- int flags;
} *stream;
enum Latin1Content { ContainsBinary = 0, ContainsLatin1 };
@@ -125,17 +112,17 @@ public:
inline QDebug &space() { stream->space = true; stream->ts << ' '; return *this; }
inline QDebug &nospace() { stream->space = false; return *this; }
inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; }
- inline QDebug &verbosity(int verbosityLevel) { setVerbosity(verbosityLevel); return *this; }
- int verbosity() const { return stream->verbosity(); }
- void setVerbosity(int verbosityLevel) { stream->setVerbosity(verbosityLevel); }
+ inline QDebug &verbosity(int verbosityLevel) { stream->verbosity = verbosityLevel; return *this; }
+ int verbosity() const { return stream->verbosity; }
+ void setVerbosity(int verbosityLevel) { stream->verbosity = verbosityLevel; }
enum VerbosityLevel { MinimumVerbosity = 0, DefaultVerbosity = 2, MaximumVerbosity = 7 };
bool autoInsertSpaces() const { return stream->space; }
void setAutoInsertSpaces(bool b) { stream->space = b; }
- inline QDebug &quote() { stream->unsetFlag(Stream::NoQuotes); return *this; }
- inline QDebug &noquote() { stream->setFlag(Stream::NoQuotes); return *this; }
- inline QDebug &maybeQuote(char c = '"') { if (!(stream->testFlag(Stream::NoQuotes))) stream->ts << c; return *this; }
+ inline QDebug &quote() { stream->noQuotes = false; return *this; }
+ inline QDebug &noquote() { stream->noQuotes = true; return *this; }
+ inline QDebug &maybeQuote(char c = '"') { if (!stream->noQuotes) stream->ts << c; return *this; }
inline QDebug &operator<<(QChar t) { putUcs4(t.unicode()); return maybeSpace(); }
inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); }