diff options
author | David Faure <faure@kde.org> | 2012-07-27 13:53:16 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-27 22:05:26 +0200 |
commit | 8cf7cf0cb96188b42e10958711f8c3aa016396c3 (patch) | |
tree | e8d30c34775aa5a4dc320a2c2ac535e2d6933beb /src/corelib/io/qdebug.h | |
parent | 54e3ce17053619a323cf5ba436773101da6fda23 (diff) |
QDebug: Add getter/setter for auto-insert-spaces.
This is useful for inserting a string without space-handling, given that
dbg.nospace() followed by dbg.space() inserts a space.
It's also useful for QDebug operators for custom types, so that they
can disable space handling and then restore to whatever it was before
(rather than forcing it to space() mode).
Change-Id: I9d72e9ffbcbc581ed093168752c29af924405b33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qdebug.h')
-rw-r--r-- | src/corelib/io/qdebug.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 4d546a9ca1..8bc4128a95 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -97,6 +97,9 @@ public: inline QDebug &nospace() { stream->space = false; return *this; } inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; } + bool autoInsertSpaces() const { return stream->space; } + void setAutoInsertSpaces(bool b) { stream->space = b; } + inline QDebug &operator<<(QChar t) { stream->ts << '\'' << t << '\''; return maybeSpace(); } inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); } inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); } |