QJsonObject: add some overloads taking QLatin1String
QXmlStreamReader also has QLatin1String overloads, which
greatly benefits parsers, since the vast majority of keys
in both JSON and XML are US-ASCII. This patch adds such an
overload to the JSON parser.
The value() function is all typical parsers need, so even
though many more QJsonObject functions taking QString could
benefit from the same treatment, value() is the single most
important one for read-only JSON access.
Add some more overloads, too, for functions that don't need
more internal scaffolding than value(). Requires adding a
dummy op[](QL1S) (forwarding to the QString overload) so as
not to make
QJsonObject json;
json[QLatin1String("key")]; // mutable
ambiguous between const op[](QL1S) and mutable op[](QString).
[ChangeLog][QtCore][QJsonObject] Added value(), op[] const,
find(), constFind(), contains() overloads taking QLatin1String.
Change-Id: I00883028956ad949ba5ba2b18dd8a6a25ad5085b
Reviewed-by:
Lars Knoll <lars.knoll@theqtcompany.com>
Showing
- src/corelib/json/qjson.cpp 31 additions, 1 deletionsrc/corelib/json/qjson.cpp
- src/corelib/json/qjson_p.h 17 additions, 1 deletionsrc/corelib/json/qjson_p.h
- src/corelib/json/qjsonobject.cpp 80 additions, 0 deletionssrc/corelib/json/qjsonobject.cpp
- src/corelib/json/qjsonobject.h 7 additions, 0 deletionssrc/corelib/json/qjsonobject.h
- tests/auto/corelib/json/tst_qtjson.cpp 10 additions, 9 deletionstests/auto/corelib/json/tst_qtjson.cpp
Please register or sign in to comment