QTimeZonePrivate::territory: use QStringTokenizer
A follow-up to 6ec3321875
where the
function was optimized using a hand-rolled lazy-split on a QBAView.
Now that QLatin1String::indexOf(QLatin1String) has been optimized we can
use QStringTokenizer instead.
Change-Id: I30b15d309e7c364c0a4dafe31651b39ea14db7e5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
523ee5577a
commit
77d62727d0
@ -177,12 +177,10 @@ QLocale::Territory QTimeZonePrivate::territory() const
|
||||
for (int i = 0; i < zoneDataTableSize; ++i) {
|
||||
const QZoneData *data = zoneData(i);
|
||||
QByteArrayView idView = ianaIdView(data);
|
||||
while (!idView.isEmpty()) {
|
||||
qsizetype index = idView.indexOf(' ');
|
||||
QByteArrayView next = index == -1 ? idView : idView.first(index);
|
||||
if (next == m_id)
|
||||
return (QLocale::Territory)data->territory;
|
||||
idView = index == -1 ? QByteArrayView() : idView.sliced(index + 1);
|
||||
QLatin1String view(idView.data(), idView.size());
|
||||
for (QLatin1String token : view.tokenize(QLatin1String(" "))) {
|
||||
if (token == QLatin1String(m_id.data(), m_id.size()))
|
||||
return QLocale::Territory(data->territory);
|
||||
}
|
||||
}
|
||||
return QLocale::AnyTerritory;
|
||||
|
Loading…
Reference in New Issue
Block a user