7#include <QtCore/qjsonvalue.h>
8#include <QtCore/qiterator.h>
9#include <QtCore/qshareddata.h>
10#include <initializer_list>
22 QJsonArray(std::initializer_list<QJsonValue> args);
26 QJsonArray(
const QJsonArray &other)
noexcept;
27 QJsonArray &operator =(
const QJsonArray &other)
noexcept;
29 QJsonArray(QJsonArray &&other)
noexcept;
31 QJsonArray &operator =(QJsonArray &&other)
noexcept
37 static QJsonArray fromStringList(
const QStringList &list);
38 static QJsonArray fromVariantList(
const QVariantList &list);
39 QVariantList toVariantList()
const;
41 qsizetype size()
const;
42 inline qsizetype count()
const {
return size(); }
45 QJsonValue at(qsizetype i)
const;
46 QJsonValue first()
const;
47 QJsonValue last()
const;
49 void prepend(
const QJsonValue &value);
50 void append(
const QJsonValue &value);
51 void removeAt(qsizetype i);
52 QJsonValue takeAt(qsizetype i);
53 inline void removeFirst() { removeAt(0); }
54 inline void removeLast() { removeAt(size() - 1); }
56 void insert(qsizetype i,
const QJsonValue &value);
57 void replace(qsizetype i,
const QJsonValue &value);
59 bool contains(
const QJsonValue &element)
const;
60 QJsonValueRef operator[](qsizetype i);
61 QJsonValue operator[](qsizetype i)
const;
63#if QT_CORE_REMOVED_SINCE(6
, 8
)
64 bool operator==(
const QJsonArray &other)
const;
65 bool operator!=(
const QJsonArray &other)
const;
67 void swap(QJsonArray &other)
noexcept
76 typedef std::random_access_iterator_tag iterator_category;
77 typedef qsizetype difference_type;
78 typedef QJsonValue value_type;
79 typedef QJsonValueRef reference;
80 typedef QJsonValueRef *pointer;
82 inline iterator() : item(
static_cast<QJsonArray *>(
nullptr), 0) { }
83 explicit inline iterator(QJsonArray *array, qsizetype index) : item(array, index) { }
85 constexpr iterator(
const iterator &other) =
default;
86 iterator &operator=(
const iterator &other)
88 item.rebind(other.item);
92 inline QJsonValueRef operator*()
const {
return item; }
93 inline const QJsonValueConstRef *operator->()
const {
return &item; }
94 inline QJsonValueRef *operator->() {
return &item; }
95 inline QJsonValueRef operator[](qsizetype j)
const {
return *(*
this + j); }
97#if QT_CORE_REMOVED_SINCE(6
, 8
)
98 inline bool operator==(
const iterator &o)
const
99 {
return item.d == o.item.d && item.index == o.item.index; }
100 inline bool operator!=(
const iterator &o)
const {
return !operator==(o); }
101 inline bool operator<(
const iterator &other)
const
102 { Q_ASSERT(item.d == other.item.d);
return item.index < other.item.index; }
103 inline bool operator<=(
const iterator &other)
const
104 { Q_ASSERT(item.d == other.item.d);
return item.index <= other.item.index; }
105 inline bool operator>(
const iterator &other)
const {
return !operator<=(other); }
106 inline bool operator>=(
const iterator &other)
const {
return !operator<(other); }
107 inline bool operator==(
const const_iterator &o)
const
108 {
return item.d == o.item.d && item.index == o.item.index; }
109 inline bool operator!=(
const const_iterator &o)
const {
return !operator==(o); }
110 inline bool operator<(
const const_iterator &other)
const
111 { Q_ASSERT(item.d == other.item.d);
return item.index < other.item.index; }
112 inline bool operator<=(
const const_iterator &other)
const
113 { Q_ASSERT(item.d == other.item.d);
return item.index <= other.item.index; }
114 inline bool operator>(
const const_iterator &other)
const {
return !operator<=(other); }
115 inline bool operator>=(
const const_iterator &other)
const {
return !operator<(other); }
117 inline iterator &operator++() { ++item.index;
return *
this; }
118 inline iterator operator++(
int) { iterator n = *
this; ++item.index;
return n; }
119 inline iterator &operator--() { item.index--;
return *
this; }
120 inline iterator operator--(
int) { iterator n = *
this; item.index--;
return n; }
121 inline iterator &operator+=(qsizetype j) { item.index += quint64(j);
return *
this; }
122 inline iterator &operator-=(qsizetype j) { item.index -= quint64(j);
return *
this; }
123 inline iterator operator+(qsizetype j)
const { iterator r = *
this;
return r += j; }
124 inline iterator operator-(qsizetype j)
const {
return operator+(-j); }
125 inline qsizetype operator-(iterator j)
const {
return item.index - j.item.index; }
129 static bool comparesEqual_helper(
const iterator &lhs,
const iterator &rhs)
noexcept
131 return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index;
134 static bool comparesEqual_helper(
const iterator &lhs,
const const_iterator &rhs)
noexcept
136 return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index;
139 static Qt::strong_ordering compareThreeWay_helper(
const iterator &lhs,
142 Q_ASSERT(lhs.item.d == rhs.item.d);
143 return Qt::compareThreeWay(lhs.item.index, rhs.item.index);
146 static Qt::strong_ordering compareThreeWay_helper(
const iterator &lhs,
147 const const_iterator &rhs)
149 Q_ASSERT(lhs.item.d == rhs.item.d);
150 return Qt::compareThreeWay(lhs.item.index, rhs.item.index);
154 friend bool comparesEqual(
const iterator &lhs,
const iterator &rhs)
noexcept
156 return comparesEqual_helper(lhs, rhs);
158 friend Qt::strong_ordering compareThreeWay(
const iterator &lhs,
161 return compareThreeWay_helper(lhs, rhs);
163 Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator)
164 friend bool comparesEqual(
const iterator &lhs,
const const_iterator &rhs)
noexcept
166 return comparesEqual_helper(lhs, rhs);
168 friend Qt::strong_ordering compareThreeWay(
const iterator &lhs,
169 const const_iterator &rhs)
171 return compareThreeWay_helper(lhs, rhs);
173 Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator, const_iterator)
176 friend class QJsonArray;
178 friend class iterator;
180 class const_iterator {
182 typedef std::random_access_iterator_tag iterator_category;
183 typedef qptrdiff difference_type;
184 typedef QJsonValue value_type;
185 typedef const QJsonValueRef reference;
186 typedef const QJsonValueRef *pointer;
188 inline const_iterator() : item(
static_cast<QJsonArray *>(
nullptr), 0) { }
189 explicit inline const_iterator(
const QJsonArray *array, qsizetype index)
190 : item(
const_cast<QJsonArray *>(array), index) { }
191 inline const_iterator(
const iterator &o) : item(o.item) { }
193 constexpr const_iterator(
const const_iterator &other) =
default;
194 const_iterator &operator=(
const const_iterator &other)
196 item.rebind(other.item);
200 inline const QJsonValueConstRef operator*()
const {
return item; }
201 inline const QJsonValueConstRef *operator->()
const {
return &item; }
203 inline QJsonValueConstRef operator[](qsizetype j)
const {
return *(*
this + j); }
204#if QT_CORE_REMOVED_SINCE(6
, 8
)
205 inline bool operator==(
const const_iterator &o)
const
206 {
return item.d == o.item.d && item.index == o.item.index; }
207 inline bool operator!=(
const const_iterator &o)
const {
return !operator==(o); }
208 inline bool operator<(
const const_iterator &other)
const
209 { Q_ASSERT(item.d == other.item.d);
return item.index < other.item.index; }
210 inline bool operator<=(
const const_iterator &other)
const
211 { Q_ASSERT(item.d == other.item.d);
return item.index <= other.item.index; }
212 inline bool operator>(
const const_iterator &other)
const {
return !operator<=(other); }
213 inline bool operator>=(
const const_iterator &other)
const {
return !operator<(other); }
215 inline const_iterator &operator++() { ++item.index;
return *
this; }
216 inline const_iterator operator++(
int) { const_iterator n = *
this; ++item.index;
return n; }
217 inline const_iterator &operator--() { item.index--;
return *
this; }
218 inline const_iterator operator--(
int) { const_iterator n = *
this; item.index--;
return n; }
219 inline const_iterator &operator+=(qsizetype j) { item.index += quint64(j);
return *
this; }
220 inline const_iterator &operator-=(qsizetype j) { item.index -= quint64(j);
return *
this; }
221 inline const_iterator operator+(qsizetype j)
const { const_iterator r = *
this;
return r += j; }
222 inline const_iterator operator-(qsizetype j)
const {
return operator+(-j); }
223 inline qsizetype operator-(const_iterator j)
const {
return item.index - j.item.index; }
227 static bool comparesEqual_helper(
const const_iterator &lhs,
228 const const_iterator &rhs)
noexcept
230 return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index;
232 static Qt::strong_ordering compareThreeWay_helper(
const const_iterator &lhs,
233 const const_iterator &rhs)
235 Q_ASSERT(lhs.item.d == rhs.item.d);
236 return Qt::compareThreeWay(lhs.item.index, rhs.item.index);
240 friend bool comparesEqual(
const const_iterator &lhs,
const const_iterator &rhs)
noexcept
242 return comparesEqual_helper(lhs, rhs);
244 friend Qt::strong_ordering compareThreeWay(
const const_iterator &lhs,
245 const const_iterator &rhs)
247 return compareThreeWay_helper(lhs, rhs);
249 Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(const_iterator)
250 QJsonValueConstRef item;
251 friend class QJsonArray;
253 friend class const_iterator;
256 inline iterator begin() { detach();
return iterator(
this, 0); }
257 inline const_iterator begin()
const {
return const_iterator(
this, 0); }
258 inline const_iterator constBegin()
const {
return const_iterator(
this, 0); }
259 inline const_iterator cbegin()
const {
return const_iterator(
this, 0); }
260 inline iterator end() { detach();
return iterator(
this, size()); }
261 inline const_iterator end()
const {
return const_iterator(
this, size()); }
262 inline const_iterator constEnd()
const {
return const_iterator(
this, size()); }
263 inline const_iterator cend()
const {
return const_iterator(
this, size()); }
264 iterator insert(iterator before,
const QJsonValue &value)
265 { insert(before.item.index, value);
return before; }
266 iterator erase(iterator it)
267 { removeAt(it.item.index);
return it; }
270 typedef iterator Iterator;
271 typedef const_iterator ConstIterator;
274 inline QJsonArray operator+(
const QJsonValue &v)
const
275 { QJsonArray n = *
this; n += v;
return n; }
276 inline QJsonArray &operator+=(
const QJsonValue &v)
277 { append(v);
return *
this; }
278 inline QJsonArray &operator<< (
const QJsonValue &v)
279 { append(v);
return *
this; }
282 inline void push_back(
const QJsonValue &t) { append(t); }
283 inline void push_front(
const QJsonValue &t) { prepend(t); }
284 inline void pop_front() { removeFirst(); }
285 inline void pop_back() { removeLast(); }
286 inline bool empty()
const {
return isEmpty(); }
287 typedef qsizetype size_type;
288 typedef QJsonValue value_type;
289 typedef value_type *pointer;
290 typedef const value_type *const_pointer;
291 typedef QJsonValueRef reference;
292 typedef QJsonValue const_reference;
293 typedef qsizetype difference_type;
296 friend class QJsonValue;
297 friend class QJsonValueConstRef;
298 friend class QJsonValueRef;
299 friend class QJsonPrivate::Value;
300 friend class QJsonDocument;
301 friend class QCborArray;
302 friend Q_CORE_EXPORT QDebug operator<<(QDebug,
const QJsonArray &);
304 friend Q_CORE_EXPORT
bool comparesEqual(
const QJsonArray &lhs,
305 const QJsonArray &rhs);
307 friend Q_CORE_EXPORT
bool comparesEqual(
const QJsonArray &lhs,
308 const QJsonValue &rhs);
309 Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonArray)
310 Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonArray, QJsonValue)
312 QJsonArray(QCborContainerPrivate *array);
313 bool detach(qsizetype reserve = 0);
315 QExplicitlySharedDataPointer<QCborContainerPrivate> a;
320#if QT_VERSION >= QT_VERSION_CHECK(7
, 0
, 0
) || defined(QT_BOOTSTRAPPED)
321inline QJsonValueConstRef::QJsonValueConstRef(QJsonArray *a, qsizetype idx)
322 : d(a ? a->a.data() :
nullptr), is_object(
false), index(idx)
326Q_CORE_EXPORT size_t qHash(
const QJsonArray &array, size_t seed = 0);
328#if !defined(QT_NO_DEBUG_STREAM)
329Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QJsonArray &);
332#ifndef QT_NO_DATASTREAM
333Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QJsonArray &);
334Q_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
static Q_CORE_EXPORT double concreteDouble(QCborValueConstRef that, double defaultValue) noexcept Q_DECL_PURE_FUNCTION
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
static Q_CORE_EXPORT bool concreteBoolean(QCborValueConstRef that, bool defaultValue) noexcept Q_DECL_PURE_FUNCTION
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.
Combined button and popup list for selecting options.
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,...)
\inmodule QtCore\reentrant
QString errorString() const
\variable QCborParserError::offset