UI: Rename StringViewList to SplitViewResult.

This commit is contained in:
Nodir Temirkhodjaev 2020-10-05 17:01:40 +03:00
parent 124b1ddd33
commit c7f80ec537
7 changed files with 11 additions and 11 deletions

View File

@ -6,11 +6,11 @@
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
using StringView = QStringRef; using StringView = QStringRef;
using StringViewList = QVector<QStringRef>; using SplitViewResult = QVector<QStringRef>;
# define toStringView(str) (QStringRef(&str)) # define toStringView(str) (QStringRef(&str))
#else #else
using StringView = QStringView; using StringView = QStringView;
using StringViewList = QList<QStringView>; using SplitViewResult = QList<QStringView>;
# define toStringView(str) (QStringView(str)) # define toStringView(str) (QStringView(str))
#endif #endif

View File

@ -63,9 +63,9 @@ void TaskZoneDownloader::loadLocalFile()
downloadFinished(success); downloadFinished(success);
} }
StringViewList TaskZoneDownloader::parseAddresses(const QString &text, QString &checksum) const SplitViewResult TaskZoneDownloader::parseAddresses(const QString &text, QString &checksum) const
{ {
StringViewList list; SplitViewResult list;
QCryptographicHash cryptoHash(QCryptographicHash::Sha256); QCryptographicHash cryptoHash(QCryptographicHash::Sha256);
// Parse lines // Parse lines
@ -93,7 +93,7 @@ StringViewList TaskZoneDownloader::parseAddresses(const QString &text, QString &
return list; return list;
} }
bool TaskZoneDownloader::storeAddresses(const StringViewList &list) bool TaskZoneDownloader::storeAddresses(const SplitViewResult &list)
{ {
Ip4Range ip4Range; Ip4Range ip4Range;
if (!ip4Range.fromList(list, emptyNetMask(), sort())) { if (!ip4Range.fromList(list, emptyNetMask(), sort())) {

View File

@ -54,9 +54,9 @@ public:
const QByteArray &zoneData() const { return m_zoneData; } const QByteArray &zoneData() const { return m_zoneData; }
StringViewList parseAddresses(const QString &text, QString &textChecksum) const; SplitViewResult parseAddresses(const QString &text, QString &textChecksum) const;
bool storeAddresses(const StringViewList &list); bool storeAddresses(const SplitViewResult &list);
bool loadAddresses(); bool loadAddresses();
bool saveAddressesAsText(const QString &filePath); bool saveAddressesAsText(const QString &filePath);

View File

@ -64,7 +64,7 @@ bool Ip4Range::fromText(const QString &text)
return fromList(list); return fromList(list);
} }
bool Ip4Range::fromList(const StringViewList &list, int emptyNetMask, bool sort) bool Ip4Range::fromList(const SplitViewResult &list, int emptyNetMask, bool sort)
{ {
Q_UNUSED(sort); // TODO Q_UNUSED(sort); // TODO

View File

@ -51,7 +51,7 @@ public:
// Parse IPv4 ranges // Parse IPv4 ranges
bool fromText(const QString &text); bool fromText(const QString &text);
bool fromList(const StringViewList &list, int emptyNetMask = 32, bool sort = true); bool fromList(const SplitViewResult &list, int emptyNetMask = 32, bool sort = true);
signals: signals:
void errorLineNoChanged(); void errorLineNoChanged();

View File

@ -32,7 +32,7 @@ int StringUtil::lineEnd(const QString &text, int pos, int badPos)
return (endPos != -1) ? endPos : badPos; return (endPos != -1) ? endPos : badPos;
} }
StringViewList StringUtil::splitView(const QString &text, QLatin1Char sep, bool skipEmptyParts) SplitViewResult StringUtil::splitView(const QString &text, QLatin1Char sep, bool skipEmptyParts)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto behavior = skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts; const auto behavior = skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts;

View File

@ -15,7 +15,7 @@ public:
static int lineStart(const QString &text, int pos, int badPos = -1); static int lineStart(const QString &text, int pos, int badPos = -1);
static int lineEnd(const QString &text, int pos, int badPos = -1); static int lineEnd(const QString &text, int pos, int badPos = -1);
static StringViewList splitView( static SplitViewResult splitView(
const QString &text, QLatin1Char sep, bool skipEmptyParts = false); const QString &text, QLatin1Char sep, bool skipEmptyParts = false);
}; };