diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2021-11-27 11:28:57 -0600 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-02-15 17:00:05 -0800 |
commit | d263147921800e7b6d357d1a48f28f21a8092b84 (patch) | |
tree | 44620354627d89cfdbf4ba3b802f6d9df5a61926 /src/corelib/serialization/qjsonobject.h | |
parent | c1780165eeca0db6c874866c3184cdaa65542b51 (diff) |
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 <sona.kurazyan@qt.io>
Diffstat (limited to 'src/corelib/serialization/qjsonobject.h')
-rw-r--r-- | src/corelib/serialization/qjsonobject.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/serialization/qjsonobject.h b/src/corelib/serialization/qjsonobject.h index d9f6785631..74f6905b60 100644 --- a/src/corelib/serialization/qjsonobject.h +++ b/src/corelib/serialization/qjsonobject.h @@ -303,8 +303,10 @@ private: template <typename T> iterator insertImpl(T key, const QJsonValue &value); QString keyAt(qsizetype i) const; +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) QJsonValue valueAt(qsizetype i) const; void setValueAt(qsizetype i, const QJsonValue &val); +#endif void removeAt(qsizetype i); template <typename T> iterator insertAt(qsizetype i, T key, const QJsonValue &val, bool exists); |