Replace QStringRef with QStringView

This commit is contained in:
Vladimir Golovnev (Glassez)
2021-03-01 09:40:30 +03:00
parent 27baa55443
commit 399d3ad85a
26 changed files with 82 additions and 90 deletions

View File

@@ -60,16 +60,16 @@ int Utils::Compare::naturalCompare(const QString &left, const QString &right, co
{
// Both are digits, compare the numbers
const auto numberView = [](const QString &str, int &pos) -> QStringRef
const auto numberView = [](const QStringView str, int &pos) -> QStringView
{
const int start = pos;
while ((pos < str.size()) && str[pos].isDigit())
++pos;
return str.midRef(start, (pos - start));
return str.mid(start, (pos - start));
};
const QStringRef numViewL = numberView(left, posL);
const QStringRef numViewR = numberView(right, posR);
const QStringView numViewL = numberView(left, posL);
const QStringView numViewR = numberView(right, posR);
if (numViewL.length() != numViewR.length())
return (numViewL.length() - numViewR.length());