diff options
author | Giuseppe D'Angelo <dangelog@gmail.com> | 2012-03-23 05:51:11 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-31 18:31:29 +0200 |
commit | 989b7f2337aa45de2cbbf34c634364b4469ee342 (patch) | |
tree | 0411d49ea208cbe82be86fa5f351addda2690fd3 /src/corelib | |
parent | 0556540b41c012712753d1ec79620b1b0ff1f17d (diff) |
QRegularExpression: operator<<(QDebug, PatternOptions) improvements
Avoid building a QStringList and then joining the strings with pipes;
directly append the flags to a QByteArray instead.
Change-Id: Ic352b756ed1e3b6b579b9ca412636a2b394d2eb5
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index eaa20b304a..27264f7e72 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2153,30 +2153,30 @@ QDebug operator<<(QDebug debug, const QRegularExpression &re) */ QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions) { - QStringList flags; + QByteArray flags; if (patternOptions == QRegularExpression::NoPatternOption) { - flags << QLatin1String("NoPatternOption"); + flags = "NoPatternOption"; } else { + flags.reserve(200); // worst case... if (patternOptions & QRegularExpression::CaseInsensitiveOption) - flags << QLatin1String("CaseInsensitiveOption"); + flags.append("CaseInsensitiveOption|"); if (patternOptions & QRegularExpression::DotMatchesEverythingOption) - flags << QLatin1String("DotMatchesEverythingOption"); + flags.append("DotMatchesEverythingOption|"); if (patternOptions & QRegularExpression::MultilineOption) - flags << QLatin1String("MultilineOption"); + flags.append("MultilineOption|"); if (patternOptions & QRegularExpression::ExtendedPatternSyntaxOption) - flags << QLatin1String("ExtendedPatternSyntaxOption"); + flags.append("ExtendedPatternSyntaxOption|"); if (patternOptions & QRegularExpression::InvertedGreedinessOption) - flags << QLatin1String("InvertedGreedinessOption"); + flags.append("InvertedGreedinessOption|"); if (patternOptions & QRegularExpression::DontCaptureOption) - flags << QLatin1String("DontCaptureOption"); + flags.append("DontCaptureOption|"); if (patternOptions & QRegularExpression::UseUnicodePropertiesOption) - flags << QLatin1String("UseUnicodePropertiesOption"); + flags.append("UseUnicodePropertiesOption|"); + flags.chop(1); } - debug.nospace() << "QRegularExpression::PatternOptions(" - << qPrintable(flags.join(QLatin1String("|"))) - << ")"; + debug.nospace() << "QRegularExpression::PatternOptions(" << flags << ")"; return debug.space(); } |