Port QStringRef to QStringView.

This commit is contained in:
Andrius Štikonas 2022-01-15 22:49:42 +00:00
parent b0cd5def42
commit 7eb2ceed17
2 changed files with 3 additions and 3 deletions

View File

@ -8,6 +8,7 @@
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QStringView>
const static QString requiredPartition = QStringLiteral("RequiredPartition"); const static QString requiredPartition = QStringLiteral("RequiredPartition");
const static QString noBlockIoProtocol = QStringLiteral("NoBlockIOProtocol"); const static QString noBlockIoProtocol = QStringLiteral("NoBlockIOProtocol");
@ -25,7 +26,7 @@ quint64 SfdiskGptAttributes::toULongLong(const QStringList& attrs)
else if (attr.compare(legacyBiosBootable) == 0) else if (attr.compare(legacyBiosBootable) == 0)
attributes |= 0x4ULL; attributes |= 0x4ULL;
else if (attr.startsWith(guid)) else if (attr.startsWith(guid))
attributes |= 1ULL << QStringRef(&attr, guid.length(), attr.length() - guid.length()).toULongLong(); attributes |= 1ULL << QStringView{ attr }.mid(guid.length(), attr.length() - guid.length()).toULongLong();
return attributes; return attributes;
} }

View File

@ -8,8 +8,7 @@
#define SFDISKGPTATTRIBUTES__H #define SFDISKGPTATTRIBUTES__H
#include <QtGlobal> #include <QtGlobal>
#include <QStringList>
class QStringList;
/** Sfdisk GPT Attributes helpers. /** Sfdisk GPT Attributes helpers.
@author Gaël PORTAY <gael.portay@collabora.com> @author Gaël PORTAY <gael.portay@collabora.com>