summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <dangelog@gmail.com>2012-02-07 23:56:40 +0000
committerQt by Nokia <qt-info@nokia.com>2012-03-06 21:54:11 +0100
commitaea65cbaa4fd889129d7945600dad3277f9c6d9b (patch)
treec02f2d94450c8f9080cbad4153c841ba97a69732 /src/corelib/tools
parentc7cb455a47c42e8e658e3433defee613f8643cd2 (diff)
QRegularExpression: QDebug support for pattern options
Added the proper QDebug operator to debug the QRegularExpression::PatternOptions flags. Change-Id: Icd00e93a0c6cc4345db528d494fc176624f7b7a2 Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qregularexpression.cpp37
-rw-r--r--src/corelib/tools/qregularexpression.h1
2 files changed, 38 insertions, 0 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index 488a454aaa..7fbbfaa9ef 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -1977,6 +1977,43 @@ QDebug operator<<(QDebug debug, const QRegularExpression &re)
}
/*!
+ \relates QRegularExpression
+
+ Writes the pattern options \a patternOptions into the debug object \a debug
+ for debugging purposes.
+
+ \sa {Debugging Techniques}
+*/
+QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions)
+{
+ QStringList flags;
+
+ if (patternOptions == QRegularExpression::NoPatternOption) {
+ flags << QLatin1String("NoPatternOption");
+ } else {
+ if (patternOptions & QRegularExpression::CaseInsensitiveOption)
+ flags << QLatin1String("CaseInsensitiveOption");
+ if (patternOptions & QRegularExpression::DotMatchesEverythingOption)
+ flags << QLatin1String("DotMatchesEverythingOption");
+ if (patternOptions & QRegularExpression::MultilineOption)
+ flags << QLatin1String("MultilineOption");
+ if (patternOptions & QRegularExpression::ExtendedPatternSyntaxOption)
+ flags << QLatin1String("ExtendedPatternSyntaxOption");
+ if (patternOptions & QRegularExpression::InvertedGreedinessOption)
+ flags << QLatin1String("InvertedGreedinessOption");
+ if (patternOptions & QRegularExpression::DontCaptureOption)
+ flags << QLatin1String("DontCaptureOption");
+ if (patternOptions & QRegularExpression::UseUnicodePropertiesOption)
+ flags << QLatin1String("UseUnicodePropertiesOption");
+ }
+
+ debug.nospace() << "QRegularExpression::PatternOptions("
+ << qPrintable(flags.join(QLatin1String("|")))
+ << ")";
+
+ return debug.space();
+}
+/*!
\relates QRegularExpressionMatch
Writes the match object \a match into the debug object \a debug for
diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h
index c9bcb1e7ba..13c7de7cab 100644
--- a/src/corelib/tools/qregularexpression.h
+++ b/src/corelib/tools/qregularexpression.h
@@ -142,6 +142,7 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QRegularExpression &re);
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QRegularExpression &re);
+Q_CORE_EXPORT QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions);
#endif
struct QRegularExpressionMatchPrivate;