Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcborarray.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 QCBORARRAY_H
5#define QCBORARRAY_H
6
7#include <QtCore/qcborvalue.h>
8
9#include <initializer_list>
10
12
13class QJsonArray;
14class QDataStream;
15
16namespace QJsonPrivate { class Variant; }
17
19class Q_CORE_EXPORT QCborArray
20{
21public:
22 class ConstIterator;
23 class Iterator {
24 QCborValueRef item {};
25 friend class ConstIterator;
26 friend class QCborArray;
27 Iterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {}
28 public:
29 typedef std::random_access_iterator_tag iterator_category;
32 typedef QCborValueRef reference;
33 typedef QCborValueRef *pointer;
34
35 constexpr Iterator() = default;
36 constexpr Iterator(const Iterator &) = default;
38 {
39 // rebind the reference
40 item.d = other.item.d;
41 item.i = other.item.i;
42 return *this;
43 }
44
45 QCborValueRef operator*() const { return item; }
46 QCborValueRef *operator->() { return &item; }
47 const QCborValueConstRef *operator->() const { return &item; }
48 QCborValueRef operator[](qsizetype j) const { return { item.d, item.i + j }; }
49#if QT_CORE_REMOVED_SINCE(6, 8)
50 bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
51 bool operator!=(const Iterator &o) const { return !operator==(o); }
52 bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
53 bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
54 bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
55 bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
56 bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
57 bool operator!=(const ConstIterator &o) const { return !operator==(o); }
58 bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
59 bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
60 bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
61 bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
62#endif
63 Iterator &operator++() { ++item.i; return *this; }
64 Iterator operator++(int) { Iterator n = *this; ++item.i; return n; }
65 Iterator &operator--() { item.i--; return *this; }
66 Iterator operator--(int) { Iterator n = *this; item.i--; return n; }
67 Iterator &operator+=(qsizetype j) { item.i += j; return *this; }
68 Iterator &operator-=(qsizetype j) { item.i -= j; return *this; }
69 Iterator operator+(qsizetype j) const { return Iterator({ item.d, item.i + j }); }
70 Iterator operator-(qsizetype j) const { return Iterator({ item.d, item.i - j }); }
71 qsizetype operator-(Iterator j) const { return item.i - j.item.i; }
72 private:
73 // Helper functions
74 static bool comparesEqual_helper(const Iterator &lhs, const Iterator &rhs) noexcept
75 {
76 return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i;
77 }
78
79 static bool comparesEqual_helper(const Iterator &lhs, const ConstIterator &rhs) noexcept
80 {
81 return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i;
82 }
83
84 static Qt::strong_ordering compareThreeWay_helper(const Iterator &lhs,
85 const Iterator &rhs) noexcept
86 {
87 Q_ASSERT(lhs.item.d == rhs.item.d);
88 return Qt::compareThreeWay(lhs.item.i, rhs.item.i);
89 }
90
91 static Qt::strong_ordering compareThreeWay_helper(const Iterator &lhs,
92 const ConstIterator &rhs) noexcept
93 {
94 Q_ASSERT(lhs.item.d == rhs.item.d);
95 return Qt::compareThreeWay(lhs.item.i, rhs.item.i);
96 }
97
98 // Compare friends
99 friend bool comparesEqual(const Iterator &lhs, const Iterator &rhs) noexcept
100 {
101 return comparesEqual_helper(lhs, rhs);
102 }
104 const Iterator &rhs) noexcept
105 {
106 return compareThreeWay_helper(lhs, rhs);
107 }
109 friend bool comparesEqual(const Iterator &lhs, const ConstIterator &rhs) noexcept
110 {
111 return comparesEqual_helper(lhs, rhs);
112 }
114 const ConstIterator &rhs) noexcept
115 {
116 return compareThreeWay_helper(lhs, rhs);
117 }
119 };
120
123 friend class Iterator;
124 friend class QCborArray;
126 public:
127 typedef std::random_access_iterator_tag iterator_category;
129 typedef const QCborValue value_type;
130 typedef const QCborValueRef reference;
131 typedef const QCborValueRef *pointer;
132
133 constexpr ConstIterator() = default;
134 constexpr ConstIterator(const ConstIterator &) = default;
136 {
137 // rebind the reference
138 item.d = other.item.d;
139 item.i = other.item.i;
140 return *this;
141 }
142
144 const QCborValueConstRef *operator->() const { return &item; }
145 QCborValueConstRef operator[](qsizetype j) const { return QCborValueRef{ item.d, item.i + j }; }
146#if QT_CORE_REMOVED_SINCE(6, 8)
147 bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
148 bool operator!=(const Iterator &o) const { return !operator==(o); }
149 bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
150 bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
151 bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
152 bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
153 bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; }
154 bool operator!=(const ConstIterator &o) const { return !operator==(o); }
155 bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; }
156 bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; }
157 bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; }
158 bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; }
159#endif
160 ConstIterator &operator++() { ++item.i; return *this; }
161 ConstIterator operator++(int) { ConstIterator n = *this; ++item.i; return n; }
162 ConstIterator &operator--() { item.i--; return *this; }
163 ConstIterator operator--(int) { ConstIterator n = *this; item.i--; return n; }
164 ConstIterator &operator+=(qsizetype j) { item.i += j; return *this; }
165 ConstIterator &operator-=(qsizetype j) { item.i -= j; return *this; }
166 ConstIterator operator+(qsizetype j) const { return ConstIterator({ item.d, item.i + j }); }
167 ConstIterator operator-(qsizetype j) const { return ConstIterator({ item.d, item.i - j }); }
168 qsizetype operator-(ConstIterator j) const { return item.i - j.item.i; }
169 private:
170 // Helper functions
171 static bool comparesEqual_helper(const ConstIterator &lhs,
172 const ConstIterator &rhs) noexcept
173 {
174 return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i;
175 }
176 static Qt::strong_ordering compareThreeWay_helper(const ConstIterator &lhs,
177 const ConstIterator &rhs) noexcept
178 {
179 Q_ASSERT(lhs.item.d == rhs.item.d);
180 return Qt::compareThreeWay(lhs.item.i, rhs.item.i);
181 }
182
183 // Compare friends
184 friend bool comparesEqual(const ConstIterator &lhs, const ConstIterator &rhs) noexcept
185 {
186 return comparesEqual_helper(lhs, rhs);
187 }
189 const ConstIterator &rhs) noexcept
190 {
191 return compareThreeWay_helper(lhs, rhs);
192 }
194 };
195
199 typedef const value_type *const_pointer;
203
204 QCborArray() noexcept;
205 QCborArray(const QCborArray &other) noexcept;
206 QCborArray &operator=(const QCborArray &other) noexcept;
207 QCborArray(std::initializer_list<QCborValue> args)
208 : QCborArray()
209 {
210 detach(qsizetype(args.size()));
211 for (const QCborValue &v : args)
212 append(v);
213 }
214 ~QCborArray();
215
216 void swap(QCborArray &other) noexcept
217 {
218 d.swap(other.d);
219 }
220
221 QCborValue toCborValue() const { return *this; }
222
223 qsizetype size() const noexcept;
224 bool isEmpty() const { return size() == 0; }
225 void clear();
226
227 QCborValue at(qsizetype i) const;
228 QCborValue first() const { return at(0); }
229 QCborValue last() const { return at(size() - 1); }
230 const QCborValue operator[](qsizetype i) const { return at(i); }
231 QCborValueRef first() { Q_ASSERT(!isEmpty()); return begin()[0]; }
232 QCborValueRef last() { Q_ASSERT(!isEmpty()); return begin()[size() - 1]; }
233 QCborValueRef operator[](qsizetype i)
234 {
235 if (i >= size())
236 insert(i, QCborValue());
237 return begin()[i];
238 }
239
240 void insert(qsizetype i, const QCborValue &value);
242 void prepend(const QCborValue &value) { insert(0, value); }
243 void prepend(QCborValue &&value) { insert(0, std::move(value)); }
244 void append(const QCborValue &value) { insert(-1, value); }
245 void append(QCborValue &&value) { insert(-1, std::move(value)); }
246 QCborValue extract(ConstIterator it) { return extract(Iterator{ it.item.d, it.item.i }); }
247 QCborValue extract(Iterator it);
248 void removeAt(qsizetype i);
249 QCborValue takeAt(qsizetype i) { Q_ASSERT(i < size()); return extract(begin() + i); }
250 void removeFirst() { removeAt(0); }
251 void removeLast() { removeAt(size() - 1); }
252 QCborValue takeFirst() { return takeAt(0); }
253 QCborValue takeLast() { return takeAt(size() - 1); }
254
255 bool contains(const QCborValue &value) const;
256
257 int compare(const QCborArray &other) const noexcept Q_DECL_PURE_FUNCTION;
258#if QT_CORE_REMOVED_SINCE(6, 8)
259 bool operator==(const QCborArray &other) const noexcept
260 { return compare(other) == 0; }
261 bool operator!=(const QCborArray &other) const noexcept
262 { return !operator==(other); }
263 bool operator<(const QCborArray &other) const
264 { return compare(other) < 0; }
265#endif
266
269 iterator begin() { detach(); return iterator{d.data(), 0}; }
270 const_iterator constBegin() const { return const_iterator{d.data(), 0}; }
271 const_iterator begin() const { return constBegin(); }
272 const_iterator cbegin() const { return constBegin(); }
273 iterator end() { detach(); return iterator{d.data(), size()}; }
274 const_iterator constEnd() const { return const_iterator{d.data(), size()}; }
275 const_iterator end() const { return constEnd(); }
276 const_iterator cend() const { return constEnd(); }
278 { insert(before.item.i, value); return iterator{d.data(), before.item.i}; }
280 { insert(before.item.i, value); return iterator{d.data(), before.item.i}; }
281 iterator erase(iterator it) { removeAt(it.item.i); return iterator{d.data(), it.item.i}; }
282 iterator erase(const_iterator it) { removeAt(it.item.i); return iterator{d.data(), it.item.i}; }
283
284 void push_back(const QCborValue &t) { append(t); }
285 void push_front(const QCborValue &t) { prepend(t); }
286 void pop_front() { removeFirst(); }
287 void pop_back() { removeLast(); }
288 bool empty() const { return isEmpty(); }
289
290 // convenience
292 { QCborArray n = *this; n += v; return n; }
294 { append(v); return *this; }
296 { append(v); return *this; }
297
298 static QCborArray fromStringList(const QStringList &list);
299 static QCborArray fromVariantList(const QVariantList &list);
300 static QCborArray fromJsonArray(const QJsonArray &array);
301 static QCborArray fromJsonArray(QJsonArray &&array) noexcept;
302 QVariantList toVariantList() const;
303 QJsonArray toJsonArray() const;
304
305private:
306 friend Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool
307 comparesEqual(const QCborArray &lhs, const QCborArray &rhs) noexcept;
309 const QCborArray &rhs) noexcept
310 {
311 int c = lhs.compare(rhs);
312 return Qt::compareThreeWay(c, 0);
313 }
315
316 static Q_DECL_PURE_FUNCTION bool
317 comparesEqual_helper(const QCborArray &lhs, const QCborValue &rhs) noexcept;
319 compareThreeWay_helper(const QCborArray &lhs, const QCborValue &rhs) noexcept;
320 friend bool comparesEqual(const QCborArray &lhs,
321 const QCborValue &rhs) noexcept
322 {
323 return comparesEqual_helper(lhs, rhs);
324 }
326 const QCborValue &rhs) noexcept
327 {
328 return compareThreeWay_helper(lhs, rhs);
329 }
331
332 static Q_DECL_PURE_FUNCTION bool
333 comparesEqual_helper(const QCborArray &lhs, QCborValueConstRef rhs) noexcept;
335 compareThreeWay_helper(const QCborArray &lhs, QCborValueConstRef rhs) noexcept;
336 friend bool comparesEqual(const QCborArray &lhs,
337 const QCborValueConstRef &rhs) noexcept
338 {
339 return comparesEqual_helper(lhs, rhs);
340 }
342 const QCborValueConstRef &rhs) noexcept
343 {
344 return compareThreeWay_helper(lhs, rhs);
345 }
347
348 void detach(qsizetype reserve = 0);
349
350 friend QCborValue;
351 friend QCborValueRef;
353 explicit QCborArray(QCborContainerPrivate &dd) noexcept;
354 QExplicitlySharedDataPointer<QCborContainerPrivate> d;
355};
356
357Q_DECLARE_SHARED(QCborArray)
358
360 : n(-1), container(a.d.take()), t(Array)
361{
362}
363
364#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
365inline QCborArray QCborValueRef::toArray() const
366{
367 return concrete().toArray();
368}
369
370inline QCborArray QCborValueRef::toArray(const QCborArray &a) const
371{
372 return concrete().toArray(a);
373}
374#endif
375
377{
378 return concrete().toArray();
379}
380
382{
383 return concrete().toArray(a);
384}
385
386Q_CORE_EXPORT size_t qHash(const QCborArray &array, size_t seed = 0);
387
388#if !defined(QT_NO_DEBUG_STREAM)
389Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborArray &a);
390#endif
391
392#ifndef QT_NO_DATASTREAM
393#if QT_CONFIG(cborstreamwriter)
394Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QCborArray &);
395#endif
396Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QCborArray &);
397#endif
398
400
401#endif // QCBORARRAY_H
const QCborValueRef reference
Definition qcborarray.h:130
ConstIterator & operator-=(qsizetype j)
Makes the iterator go back by j positions.
Definition qcborarray.h:165
QCborValueConstRef operator*() const
Returns the current item.
Definition qcborarray.h:143
qsizetype operator-(ConstIterator j) const
Returns the offset of this iterator relative to other.
Definition qcborarray.h:168
ConstIterator operator--(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcborarray.h:163
friend bool comparesEqual(const ConstIterator &lhs, const ConstIterator &rhs) noexcept
Definition qcborarray.h:184
constexpr ConstIterator()=default
Constructs an uninitialized iterator.
ConstIterator & operator+=(qsizetype j)
Advances the iterator by j positions.
Definition qcborarray.h:164
constexpr ConstIterator(const ConstIterator &)=default
Constructs a copy of other.
const QCborValueRef * pointer
Definition qcborarray.h:131
ConstIterator operator+(qsizetype j) const
Returns an iterator to the item at a position j steps forward from this iterator.
Definition qcborarray.h:166
ConstIterator & operator--()
The prefix {–} operator, {–it}, makes the preceding item current and returns this iterator.
Definition qcborarray.h:162
std::random_access_iterator_tag iterator_category
A synonym for {std::random_access_iterator_tag} indicating this iterator is a random access iterator.
Definition qcborarray.h:127
const QCborValueConstRef * operator->() const
Returns a pointer to the current item.
Definition qcborarray.h:144
ConstIterator & operator=(const ConstIterator &other)
Makes this iterator a copy of other and returns a reference to this iterator.
Definition qcborarray.h:135
QCborValueConstRef operator[](qsizetype j) const
Returns the item at a position j steps forward from the item pointed to by this iterator.
Definition qcborarray.h:145
friend Qt::strong_ordering compareThreeWay(const ConstIterator &lhs, const ConstIterator &rhs) noexcept
Definition qcborarray.h:188
const QCborValue value_type
Definition qcborarray.h:129
ConstIterator operator++(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcborarray.h:161
ConstIterator & operator++()
The prefix {++} operator, {++it}, advances the iterator to the next item in the array and returns thi...
Definition qcborarray.h:160
ConstIterator operator-(qsizetype j) const
Returns an iterator to the item at a position j steps backward from this iterator.
Definition qcborarray.h:167
\inmodule QtCore
Definition qcborarray.h:23
qsizetype operator-(Iterator j) const
Returns the offset of this iterator relative to other.
Definition qcborarray.h:71
friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, const Iterator &rhs) noexcept
Definition qcborarray.h:103
constexpr Iterator()=default
Constructs an uninitialized iterator.
QCborValueRef operator[](qsizetype j) const
Returns a modifiable reference to the item at a position j steps forward from the item pointed to by ...
Definition qcborarray.h:48
Iterator operator-(qsizetype j) const
Returns an iterator to the item at position j steps backward from this iterator.
Definition qcborarray.h:70
Iterator operator--(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcborarray.h:66
QCborValue value_type
Definition qcborarray.h:31
Iterator & operator=(const Iterator &other)
Makes this iterator a copy of other and returns a reference to this iterator.
Definition qcborarray.h:37
friend bool comparesEqual(const Iterator &lhs, const Iterator &rhs) noexcept
Definition qcborarray.h:99
Iterator & operator++()
The prefix {++} operator, {++it}, advances the iterator to the next item in the array and returns thi...
Definition qcborarray.h:63
Iterator operator++(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcborarray.h:64
QCborValueRef operator*() const
Returns a modifiable reference to the current item.
Definition qcborarray.h:45
constexpr Iterator(const Iterator &)=default
Makes a copy of other.
Iterator & operator--()
The prefix {–} operator, {–it}, makes the preceding item current and returns this iterator.
Definition qcborarray.h:65
Iterator & operator+=(qsizetype j)
Advances the iterator by j positions.
Definition qcborarray.h:67
qsizetype difference_type
Definition qcborarray.h:30
Iterator operator+(qsizetype j) const
Returns an iterator to the item at position j steps forward from this iterator.
Definition qcborarray.h:69
QCborValueRef reference
Definition qcborarray.h:32
std::random_access_iterator_tag iterator_category
A synonym for {std::random_access_iterator_tag} indicating this iterator is a random access iterator.
Definition qcborarray.h:29
QCborValueRef * operator->()
Definition qcborarray.h:46
QCborValueRef * pointer
Definition qcborarray.h:33
Iterator & operator-=(qsizetype j)
Makes the iterator go back by j positions.
Definition qcborarray.h:68
const QCborValueConstRef * operator->() const
Returns a pointer to a modifiable reference to the current item.
Definition qcborarray.h:47
friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, const ConstIterator &rhs) noexcept
Definition qcborarray.h:113
\inmodule QtCore\reentrant
Definition qcborarray.h:20
QCborValue & reference
A typedef to {QCborValue &}, for compatibility with generic algorithms.
Definition qcborarray.h:200
QCborValue takeLast()
Removes the last item in the array and returns it.
Definition qcborarray.h:253
const_iterator constEnd() const
Returns an array iterator pointing to just after the last element in this array.
Definition qcborarray.h:274
const_iterator constBegin() const
Returns an array iterator pointing to the first item in this array.
Definition qcborarray.h:270
QCborValue takeAt(qsizetype i)
Removes the item at position i from the array and returns it.
Definition qcborarray.h:249
QCborValue takeFirst()
Removes the first item in the array and returns it, making the second element become the first.
Definition qcborarray.h:252
void append(QCborValue &&value)
Appends value into the array after all other elements it may already contain.
Definition qcborarray.h:245
friend Qt::strong_ordering compareThreeWay(const QCborArray &lhs, const QCborArray &rhs) noexcept
Definition qcborarray.h:308
iterator begin()
Returns an array iterator pointing to the first item in this array.
Definition qcborarray.h:269
const value_type * const_pointer
A typedef to {const QCborValue *}, for compatibility with generic algorithms.
Definition qcborarray.h:199
void pop_front()
Synonym for removeFirst().
Definition qcborarray.h:286
const_iterator begin() const
Returns an array iterator pointing to the first item in this array.
Definition qcborarray.h:271
void append(const QCborValue &value)
Definition qcborarray.h:244
ConstIterator const_iterator
A synonym to QCborArray::ConstIterator.
Definition qcborarray.h:268
friend bool comparesEqual(const QCborArray &lhs, const QCborValue &rhs) noexcept
Definition qcborarray.h:320
const_iterator end() const
Returns an array iterator pointing to just after the last element in this array.
Definition qcborarray.h:275
void push_back(const QCborValue &t)
Synonym for append().
Definition qcborarray.h:284
QCborValue toCborValue() const
Explicitly construcuts a \l QCborValue object that represents this array.
Definition qcborarray.h:221
Iterator iterator
A synonym to QCborArray::Iterator.
Definition qcborarray.h:267
friend bool comparesEqual(const QCborArray &lhs, const QCborValueConstRef &rhs) noexcept
Definition qcborarray.h:336
void removeLast()
Removes the last item in the array.
Definition qcborarray.h:251
iterator insert(const_iterator before, const QCborValue &value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcborarray.h:279
value_type * pointer
A typedef to {QCborValue *}, for compatibility with generic algorithms.
Definition qcborarray.h:198
QCborValue first() const
Returns the first QCborValue of this array.
Definition qcborarray.h:228
const_iterator cend() const
Returns an array iterator pointing to just after the last element in this array.
Definition qcborarray.h:276
void push_front(const QCborValue &t)
Synonym for prepend().
Definition qcborarray.h:285
const QCborValue & const_reference
A typedef to {const QCborValue &}, for compatibility with generic algorithms.
Definition qcborarray.h:201
QCborArray & operator+=(const QCborValue &v)
Appends v to this array and returns a reference to this array.
Definition qcborarray.h:293
QCborValueRef last()
Returns a reference to the last QCborValue of this array.
Definition qcborarray.h:232
void prepend(QCborValue &&value)
Prepends value into the array before any other elements it may already contain.
Definition qcborarray.h:243
friend Qt::strong_ordering compareThreeWay(const QCborArray &lhs, const QCborValueConstRef &rhs) noexcept
Definition qcborarray.h:341
friend Qt::strong_ordering compareThreeWay(const QCborArray &lhs, const QCborValue &rhs) noexcept
Definition qcborarray.h:325
QCborValue last() const
Returns the last QCborValue of this array.
Definition qcborarray.h:229
iterator erase(iterator it)
Definition qcborarray.h:281
void removeFirst()
Removes the first item in the array, making the second element become the first.
Definition qcborarray.h:250
qsizetype difference_type
A typedef to qsizetype.
Definition qcborarray.h:202
void swap(QCborArray &other) noexcept
Swaps the contents of this object and other.
Definition qcborarray.h:216
QCborValue extract(ConstIterator it)
Extracts a value from the array at the position indicated by iterator it and returns the value so ext...
Definition qcborarray.h:246
bool empty() const
Synonym for isEmpty().
Definition qcborarray.h:288
QCborValue value_type
The type of values that can be held in a QCborArray: that is, QCborValue.
Definition qcborarray.h:197
iterator insert(iterator before, const QCborValue &value)
Definition qcborarray.h:277
const_iterator cbegin() const
Returns an array iterator pointing to the first item in this array.
Definition qcborarray.h:272
QCborArray operator+(const QCborValue &v) const
Returns a new QCborArray containing the same elements as this array, plus v appended as the last elem...
Definition qcborarray.h:291
qsizetype size_type
A typedef to qsizetype.
Definition qcborarray.h:196
iterator erase(const_iterator it)
Removes the element pointed to by the array iterator it from this array, then returns an iterator to ...
Definition qcborarray.h:282
void pop_back()
Synonym for removeLast().
Definition qcborarray.h:287
QCborValueRef operator[](qsizetype i)
Returns a reference to the QCborValue element at position i in the array.
Definition qcborarray.h:233
QCborValueRef first()
Returns a reference to the first QCborValue of this array.
Definition qcborarray.h:231
const QCborValue operator[](qsizetype i) const
Returns the QCborValue element at position i in the array.
Definition qcborarray.h:230
QCborArray & operator<<(const QCborValue &v)
Appends v to this array and returns a reference to this array.
Definition qcborarray.h:295
void prepend(const QCborValue &value)
Definition qcborarray.h:242
iterator end()
Returns an array iterator pointing to just after the last element in this array.
Definition qcborarray.h:273
QCborArray toArray() const
Definition qcborarray.h:376
QCborValue concrete() const noexcept
Definition qcborvalue.h:394
\inmodule QtCore\reentrant
Definition qcborvalue.h:47
QCborArray toArray() const
\inmodule QtCore\reentrant
Definition qdatastream.h:46
\inmodule QtCore
\inmodule QtCore\reentrant
Definition qjsonarray.h:18
qsizetype size() const noexcept
Definition qlist.h:397
\inmodule QtCore
\inmodule QtCore \title Classes and helpers for defining comparison operators \keyword qtcompare
Definition qcompare.h:400
b clear()
list append(new Employee("Blackpool", "Stephen"))
cache insert(employee->id(), employee)
QSet< QString >::iterator it
set reserve(20000)
Combined button and popup list for selecting options.
constexpr Qt::strong_ordering compareThreeWay(LeftInt lhs, RightInt rhs) noexcept
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QCborArray &)
Q_CORE_EXPORT size_t qHash(const QCborArray &array, size_t seed=0)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborArray &a)
#define Q_DECLARE_STRONGLY_ORDERED(...)
#define Q_DECL_PURE_FUNCTION
constexpr bool operator!=(const timespec &t1, const timespec &t2)
bool comparesEqual(const QDir &lhs, const QDir &rhs)
Definition qdir.cpp:1819
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static bool contains(const QJsonArray &haystack, unsigned needle)
Definition qopengl.cpp:116
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLfloat n
const GLubyte * c
GLenum array
GLdouble GLdouble t
Definition qopenglext.h:243
bool operator>(const QPoint &a, const QPoint &b)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
static int compare(quint64 a, quint64 b)
ptrdiff_t qsizetype
Definition qtypes.h:165
bool operator<=(const QUuid &lhs, const QUuid &rhs) noexcept
Definition quuid.h:294
bool operator>=(const QUuid &lhs, const QUuid &rhs) noexcept
Definition quuid.h:296
QList< int > list
[14]
QCborValue(QCborTag(2), QByteArray("\x01\0\0\0\0\0\0\0\0", 9))
[0]
list prepend("one")
QSharedPointer< T > other(t)
[5]
QGraphicsItem * item
QAction * at
QJSValueList args