diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-05-25 14:25:06 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-06-11 02:51:03 +0200 |
commit | d984adac68a70c0a23b411b103a4c8d777d6fb0d (patch) | |
tree | a519c261a12ef7cb98a3f29830ab53deb8cb9196 /src/gui/text/qtexthtmlparser.cpp | |
parent | 82a0f4a193367fc661c95a832fbec74f8e9a76d1 (diff) |
Port QtGui from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I1761096fbcc9421a013cf73f831a2a2ba0c18006
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index be82578f5c..bec636757e 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -328,17 +328,17 @@ bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2) } #endif -static bool operator<(const QStringRef &entityStr, const QTextHtmlEntity &entity) +static bool operator<(QStringView entityStr, const QTextHtmlEntity &entity) { return entityStr < QLatin1String(entity.name); } -static bool operator<(const QTextHtmlEntity &entity, const QStringRef &entityStr) +static bool operator<(const QTextHtmlEntity &entity, QStringView entityStr) { return QLatin1String(entity.name) < entityStr; } -static QChar resolveEntity(const QStringRef &entity) +static QChar resolveEntity(QStringView entity) { const QTextHtmlEntity *start = &entities[0]; const QTextHtmlEntity *end = &entities[MAX_ENTITY]; @@ -804,7 +804,7 @@ QString QTextHtmlParser::parseEntity() { const int recover = pos; int entityLen = 0; - QStringRef entity; + QStringView entity; while (pos < len) { QChar c = txt.at(pos++); if (c.isSpace() || pos - recover > 9) { @@ -815,7 +815,7 @@ QString QTextHtmlParser::parseEntity() ++entityLen; } if (entityLen) { - entity = QStringRef(&txt, recover, entityLen); + entity = QStringView(txt).mid(recover, entityLen); QChar resolved = resolveEntity(entity); if (!resolved.isNull()) return QString(resolved); @@ -1503,7 +1503,7 @@ static void setWidthAttribute(QTextLength *width, const QString &valueStr) if (ok) { *width = QTextLength(QTextLength::FixedLength, realVal); } else { - QStringRef value = QStringRef(&valueStr).trimmed(); + auto value = QStringView(valueStr).trimmed(); if (!value.isEmpty() && value.endsWith(QLatin1Char('%'))) { value.truncate(value.size() - 1); realVal = value.toDouble(&ok); |