diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-03-05 15:52:29 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-06-16 13:22:18 +0200 |
commit | 9648ffff7efbb3582506184191411197c9099c69 (patch) | |
tree | 2bf3389c6e5639269746847331d8f237bb4b96af /src | |
parent | 6ce44c53c7aa802b817b72d49de88e4da0181488 (diff) |
QLoggingSettingsParser: port setContent() to QStringView
Amends 16f927a4f1ffeff399351b625d73ac3cd7bccd51.
At the time the original change was written, QStringTokenizer
had not been integrated, yet.
Change-Id: I83c31d816199bc48c4baea855d13cbf9eda9aaa2
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qloggingregistry.cpp | 6 | ||||
-rw-r--r-- | src/corelib/io/qloggingregistry_p.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index e1e35a07ed..c41e131f79 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -43,6 +43,7 @@ #include <QtCore/qlibraryinfo.h> #include <QtCore/private/qlocking_p.h> #include <QtCore/qstandardpaths.h> +#include <QtCore/qstringtokenizer.h> #include <QtCore/qtextstream.h> #include <QtCore/qdir.h> #include <QtCore/qcoreapplication.h> @@ -186,11 +187,10 @@ void QLoggingRule::parse(QStringView pattern) \internal Parses configuration from \a content. */ -void QLoggingSettingsParser::setContent(const QString &content) +void QLoggingSettingsParser::setContent(QStringView content) { _rules.clear(); - const auto lines = QStringView{content}.split(QLatin1Char('\n')); - for (const auto &line : lines) + for (auto line : qTokenize(content, u'\n')) parseNextLine(line); } diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h index 9687a0e20d..e8a94a030a 100644 --- a/src/corelib/io/qloggingregistry_p.h +++ b/src/corelib/io/qloggingregistry_p.h @@ -95,7 +95,7 @@ class Q_AUTOTEST_EXPORT QLoggingSettingsParser public: void setImplicitRulesSection(bool inRulesSection) { m_inRulesSection = inRulesSection; } - void setContent(const QString &content); + void setContent(QStringView content); void setContent(QTextStream &stream); QList<QLoggingRule> rules() const { return _rules; } |