diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-06-16 10:23:19 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2020-06-16 22:46:16 +0200 |
commit | 1b10ce6a08edbc2ac7e8fd7e97e3fc691f2081df (patch) | |
tree | 34ab485d1dd9435369709b5e77c11af6dec78c22 /tools/qmllint/checkidentifiers.cpp | |
parent | b65eee039092fa664e781cdd98a4bb5e66815218 (diff) |
Port QtDeclarative from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tools/qmllint/checkidentifiers.cpp')
-rw-r--r-- | tools/qmllint/checkidentifiers.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp index 0bd5c8127e..32c2fa4d79 100644 --- a/tools/qmllint/checkidentifiers.cpp +++ b/tools/qmllint/checkidentifiers.cpp @@ -37,21 +37,21 @@ class IssueLocationWithContext public: IssueLocationWithContext(const QString &code, const QQmlJS::SourceLocation &location) { int before = std::max(0,code.lastIndexOf(QLatin1Char('\n'), location.offset)); - m_beforeText = code.midRef(before + 1, int(location.offset - (before + 1))); - m_issueText = code.midRef(location.offset, location.length); + m_beforeText = QStringView{code}.mid(before + 1, int(location.offset - (before + 1))); + m_issueText = QStringView{code}.mid(location.offset, location.length); int after = code.indexOf(QLatin1Char('\n'), int(location.offset + location.length)); - m_afterText = code.midRef(int(location.offset + location.length), + m_afterText = QStringView{code}.mid(int(location.offset + location.length), int(after - (location.offset+location.length))); } - QStringRef beforeText() const { return m_beforeText; } - QStringRef issueText() const { return m_issueText; } - QStringRef afterText() const { return m_afterText; } + QStringView beforeText() const { return m_beforeText; } + QStringView issueText() const { return m_issueText; } + QStringView afterText() const { return m_afterText; } private: - QStringRef m_beforeText; - QStringRef m_issueText; - QStringRef m_afterText; + QStringView m_beforeText; + QStringView m_issueText; + QStringView m_afterText; }; static void writeWarning(ColorOutput *out) |