8#include <QtCore/qjsonvalue.h>
9#include <QtCore/qiterator.h>
10#include <QtCore/qshareddata.h>
11#include <initializer_list>
23 QJsonArray(std::initializer_list<QJsonValue> args);
27 QJsonArray(
const QJsonArray &other)
noexcept;
28 QJsonArray &operator =(
const QJsonArray &other)
noexcept;
30 QJsonArray(QJsonArray &&other)
noexcept;
32 QJsonArray &operator =(QJsonArray &&other)
noexcept
38 static QJsonArray fromStringList(
const QStringList &list);
39 static QJsonArray fromVariantList(
const QVariantList &list);
40 QVariantList toVariantList()
const;
42 qsizetype size()
const;
43 inline qsizetype count()
const {
return size(); }
46 QJsonValue at(qsizetype i)
const;
47 QJsonValue first()
const;
48 QJsonValue last()
const;
50 void prepend(
const QJsonValue &value);
51 void append(
const QJsonValue &value);
52 void removeAt(qsizetype i);
53 QJsonValue takeAt(qsizetype i);
54 inline void removeFirst() { removeAt(0); }
55 inline void removeLast() { removeAt(size() - 1); }
57 void insert(qsizetype i,
const QJsonValue &value);
58 void replace(qsizetype i,
const QJsonValue &value);
60 bool contains(
const QJsonValue &element)
const;
61 QJsonValueRef operator[](qsizetype i);
62 QJsonValue operator[](qsizetype i)
const;
64#if QT_CORE_REMOVED_SINCE(6
, 8
)
65 bool operator==(
const QJsonArray &other)
const;
66 bool operator!=(
const QJsonArray &other)
const;
68 void swap(QJsonArray &other)
noexcept
77 typedef std::random_access_iterator_tag iterator_category;
78 typedef qsizetype difference_type;
79 typedef QJsonValue value_type;
80 typedef QJsonValueRef reference;
81 typedef QJsonValueRef *pointer;
83 inline iterator() : item(
static_cast<QJsonArray *>(
nullptr), 0) { }
84 explicit inline iterator(QJsonArray *array, qsizetype index) : item(array, index) { }
86 constexpr iterator(
const iterator &other) =
default;
87 iterator &operator=(
const iterator &other)
89 item.rebind(other.item);
93 inline QJsonValueRef operator*()
const {
return item; }
94 inline const QJsonValueConstRef *operator->()
const {
return &item; }
95 inline QJsonValueRef *operator->() {
return &item; }
96 inline QJsonValueRef operator[](qsizetype j)
const {
return *(*
this + j); }
98#if QT_CORE_REMOVED_SINCE(6
, 8
)
99 inline bool operator==(
const iterator &o)
const
100 {
return item.d == o.item.d && item.index == o.item.index; }
101 inline bool operator!=(
const iterator &o)
const {
return !operator==(o); }
102 inline bool operator<(
const iterator &other)
const
103 { Q_ASSERT(item.d == other.item.d);
return item.index < other.item.index; }
104 inline bool operator<=(
const iterator &other)
const
105 { Q_ASSERT(item.d == other.item.d);
return item.index <= other.item.index; }
106 inline bool operator>(
const iterator &other)
const {
return !operator<=(other); }
107 inline bool operator>=(
const iterator &other)
const {
return !operator<(other); }
108 inline bool operator==(
const const_iterator &o)
const
109 {
return item.d == o.item.d && item.index == o.item.index; }
110 inline bool operator!=(
const const_iterator &o)
const {
return !operator==(o); }
111 inline bool operator<(
const const_iterator &other)
const
112 { Q_ASSERT(item.d == other.item.d);
return item.index < other.item.index; }
113 inline bool operator<=(
const const_iterator &other)
const
114 { Q_ASSERT(item.d == other.item.d);
return item.index <= other.item.index; }
115 inline bool operator>(
const const_iterator &other)
const {
return !operator<=(other); }
116 inline bool operator>=(
const const_iterator &other)
const {
return !operator<(other); }
118 inline iterator &operator++() { ++item.index;
return *
this; }
119 inline iterator operator++(
int) { iterator n = *
this; ++item.index;
return n; }
120 inline iterator &operator--() { item.index--;
return *
this; }
121 inline iterator operator--(
int) { iterator n = *
this; item.index--;
return n; }
122 inline iterator &operator+=(qsizetype j) { item.index += quint64(j);
return *
this; }
123 inline iterator &operator-=(qsizetype j) { item.index -= quint64(j);
return *
this; }
124 inline iterator operator+(qsizetype j)
const { iterator r = *
this;
return r += j; }
125 inline iterator operator-(qsizetype j)
const {
return operator+(-j); }
126 inline qsizetype operator-(iterator j)
const {
return item.index - j.item.index; }
130 static bool comparesEqual_helper(
const iterator &lhs,
const iterator &rhs)
noexcept
132 return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index;
135 static bool comparesEqual_helper(
const iterator &lhs,
const const_iterator &rhs)
noexcept
137 return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index;
140 static Qt::strong_ordering compareThreeWay_helper(
const iterator &lhs,
143 Q_ASSERT(lhs.item.d == rhs.item.d);
144 return Qt::compareThreeWay(lhs.item.index, rhs.item.index);
147 static Qt::strong_ordering compareThreeWay_helper(
const iterator &lhs,
148 const const_iterator &rhs)
150 Q_ASSERT(lhs.item.d == rhs.item.d);
151 return Qt::compareThreeWay(lhs.item.index, rhs.item.index);
155 friend bool comparesEqual(
const iterator &lhs,
const iterator &rhs)
noexcept
157 return comparesEqual_helper(lhs, rhs);
159 friend Qt::strong_ordering compareThreeWay(
const iterator &lhs,
162 return compareThreeWay_helper(lhs, rhs);
164 Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator)
165 friend bool comparesEqual(
const iterator &lhs,
const const_iterator &rhs)
noexcept
167 return comparesEqual_helper(lhs, rhs);
169 friend Qt::strong_ordering compareThreeWay(
const iterator &lhs,
170 const const_iterator &rhs)
172 return compareThreeWay_helper(lhs, rhs);
174 Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator, const_iterator)
177 friend class QJsonArray;
179 friend class iterator;
181 class const_iterator {
183 typedef std::random_access_iterator_tag iterator_category;
184 typedef qptrdiff difference_type;
185 typedef QJsonValue value_type;
186 typedef const QJsonValueRef reference;
187 typedef const QJsonValueRef *pointer;
189 inline const_iterator() : item(
static_cast<QJsonArray *>(
nullptr), 0) { }
190 explicit inline const_iterator(
const QJsonArray *array, qsizetype index)
191 : item(
const_cast<QJsonArray *>(array), index) { }
192 inline const_iterator(
const iterator &o) : item(o.item) { }
194 constexpr const_iterator(
const const_iterator &other) =
default;
195 const_iterator &operator=(
const const_iterator &other)
197 item.rebind(other.item);
201 inline const QJsonValueConstRef operator*()
const {
return item; }
202 inline const QJsonValueConstRef *operator->()
const {
return &item; }
204 inline QJsonValueConstRef operator[](qsizetype j)
const {
return *(*
this + j); }
205#if QT_CORE_REMOVED_SINCE(6
, 8
)
206 inline bool operator==(
const const_iterator &o)
const
207 {
return item.d == o.item.d && item.index == o.item.index; }
208 inline bool operator!=(
const const_iterator &o)
const {
return !operator==(o); }
209 inline bool operator<(
const const_iterator &other)
const
210 { Q_ASSERT(item.d == other.item.d);
return item.index < other.item.index; }
211 inline bool operator<=(
const const_iterator &other)
const
212 { Q_ASSERT(item.d == other.item.d);
return item.index <= other.item.index; }
213 inline bool operator>(
const const_iterator &other)
const {
return !operator<=(other); }
214 inline bool operator>=(
const const_iterator &other)
const {
return !operator<(other); }
216 inline const_iterator &operator++() { ++item.index;
return *
this; }
217 inline const_iterator operator++(
int) { const_iterator n = *
this; ++item.index;
return n; }
218 inline const_iterator &operator--() { item.index--;
return *
this; }
219 inline const_iterator operator--(
int) { const_iterator n = *
this; item.index--;
return n; }
220 inline const_iterator &operator+=(qsizetype j) { item.index += quint64(j);
return *
this; }
221 inline const_iterator &operator-=(qsizetype j) { item.index -= quint64(j);
return *
this; }
222 inline const_iterator operator+(qsizetype j)
const { const_iterator r = *
this;
return r += j; }
223 inline const_iterator operator-(qsizetype j)
const {
return operator+(-j); }
224 inline qsizetype operator-(const_iterator j)
const {
return item.index - j.item.index; }
228 static bool comparesEqual_helper(
const const_iterator &lhs,
229 const const_iterator &rhs)
noexcept
231 return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index;
233 static Qt::strong_ordering compareThreeWay_helper(
const const_iterator &lhs,
234 const const_iterator &rhs)
236 Q_ASSERT(lhs.item.d == rhs.item.d);
237 return Qt::compareThreeWay(lhs.item.index, rhs.item.index);
241 friend bool comparesEqual(
const const_iterator &lhs,
const const_iterator &rhs)
noexcept
243 return comparesEqual_helper(lhs, rhs);
245 friend Qt::strong_ordering compareThreeWay(
const const_iterator &lhs,
246 const const_iterator &rhs)
248 return compareThreeWay_helper(lhs, rhs);
250 Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(const_iterator)
251 QJsonValueConstRef item;
252 friend class QJsonArray;
254 friend class const_iterator;
257 inline iterator begin() { detach();
return iterator(
this, 0); }
258 inline const_iterator begin()
const {
return const_iterator(
this, 0); }
259 inline const_iterator constBegin()
const {
return const_iterator(
this, 0); }
260 inline const_iterator cbegin()
const {
return const_iterator(
this, 0); }
261 inline iterator end() { detach();
return iterator(
this, size()); }
262 inline const_iterator end()
const {
return const_iterator(
this, size()); }
263 inline const_iterator constEnd()
const {
return const_iterator(
this, size()); }
264 inline const_iterator cend()
const {
return const_iterator(
this, size()); }
265 iterator insert(iterator before,
const QJsonValue &value)
266 { insert(before.item.index, value);
return before; }
267 iterator erase(iterator it)
268 { removeAt(it.item.index);
return it; }
271 typedef iterator Iterator;
272 typedef const_iterator ConstIterator;
275 inline QJsonArray operator+(
const QJsonValue &v)
const
276 { QJsonArray n = *
this; n += v;
return n; }
277 inline QJsonArray &operator+=(
const QJsonValue &v)
278 { append(v);
return *
this; }
279 inline QJsonArray &operator<< (
const QJsonValue &v)
280 { append(v);
return *
this; }
283 inline void push_back(
const QJsonValue &t) { append(t); }
284 inline void push_front(
const QJsonValue &t) { prepend(t); }
285 inline void pop_front() { removeFirst(); }
286 inline void pop_back() { removeLast(); }
287 inline bool empty()
const {
return isEmpty(); }
288 typedef qsizetype size_type;
289 typedef QJsonValue value_type;
290 typedef value_type *pointer;
291 typedef const value_type *const_pointer;
292 typedef QJsonValueRef reference;
293 typedef QJsonValue const_reference;
294 typedef qsizetype difference_type;
297 friend class QJsonValue;
298 friend class QJsonValueConstRef;
299 friend class QJsonValueRef;
300 friend class QJsonPrivate::Value;
301 friend class QJsonDocument;
302 friend class QCborArray;
303 friend Q_CORE_EXPORT QDebug operator<<(QDebug,
const QJsonArray &);
305 friend Q_CORE_EXPORT
bool comparesEqual(
const QJsonArray &lhs,
306 const QJsonArray &rhs);
308 friend Q_CORE_EXPORT
bool comparesEqual(
const QJsonArray &lhs,
309 const QJsonValue &rhs);
310 Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonArray)
311 Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonArray, QJsonValue)
313 QJsonArray(QCborContainerPrivate *array);
314 bool detach(qsizetype reserve = 0);
316 QExplicitlySharedDataPointer<QCborContainerPrivate> a;
321#if QT_VERSION >= QT_VERSION_CHECK(7
, 0
, 0
) || defined(QT_BOOTSTRAPPED)
322inline QJsonValueConstRef::QJsonValueConstRef(QJsonArray *a, qsizetype idx)
323 : d(a ? a->a.data() :
nullptr), is_object(
false), index(idx)
327Q_CORE_EXPORT size_t qHash(
const QJsonArray &array, size_t seed = 0);
329#if !defined(QT_NO_DEBUG_STREAM)
330Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QJsonArray &);
333#ifndef QT_NO_DATASTREAM
334Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QJsonArray &);
335Q_CORE_EXPORT
QDataStream &operator>>(QDataStream &, QJsonArray &);
The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QCborArray toArray(const QCborArray &a) const
QCborMap toMap(const QCborMap &m) const
QVariant toVariant() const
QCborValueConstRef & operator=(const QCborValueConstRef &)=delete
QCborArray toArray() const
bool toBool(bool defaultValue=false) const
QCborValue taggedValue(const QCborValue &defaultValue=QCborValue()) const
QCborSimpleType toSimpleType(QCborSimpleType defaultValue=QCborSimpleType::Undefined) const
bool isSimpleType() const
bool isRegularExpression() const
QCborValue::Type type() const
QCborValueConstRef(const QCborValueConstRef &)=default
QCborTag tag(QCborTag defaultValue=QCborTag(-1)) const
constexpr QCborValueConstRef()
QByteArray toByteArray(const QByteArray &defaultValue={}) const
qint64 toInteger(qint64 defaultValue=0) const
bool isSimpleType(QCborSimpleType st) const
QUuid toUuid(const QUuid &defaultValue={}) const
QCborContainerPrivate * d
QAnyStringView toStringView(QAnyStringView defaultValue={}) const
friend bool comparesEqual(const QCborValueConstRef &lhs, const QCborValueConstRef &rhs) noexcept
friend bool comparesEqual(const QCborValueConstRef &lhs, const QCborValue &rhs) noexcept
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt=QCborValue::Compact) const
int compare(const QCborValue &other) const
friend Qt::strong_ordering compareThreeWay(const QCborValueConstRef &lhs, const QCborValue &rhs) noexcept
operator QCborValue() const
friend Qt::strong_ordering compareThreeWay(const QCborValueConstRef &lhs, const QCborValueConstRef &rhs) noexcept
constexpr QCborValueConstRef(QCborContainerPrivate *dd, qsizetype ii)
QCborValue concrete() const noexcept
QString toString(const QString &defaultValue={}) const
QUrl toUrl(const QUrl &defaultValue={}) const
QJsonValue toJsonValue() const
double toDouble(double defaultValue=0) const
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QSequentialIterable class is an iterable interface for a container in a QVariant.
\keyword 16-bit Floating Point Support\inmodule QtCore \inheaderfile QFloat16
QMutableListIterator< QByteArray > QMutableByteArrayListIterator
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QList< QVariant > QVariantList
#define qCWarning(category,...)
#define Q_STATIC_LOGGING_CATEGORY(name,...)
#define QStringLiteral(str)
\inmodule QtCore\reentrant
QString errorString() const
\variable QCborParserError::offset
~QListSpecialMethods()=default
QListSpecialMethods & operator=(const QListSpecialMethods &)=default
QListSpecialMethods(QListSpecialMethods &&)=default
QListSpecialMethods & operator=(QListSpecialMethods &&)=default
QListSpecialMethods()=default
QListSpecialMethods(const QListSpecialMethods &)=default
QByteArray join(QByteArrayView sep={}) const
static T value(const Iterator &it)
static T value(Iterator &it)
static QCborValueConstRef key(Iterator &it)
static QCborValueConstRef key(const Iterator &it)