Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qcbormap.h
Go to the documentation of this file.
1// Copyright (C) 2022 Intel Corporation.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCBORMAP_H
5#define QCBORMAP_H
6
7#include <QtCore/qcborvalue.h>
8#include <QtCore/qpair.h>
9
10#include <initializer_list>
11
13
14class QJsonObject;
15class QDataStream;
16
17namespace QJsonPrivate { class Variant; }
18
20class Q_CORE_EXPORT QCborMap
21{
22public:
27
28 class ConstIterator;
29 class Iterator {
30 QCborValueRef item {}; // points to the value
31 friend class ConstIterator;
32 friend class QCborMap;
33 Iterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {}
34 public:
35 typedef std::random_access_iterator_tag iterator_category;
40
41 constexpr Iterator() = default;
42 constexpr Iterator(const Iterator &) = default;
44 {
45 // rebind the reference
46 item.d = other.item.d;
47 item.i = other.item.i;
48 return *this;
49 }
50
51 value_type operator*() const { return { QCborValueRef{item.d, item.i - 1}, item }; }
52 value_type operator[](qsizetype j) const { return *(*this + j); }
53 QCborValueRef *operator->() { return &item; }
54 const QCborValueConstRef *operator->() const { return &item; }
55#if QT_VERSION >= QT_VERSION_CHECK(7,0,0)
57#else
59#endif
60 key() const { return QCborValueRef(item.d, item.i - 1); }
61 QCborValueRef value() const { return item; }
62
63 bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
64 bool operator!=(const Iterator &o) const { return !(*this == o); }
65 bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
66 bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
67 bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
68 bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
69 bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
70 bool operator!=(const ConstIterator &o) const { return !(*this == o); }
71 bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
72 bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
73 bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
74 bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
75 Iterator &operator++() { item.i += 2; return *this; }
76 Iterator operator++(int) { Iterator n = *this; item.i += 2; return n; }
77 Iterator &operator--() { item.i -= 2; return *this; }
78 Iterator operator--(int) { Iterator n = *this; item.i -= 2; return n; }
79 Iterator &operator+=(qsizetype j) { item.i += 2 * j; return *this; }
80 Iterator &operator-=(qsizetype j) { item.i -= 2 * j; return *this; }
81 Iterator operator+(qsizetype j) const { return Iterator({ item.d, item.i + 2 * j }); }
82 Iterator operator-(qsizetype j) const { return Iterator({ item.d, item.i - 2 * j }); }
83 qsizetype operator-(Iterator j) const { return (item.i - j.item.i) / 2; }
84 };
85
87 QCborValueConstRef item; // points to the value
88 friend class Iterator;
89 friend class QCborMap;
90 friend class QCborValue;
91 friend class QCborValueRef;
94 public:
95 typedef std::random_access_iterator_tag iterator_category;
100
101 constexpr ConstIterator() = default;
102 constexpr ConstIterator(const ConstIterator &) = default;
104 {
105 // rebind the reference
106 item.d = other.item.d;
107 item.i = other.item.i;
108 return *this;
109 }
110
111 value_type operator*() const { return { QCborValueRef(item.d, item.i - 1), item }; }
112 value_type operator[](qsizetype j) const { return *(*this + j); }
113 const QCborValueConstRef *operator->() const { return &item; }
114#if QT_VERSION >= QT_VERSION_CHECK(7,0,0)
116#else
118#endif
119 key() const { return QCborValueRef(item.d, item.i - 1); }
120 QCborValueConstRef value() const { return item; }
121
122 bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
123 bool operator!=(const Iterator &o) const { return !(*this == o); }
124 bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
125 bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
126 bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
127 bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
128 bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
129 bool operator!=(const ConstIterator &o) const { return !(*this == o); }
130 bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
131 bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
132 bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
133 bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
134 ConstIterator &operator++() { item.i += 2; return *this; }
135 ConstIterator operator++(int) { ConstIterator n = *this; item.i += 2; return n; }
136 ConstIterator &operator--() { item.i -= 2; return *this; }
137 ConstIterator operator--(int) { ConstIterator n = *this; item.i -= 2; return n; }
138 ConstIterator &operator+=(qsizetype j) { item.i += 2 * j; return *this; }
139 ConstIterator &operator-=(qsizetype j) { item.i -= 2 * j; return *this; }
140 ConstIterator operator+(qsizetype j) const { return ConstIterator{ item.d, item.i + 2 * j }; }
141 ConstIterator operator-(qsizetype j) const { return ConstIterator{ item.d, item.i - 2 * j }; }
142 qsizetype operator-(ConstIterator j) const { return (item.i - j.item.i) / 2; }
143 };
144
145 QCborMap() noexcept;
146 QCborMap(const QCborMap &other) noexcept;
147 QCborMap &operator=(const QCborMap &other) noexcept;
148 QCborMap(std::initializer_list<value_type> args)
149 : QCborMap()
150 {
151 detach(args.size());
152 for (const auto &pair : args)
153 insert(pair.first, pair.second);
154 }
155 ~QCborMap();
156
157 void swap(QCborMap &other) noexcept
158 {
159 d.swap(other.d);
160 }
161
162 QCborValue toCborValue() const { return *this; }
163
164 qsizetype size() const noexcept Q_DECL_PURE_FUNCTION;
165 bool isEmpty() const { return size() == 0; }
166 void clear();
167 QList<QCborValue> keys() const;
168
170 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
172 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
174 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
176 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
177#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
178 template<size_t N> QT_ASCII_CAST_WARN const QCborValue value(const char (&key)[N]) const
179 { return value(QString::fromUtf8(key, N - 1)); }
180#endif
182 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
184 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
185 const QCborValue operator[](const QString & key) const
186 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
188 { const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }
189#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
190 template<size_t N> QT_ASCII_CAST_WARN const QCborValue operator[](const char (&key)[N]) const
191 { return operator[](QString::fromUtf8(key, N - 1)); }
192#endif
193 QCborValueRef operator[](qint64 key);
194 QCborValueRef operator[](QLatin1StringView key);
195 QCborValueRef operator[](const QString & key);
196 QCborValueRef operator[](const QCborValue &key);
197
199 { const_iterator it = constFind(key); if (it != constEnd()) return extract(it); return QCborValue(); }
201 { const_iterator it = constFind(key); if (it != constEnd()) return extract(it); return QCborValue(); }
203 { const_iterator it = constFind(key); if (it != constEnd()) return extract(it); return QCborValue(); }
205 { const_iterator it = constFind(key); if (it != constEnd()) return extract(it); return QCborValue(); }
207 { const_iterator it = constFind(key); if (it != constEnd()) erase(it); }
209 { const_iterator it = constFind(key); if (it != constEnd()) erase(it); }
210 void remove(const QString & key)
211 { const_iterator it = constFind(key); if (it != constEnd()) erase(it); }
212 void remove(const QCborValue &key)
213 { const_iterator it = constFind(key); if (it != constEnd()) erase(it); }
214 bool contains(qint64 key) const
215 { const_iterator it = find(key); return it != end(); }
217 { const_iterator it = find(key); return it != end(); }
218 bool contains(const QString & key) const
219 { const_iterator it = find(key); return it != end(); }
220 bool contains(const QCborValue &key) const
221 { const_iterator it = find(key); return it != end(); }
222
223 int compare(const QCborMap &other) const noexcept Q_DECL_PURE_FUNCTION;
224#if 0 && __has_include(<compare>)
225 std::strong_ordering operator<=>(const QCborMap &other) const
226 {
227 int c = compare(other);
228 if (c > 0) return std::strong_ordering::greater;
229 if (c == 0) return std::strong_ordering::equivalent;
230 return std::strong_ordering::less;
231 }
232#else
233 bool operator==(const QCborMap &other) const noexcept
234 { return compare(other) == 0; }
235 bool operator!=(const QCborMap &other) const noexcept
236 { return !(*this == other); }
237 bool operator<(const QCborMap &other) const
238 { return compare(other) < 0; }
239#endif
240
243 iterator begin() { detach(); return iterator{d.data(), 1}; }
244 const_iterator constBegin() const { return const_iterator{d.data(), 1}; }
245 const_iterator begin() const { return constBegin(); }
246 const_iterator cbegin() const { return constBegin(); }
247 iterator end() { detach(); return iterator{d.data(), 2 * size() + 1}; }
248 const_iterator constEnd() const { return const_iterator{d.data(), 2 * size() + 1}; }
249 const_iterator end() const { return constEnd(); }
250 const_iterator cend() const { return constEnd(); }
251 iterator erase(iterator it);
252 iterator erase(const_iterator it) { return erase(iterator{ it.item.d, it.item.i }); }
253 QCborValue extract(iterator it);
254 QCborValue extract(const_iterator it) { return extract(iterator{ it.item.d, it.item.i }); }
255 bool empty() const { return isEmpty(); }
256
257 iterator find(qint64 key);
258 iterator find(QLatin1StringView key);
259 iterator find(const QString & key);
260 iterator find(const QCborValue &key);
261 const_iterator constFind(qint64 key) const;
262 const_iterator constFind(QLatin1StringView key) const;
263 const_iterator constFind(const QString & key) const;
264 const_iterator constFind(const QCborValue &key) const;
265 const_iterator find(qint64 key) const { return constFind(key); }
266 const_iterator find(QLatin1StringView key) const { return constFind(key); }
267 const_iterator find(const QString & key) const { return constFind(key); }
268 const_iterator find(const QCborValue &key) const { return constFind(key); }
269
271 {
272 QCborValueRef v = operator[](key); // detaches
273 v = value_;
274 return { d.data(), v.i };
275 }
277 {
278 QCborValueRef v = operator[](key); // detaches
279 v = value_;
280 return { d.data(), v.i };
281 }
282 iterator insert(const QString &key, const QCborValue &value_)
283 {
284 QCborValueRef v = operator[](key); // detaches
285 v = value_;
286 return { d.data(), v.i };
287 }
288 iterator insert(const QCborValue &key, const QCborValue &value_)
289 {
290 QCborValueRef v = operator[](key); // detaches
291 v = value_;
292 return { d.data(), v.i };
293 }
294 iterator insert(value_type v) { return insert(v.first, v.second); }
295
296 static QCborMap fromVariantMap(const QVariantMap &map);
297 static QCborMap fromVariantHash(const QVariantHash &hash);
298 static QCborMap fromJsonObject(const QJsonObject &o);
299 static QCborMap fromJsonObject(QJsonObject &&o) noexcept;
300 QVariantMap toVariantMap() const;
301 QVariantHash toVariantHash() const;
302 QJsonObject toJsonObject() const;
303
304private:
306 friend class QCborValue;
307 friend class QCborValueRef;
309 void detach(qsizetype reserve = 0);
310
311 explicit QCborMap(QCborContainerPrivate &dd) noexcept;
313};
314
315Q_DECLARE_SHARED(QCborMap)
316
318 : n(-1), container(m.d.take()), t(Map)
319{
320}
321
322#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
323inline QCborMap QCborValueRef::toMap() const
324{
325 return concrete().toMap();
326}
327
328inline QCborMap QCborValueRef::toMap(const QCborMap &m) const
329{
330 return concrete().toMap(m);
331}
332#endif
333
335{
336 return concrete().toMap();
337}
338
340{
341 return concrete().toMap(m);
342}
343
344Q_CORE_EXPORT size_t qHash(const QCborMap &map, size_t seed = 0);
345
346#if !defined(QT_NO_DEBUG_STREAM)
347Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborMap &m);
348#endif
349
350#ifndef QT_NO_DATASTREAM
351#if QT_CONFIG(cborstreamwriter)
352Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QCborMap &);
353#endif
354Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QCborMap &);
355#endif
356
357
359
360#endif // QCBORMAP_H
\inmodule QtCore
Definition qcbormap.h:86
bool operator>=(const Iterator &other) const
Definition qcbormap.h:127
QCborValueConstRef key() const
Returns the current item's key.
Definition qcbormap.h:119
ConstIterator & operator++()
The prefix {++} operator, {++i}, advances the iterator to the next item in the map and returns this i...
Definition qcbormap.h:134
value_type operator[](qsizetype j) const
Definition qcbormap.h:112
bool operator==(const ConstIterator &o) const
Definition qcbormap.h:128
constexpr ConstIterator(const ConstIterator &)=default
Constructs an iterator as a copy of other.
ConstIterator operator-(qsizetype j) const
Returns an iterator to the item at j positions backward from this iterator.
Definition qcbormap.h:141
ConstIterator & operator--()
The prefix {–} operator, {–i}, makes the preceding item current and returns this iterator.
Definition qcbormap.h:136
qsizetype difference_type
Definition qcbormap.h:96
bool operator<(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs before the entry pointed to b...
Definition qcbormap.h:130
bool operator!=(const ConstIterator &o) const
Definition qcbormap.h:129
QPair< QCborValueConstRef, QCborValueConstRef > reference
Definition qcbormap.h:98
bool operator>(const Iterator &other) const
Definition qcbormap.h:126
qsizetype operator-(ConstIterator j) const
Returns the position of the item at iterator j relative to the item at this iterator.
Definition qcbormap.h:142
ConstIterator & operator-=(qsizetype j)
Makes the iterator go back by j items.
Definition qcbormap.h:139
const QCborValueConstRef * operator->() const
Returns a pointer to the current pair's value.
Definition qcbormap.h:113
QCborValueConstRef value() const
Returns the current item's value.
Definition qcbormap.h:120
constexpr ConstIterator()=default
Constructs an uninitialized iterator.
ConstIterator & operator=(const ConstIterator &other)
Makes this iterator a copy of other and returns a reference to this iterator.
Definition qcbormap.h:103
bool operator>=(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs after or is the same entry as...
Definition qcbormap.h:133
QPair< QCborValueConstRef, QCborValueConstRef > pointer
Definition qcbormap.h:99
ConstIterator operator--(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:137
std::random_access_iterator_tag iterator_category
A synonym for {std::random_access_iterator_tag} indicating this iterator is a random-access iterator.
Definition qcbormap.h:95
bool operator<=(const Iterator &other) const
Definition qcbormap.h:125
bool operator>(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs after the entry pointed to by...
Definition qcbormap.h:132
bool operator<(const Iterator &other) const
Definition qcbormap.h:124
ConstIterator operator++(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:135
QPair< QCborValueConstRef, QCborValueConstRef > value_type
Definition qcbormap.h:97
ConstIterator operator+(qsizetype j) const
Returns an iterator to the item at j positions forward from this iterator.
Definition qcbormap.h:140
bool operator!=(const Iterator &o) const
Returns true if other points to a different entry in the map than this iterator; otherwise returns fa...
Definition qcbormap.h:123
bool operator==(const Iterator &o) const
Returns true if other points to the same entry in the map as this iterator; otherwise returns false.
Definition qcbormap.h:122
value_type operator*() const
Returns a pair containing the current item's key and value.
Definition qcbormap.h:111
ConstIterator & operator+=(qsizetype j)
Advances the iterator by j items.
Definition qcbormap.h:138
bool operator<=(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs before or is the same entry a...
Definition qcbormap.h:131
\inmodule QtCore\reentrant
Definition qcbormap.h:29
Iterator operator++(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:76
std::random_access_iterator_tag iterator_category
A synonym for {std::random_access_iterator_tag} indicating this iterator is a random-access iterator.
Definition qcbormap.h:35
const QCborValueConstRef * operator->() const
Returns a pointer to a modifiable reference to the current pair's value.
Definition qcbormap.h:54
bool operator>(const Iterator &other) const
Definition qcbormap.h:67
bool operator==(const ConstIterator &o) const
Returns true if other points to the same entry in the map as this iterator; otherwise returns false.
Definition qcbormap.h:69
bool operator!=(const Iterator &o) const
Definition qcbormap.h:64
Iterator operator+(qsizetype j) const
Returns an iterator to the item at j positions forward from this iterator.
Definition qcbormap.h:81
value_type operator*() const
Returns a pair containing the current item's key and a modifiable reference to the current item's val...
Definition qcbormap.h:51
QCborValueConstRef key() const
Returns the current item's key.
Definition qcbormap.h:60
Iterator & operator=(const Iterator &other)
Makes this iterator a copy of other and returns a reference to this iterator.
Definition qcbormap.h:43
constexpr Iterator()=default
Constructs an uninitialized iterator.
bool operator>=(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs after or is the same entry as...
Definition qcbormap.h:74
bool operator<(const Iterator &other) const
Definition qcbormap.h:65
bool operator!=(const ConstIterator &o) const
Returns true if other points to a different entry in the map than this iterator; otherwise returns fa...
Definition qcbormap.h:70
Iterator & operator-=(qsizetype j)
Makes the iterator go back by j items.
Definition qcbormap.h:80
Iterator operator--(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:78
bool operator<=(const Iterator &other) const
Definition qcbormap.h:66
bool operator>(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs after the entry pointed to by...
Definition qcbormap.h:73
bool operator>=(const Iterator &other) const
Definition qcbormap.h:68
qsizetype operator-(Iterator j) const
Returns the position of the item at iterator j relative to the item at this iterator.
Definition qcbormap.h:83
Iterator operator-(qsizetype j) const
Returns an iterator to the item at j positions backward from this iterator.
Definition qcbormap.h:82
QPair< QCborValueConstRef, QCborValueRef > pointer
Definition qcbormap.h:39
value_type operator[](qsizetype j) const
Definition qcbormap.h:52
Iterator & operator++()
The prefix {++} operator, {++i}, advances the iterator to the next item in the map and returns this i...
Definition qcbormap.h:75
qsizetype difference_type
Definition qcbormap.h:36
constexpr Iterator(const Iterator &)=default
Constructs an iterator as a copy of other.
QCborValueRef * operator->()
Definition qcbormap.h:53
Iterator & operator--()
The prefix {–} operator, {–i}, makes the preceding item current and returns this iterator.
Definition qcbormap.h:77
QCborValueRef value() const
Returns a modifiable reference to the current item's value.
Definition qcbormap.h:61
Iterator & operator+=(qsizetype j)
Advances the iterator by j items.
Definition qcbormap.h:79
QPair< QCborValueConstRef, QCborValueRef > reference
Definition qcbormap.h:38
bool operator==(const Iterator &o) const
Definition qcbormap.h:63
bool operator<=(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs before or is the same entry a...
Definition qcbormap.h:72
QPair< QCborValueConstRef, QCborValueRef > value_type
Definition qcbormap.h:37
bool operator<(const ConstIterator &other) const
Returns true if the entry in the map pointed to by this iterator occurs before the entry pointed to b...
Definition qcbormap.h:71
\inmodule QtCore\reentrant
Definition qcbormap.h:21
bool operator<(const QCborMap &other) const
Compares this map and other, comparing each element in sequence, and returns true if this map should ...
Definition qcbormap.h:237
QCborValue extract(const_iterator it)
Extracts a value from the map at the position indicated by iterator it and returns the value so extra...
Definition qcbormap.h:254
QCborValue value(const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:173
iterator erase(const_iterator it)
Removes the key-value pair pointed to by the map iterator it and returns a pointer to the next elemen...
Definition qcbormap.h:252
QCborValue toCborValue() const
Explicitly constructs a \l QCborValue object that represents this map.
Definition qcbormap.h:162
const_iterator find(qint64 key) const
Returns a map iterator to the key-value pair whose key is key, if the map contains such a pair.
Definition qcbormap.h:265
bool contains(const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:218
const_iterator end() const
Returns a map iterator representing an element just past the last element in the map.
Definition qcbormap.h:249
QCborValue value(qint64 key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
Definition qcbormap.h:169
iterator insert(QLatin1StringView key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:276
bool operator==(const QCborMap &other) const noexcept
Compares this map and other, comparing each element in sequence, and returns true if the two maps con...
Definition qcbormap.h:233
bool empty() const
Synonym for isEmpty().
Definition qcbormap.h:255
const_iterator cend() const
Returns a map iterator representing an element just past the last element in the map.
Definition qcbormap.h:250
void swap(QCborMap &other) noexcept
Swaps the contents of this map and other.
Definition qcbormap.h:157
const_iterator find(const QCborValue &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:268
QCborValue take(QLatin1StringView key)
Removes the key key and the corresponding value from the map and returns the value,...
Definition qcbormap.h:200
bool operator!=(const QCborMap &other) const noexcept
Compares this map and other, comparing each element in sequence, and returns true if the two maps con...
Definition qcbormap.h:235
qsizetype size_type
The type that QCborMap uses for sizes.
Definition qcbormap.h:26
QT_ASCII_CAST_WARN const QCborValue value(const char(&key)[N]) const
Definition qcbormap.h:178
iterator end()
Returns a map iterator representing an element just past the last element in the map.
Definition qcbormap.h:247
void remove(const QCborValue &key)
Removes the key key and the corresponding value from the map, if it is found.
Definition qcbormap.h:212
void remove(const QString &key)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:210
QCborValue mapped_type
The type that is mapped to (the value), that is, a QCborValue.
Definition qcbormap.h:25
QCborValue take(qint64 key)
Removes the key key and the corresponding value from the map and returns the value,...
Definition qcbormap.h:198
const_iterator find(const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:267
iterator insert(const QCborValue &key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:288
const QCborValue operator[](const QCborValue &key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
Definition qcbormap.h:187
const QCborValue operator[](QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:183
QCborValue value(const QCborValue &key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
Definition qcbormap.h:175
QCborValue take(const QCborValue &key)
Removes the key key and the corresponding value from the map and returns the value,...
Definition qcbormap.h:204
QPair< QCborValue, QCborValue > value_type
The value that is stored in this container: a pair of QCborValues.
Definition qcbormap.h:23
const_iterator begin() const
Returns a map iterator pointing to the first key-value pair of this map.
Definition qcbormap.h:245
void remove(QLatin1StringView key)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:208
iterator insert(const QString &key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:282
ConstIterator const_iterator
A synonym for QCborMap::ConstIterator.
Definition qcbormap.h:242
const_iterator cbegin() const
Returns a map iterator pointing to the first key-value pair of this map.
Definition qcbormap.h:246
const_iterator find(QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:266
QCborValue key_type
The key type for this map.
Definition qcbormap.h:24
bool contains(qint64 key) const
Returns true if this map contains a key-value pair identified by key key.
Definition qcbormap.h:214
iterator insert(qint64 key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:270
const_iterator constBegin() const
Returns a map iterator pointing to the first key-value pair of this map.
Definition qcbormap.h:244
QT_ASCII_CAST_WARN const QCborValue operator[](const char(&key)[N]) const
Definition qcbormap.h:190
bool contains(const QCborValue &key) const
Returns true if this map contains a key-value pair identified by key key.
Definition qcbormap.h:220
bool contains(QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:216
QCborValue take(const QString &key)
Removes the key key and the corresponding value from the map and returns the value,...
Definition qcbormap.h:202
const QCborValue operator[](const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:185
iterator begin()
Returns a map iterator pointing to the first key-value pair of this map.
Definition qcbormap.h:243
const QCborValue operator[](qint64 key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
Definition qcbormap.h:181
QCborValue value(QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:171
const_iterator constEnd() const
Returns a map iterator representing an element just past the last element in the map.
Definition qcbormap.h:248
iterator insert(value_type v)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcbormap.h:294
Iterator iterator
A synonym for QCborMap::Iterator.
Definition qcbormap.h:241
void remove(qint64 key)
Removes the key key and the corresponding value from the map, if it is found.
Definition qcbormap.h:206
QCborMap toMap() const
Definition qcbormap.h:334
QCborValue concrete() const noexcept
Definition qcborvalue.h:408
\inmodule QtCore\reentrant
Definition qcborvalue.h:50
QCborMap toMap() const
\inmodule QtCore\reentrant
Definition qdatastream.h:30
\inmodule QtCore
\inmodule QtCore\reentrant
Definition qjsonobject.h:20
Definition qlist.h:74
qsizetype size() const noexcept
Definition qlist.h:386
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5857
QHash< int, QWidget * > hash
[35multi]
QMap< QString, QString > map
[6]
b clear()
cache insert(employee->id(), employee)
QSet< QString >::iterator it
set reserve(20000)
Combined button and popup list for selecting options.
qsizetype erase(QByteArray &ba, const T &t)
Definition qbytearray.h:695
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QCborMap &)
Q_CORE_EXPORT size_t qHash(const QCborMap &map, size_t seed=0)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborMap &m)
#define Q_DECL_PURE_FUNCTION
std::pair< T1, T2 > QPair
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
const GLfloat * m
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLuint end
GLfloat n
const GLubyte * c
GLdouble GLdouble t
Definition qopenglext.h:243
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QT_ASCII_CAST_WARN
static int compare(quint64 a, quint64 b)
ptrdiff_t qsizetype
Definition qtypes.h:70
long long qint64
Definition qtypes.h:55
QStringList keys
QSharedPointer< T > other(t)
[5]
QGraphicsItem * item
QJSValueList args