summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcbormap.h
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-09-14 14:59:21 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-11-01 15:02:46 +0000
commit779a73762de6addb2a2e3fee5b98d00d64101b92 (patch)
tree71f69f8a2b18f369ee7ed4bab385b8cc2c4b6ad4 /src/corelib/serialization/qcbormap.h
parentf09fc1f35294827245e74ced48274387d5ed346f (diff)
Fully support operator[] on QCborValue and QCborValueRef
Added operator[] to QCborValueRef and mutating operator[] both there and in QCborValue. If the value (referenced) is not a container, it is replaced with a map and a reference into the result is returned. If the value is an array and the key is a string, negative, or more than 0xffff, the array is first converted to a map. Change-Id: Ibbc9e480fb25eb3d05547c8a1b99e762b2a68b68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization/qcbormap.h')
-rw-r--r--src/corelib/serialization/qcbormap.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/serialization/qcbormap.h b/src/corelib/serialization/qcbormap.h
index 0eb163a0a8..15a3bcdcef 100644
--- a/src/corelib/serialization/qcbormap.h
+++ b/src/corelib/serialization/qcbormap.h
@@ -118,6 +118,8 @@ public:
QCborValueRef item; // points to the value
friend class Iterator;
friend class QCborMap;
+ friend class QCborValue;
+ friend class QCborValueRef;
ConstIterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {}
public:
typedef std::random_access_iterator_tag iterator_category;
@@ -323,9 +325,10 @@ public:
QJsonObject toJsonObject() const;
private:
+ friend class QCborValue;
+ friend class QCborValueRef;
void detach(qsizetype reserve = 0);
- friend QCborValue;
explicit QCborMap(QCborContainerPrivate &dd) noexcept;
QExplicitlySharedDataPointer<QCborContainerPrivate> d;
};