From 7f8e3aab2d5aca5349fd0f0da6245465dc7db5e0 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Fri, 12 Jul 2019 20:22:49 +0100 Subject: JSON: add some QStringView overloads [ChangeLog][QtCore][JSON] Added overloads of functions taking key strings as QStringView; in QJsonObject, QJsonValue and QJsonDocument. Change-Id: I78b40aba8200003acfae257ff06f5f15737005e7 Reviewed-by: Thiago Macieira Reviewed-by: Anton Kudryavtsev --- src/corelib/serialization/qjson.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/serialization/qjson.cpp') diff --git a/src/corelib/serialization/qjson.cpp b/src/corelib/serialization/qjson.cpp index d74ffb2a20..76f1eae1ce 100644 --- a/src/corelib/serialization/qjson.cpp +++ b/src/corelib/serialization/qjson.cpp @@ -175,7 +175,7 @@ void Base::removeItems(int pos, int numItems) length -= numItems; } -int Object::indexOf(const QString &key, bool *exists) const +int Object::indexOf(QStringView key, bool *exists) const { int min = 0; int n = length; @@ -257,7 +257,7 @@ bool Array::isValid(int maxSize) const } -bool Entry::operator ==(const QString &key) const +bool Entry::operator ==(QStringView key) const { if (value.latinKey) return (shallowLatin1Key() == key); @@ -270,7 +270,7 @@ bool Entry::operator==(QLatin1String key) const if (value.latinKey) return shallowLatin1Key() == key; else - return shallowKey() == key; + return shallowKey() == QString(key); // ### conversion to QString } bool Entry::operator ==(const Entry &other) const -- cgit v1.2.3