From d263147921800e7b6d357d1a48f28f21a8092b84 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 27 Nov 2021 11:28:57 -0600 Subject: QJsonValueRef: optimize the assignment Inline some content to avoid unnecessary round-trips through qcborvalue.cpp, qjsonarray.cpp and qjsonobject.cpp. Unlike the CBOR counterparts, JSON support has this extra functionality that assigning Undefined causes the item to be removed from the object (arrays don't have that behavior, they just become null). And unlike QCborValueRef, we detach on assignment, not on the obtention of the QJsonValueRef. This is more dangerous, so we may want to revise. Change-Id: I89446ea06b5742efb194fffd16bb775e9566ca1a Reviewed-by: Sona Kurazyan --- src/corelib/serialization/qjsonobject.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/serialization/qjsonobject.cpp') diff --git a/src/corelib/serialization/qjsonobject.cpp b/src/corelib/serialization/qjsonobject.cpp index 014224c4db1..ee4ea8ce238 100644 --- a/src/corelib/serialization/qjsonobject.cpp +++ b/src/corelib/serialization/qjsonobject.cpp @@ -1428,6 +1428,7 @@ QString QJsonObject::keyAt(qsizetype i) const return o->stringAt(i * 2); } +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) /*! \internal */ @@ -1452,6 +1453,7 @@ void QJsonObject::setValueAt(qsizetype i, const QJsonValue &val) o->replaceAt(2 * i + 1, QCborValue::fromJsonValue(val)); } } +#endif // Qt 7 /*! \internal -- cgit v1.2.3