![]() |
CopperSpice API
1.9.2
|
The QJsonArray class encapsulates a JSON array. More...
Public Typedefs | |
using | const_iterator = QVector< QJsonValue >::const_iterator |
using | const_pointer = const QJsonValue * |
using | const_reference = QJsonValue |
using | difference_type = QVector< QJsonValue >::difference_type |
using | iterator = QVector< QJsonValue >::iterator |
using | pointer = QJsonValue * |
using | reference = QJsonValue & |
using | size_type = QVector< QJsonValue >::size_type |
Public Methods | |
QJsonArray () | |
QJsonArray (const QJsonArray &other) | |
QJsonArray (const_iterator iter_begin, const_iterator iter_end) | |
QJsonArray (QJsonArray &&other) | |
QJsonArray (std::initializer_list< QJsonValue > args) | |
~QJsonArray () | |
void | append (QJsonValue value) |
const QJsonValue & | at (size_type index) const |
iterator | begin () |
const_iterator | begin () const |
const_iterator | constBegin () const |
const_iterator | constEnd () const |
bool | contains (const QJsonValue &value) const |
size_type | count () const |
bool | empty () const |
iterator | end () |
const_iterator | end () const |
iterator | erase (const_iterator iter) |
const QJsonValue & | first () const |
iterator | insert (iterator before, QJsonValue value) |
void | insert (size_type index, QJsonValue value) |
bool | isEmpty () const |
const QJsonValue & | last () const |
bool | operator!= (const QJsonArray &other) const |
QJsonArray | operator+ (QJsonValue value) const |
QJsonArray & | operator+= (QJsonValue value) |
QJsonArray & | operator<< (const QJsonValue value) |
QJsonArray & | operator= (const QJsonArray &other) |
bool | operator== (const QJsonArray &other) const |
QJsonValue & | operator[] (size_type index) |
const QJsonValue & | operator[] (size_type index) const |
void | pop_back () |
void | pop_front () |
void | prepend (QJsonValue value) |
void | push_back (const QJsonValue &value) |
void | push_front (const QJsonValue &value) |
void | removeAt (size_type index) |
void | removeFirst () |
void | removeLast () |
void | replace (size_type index, QJsonValue value) |
size_type | size () const |
QJsonValue | takeAt (size_type index) |
QList< QVariant > | toVariantList () const |
Static Public Methods | |
static QJsonArray | fromStringList (const QStringList &list) |
static QJsonArray | fromVariantList (const QList< QVariant > &list) |
Friends | |
class | QJsonValue |
The QJsonArray class encapsulates a JSON array. A JSON array is a list of values. The list can be manipulated by inserting and removing QJsonValue's from the array. A QJsonArray can be converted to and from a QVariantList. You can query the number of entries with size(), insert(), and remove() entries from it and iterate over its content using the standard C++ iterator pattern.
You can convert the array to and from text based JSON through QJsonDocument.
Equivalent to QVector<QJsonValue>::const_iterator.
Equivalent to const QJsonValue *.
Equivalent to const QJsonValue &.
Equivalent to int.
Equivalent to QVector<QJsonValue>::iterator.
Equivalent to QJsonValue *.
Equivalent to QJsonValue &.
Equivalent to int.
QJsonArray::QJsonArray | ( | ) |
Creates an empty array.
QJsonArray::QJsonArray | ( | const_iterator | iter_begin, |
const_iterator | iter_end | ||
) |
Constructs a QJsonArray using an iterator range.
QJsonArray::QJsonArray | ( | const QJsonArray & | other | ) |
Copy constructs a new QJsonArray from other.
QJsonArray::QJsonArray | ( | QJsonArray && | other | ) |
Move constructs a new QJsonArray from other.
QJsonArray::QJsonArray | ( | std::initializer_list< QJsonValue > | args | ) |
Creates an array initialized from the args initialization list.
QJsonArray::~QJsonArray | ( | ) |
Deletes the array.
void QJsonArray::append | ( | QJsonValue | value | ) |
const QJsonValue & QJsonArray::at | ( | size_type | index | ) | const |
Returns a QJsonValue representing the value for index. The returned QJsonValue is Undefined
, if index is out of bounds.
iterator QJsonArray::begin | ( | ) |
Returns an STL-style iterator pointing to the first item in the array.
const_iterator QJsonArray::begin | ( | ) | const |
Returns a const STL-style iterator pointing to the first item in the array.
const_iterator QJsonArray::constBegin | ( | ) | const |
Returns a const STL-style iterator pointing to the first item in the array.
const_iterator QJsonArray::constEnd | ( | ) | const |
Returns a const STL-style iterator pointing to the imaginary item after the last item in the array.
bool QJsonArray::contains | ( | const QJsonValue & | value | ) | const |
Returns true if the array contains an occurrence of value, otherwisefalse.
|
inline |
Returns true if the array is empty. Equivalent to calling isEmpty().
iterator QJsonArray::end | ( | ) |
Returns an STL-style iterator pointing to the imaginary item after the last item in the array.
const_iterator QJsonArray::end | ( | ) | const |
Returns a const STL-style iterator pointing to the imaginary item after the last item in the array.
iterator QJsonArray::erase | ( | const_iterator | iter | ) |
Removes the item pointed to by iter, and returns an iterator pointing to the next item.
const QJsonValue & QJsonArray::first | ( | ) | const |
Returns the first value stored in the array. Equivalent to calling at(0).
|
static |
Converts the string list to a QJsonArray. The values in list will be converted to JSON values.
Converts the variant list to a QJsonArray. The QVariant values in list will be converted to JSON values.
iterator QJsonArray::insert | ( | iterator | before, |
QJsonValue | value | ||
) |
void QJsonArray::insert | ( | size_type | index, |
QJsonValue | value | ||
) |
Inserts value at index position index in the array. If the index is zero the value is prepended to the array. If the index is equal to size(), the value is appended to the array.
bool QJsonArray::isEmpty | ( | ) | const |
const QJsonValue & QJsonArray::last | ( | ) | const |
bool QJsonArray::operator!= | ( | const QJsonArray & | other | ) | const |
Returns true if this array is not equal to other.
|
inline |
Returns an array that contains all the items in this array followed by the provided value.
QJsonArray & QJsonArray::operator+= | ( | QJsonValue | value | ) |
Appends value to the array and returns a reference to the array.
QJsonArray & QJsonArray::operator<< | ( | const QJsonValue | value | ) |
Appends value to the array and returns a reference to the array.
QJsonArray & QJsonArray::operator= | ( | const QJsonArray & | other | ) |
Copy assigns from other and returns a reference to this object.
bool QJsonArray::operator== | ( | const QJsonArray & | other | ) | const |
Returns true
if this array is equal to other.
QJsonValue & QJsonArray::operator[] | ( | size_type | index | ) |
Returns the value at index position index as a reference. Index must be a valid index position in the array.
const QJsonValue & QJsonArray::operator[] | ( | size_type | index | ) | const |
Equivalent to calling at().
|
inline |
The array must not be empty. If the array can be empty, call isEmpty() before calling this method. Equivalent to calling removeLast().
|
inline |
The array must not be empty. If the array can be empty, call isEmpty() before calling this method. Equivalent to calling removeFirst().
void QJsonArray::prepend | ( | QJsonValue | value | ) |
|
inline |
Equivalent to calling append(value).
|
inline |
Equivalent to calling prepend(value).
void QJsonArray::removeAt | ( | size_type | index | ) |
|
inline |
Removes the first item in the array. The array must not be empty. If the array can be empty, call isEmpty() before calling this method. Equivalent to calling removeAt(0).
|
inline |
Removes the last item in the array. The array must not be empty. If the array can be empty, call isEmpty() before calling this method. Equivalent to calling removeAt(size()-1).
void QJsonArray::replace | ( | size_type | index, |
QJsonValue | value | ||
) |
Replaces the item at index position index with value. The index must be a valid index position in the array.
size_type QJsonArray::size | ( | ) | const |
Returns the number of values stored in the array.
QJsonValue QJsonArray::takeAt | ( | size_type | index | ) |
Removes the item at index position index and returns it. The index must be a valid index position in the array. If you do not use the return value, calling removeAt() is more efficient.
Converts this object to a QVariantList. Returns the created map.