diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-01-23 16:19:11 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-02-09 11:30:02 +0000 |
commit | 868201155fd677dbc6d14346f5ea61e82ebce27b (patch) | |
tree | 75d02a144c205d659e5851f95f306e3a12b0ff5e /src/corelib/tools/qregularexpression.cpp | |
parent | 6389160f04322449c34bd1ecfe53983e3b588943 (diff) |
QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<
Unify the behavior of the different operator<< by always using
QDebugStateSaver (appending an optional space at exit), and making
sure that the space(), nospace() setting isn't 'leaked'.
Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/corelib/tools/qregularexpression.cpp')
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 228ee5b842..2d469414ee 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2444,8 +2444,9 @@ QDataStream &operator>>(QDataStream &in, QRegularExpression &re) */ QDebug operator<<(QDebug debug, const QRegularExpression &re) { + QDebugStateSaver saver(debug); debug.nospace() << "QRegularExpression(" << re.pattern() << ", " << re.patternOptions() << ")"; - return debug.space(); + return debug; } /*! @@ -2458,6 +2459,7 @@ QDebug operator<<(QDebug debug, const QRegularExpression &re) */ QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions) { + QDebugStateSaver saver(debug); QByteArray flags; if (patternOptions == QRegularExpression::NoPatternOption) { @@ -2487,7 +2489,7 @@ QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOption debug.nospace() << "QRegularExpression::PatternOptions(" << flags << ")"; - return debug.space(); + return debug; } /*! \relates QRegularExpressionMatch @@ -2499,11 +2501,12 @@ QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOption */ QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match) { + QDebugStateSaver saver(debug); debug.nospace() << "QRegularExpressionMatch("; if (!match.isValid()) { debug << "Invalid)"; - return debug.space(); + return debug; } debug << "Valid"; @@ -2528,7 +2531,7 @@ QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match) debug << ")"; - return debug.space(); + return debug; } #endif |