[][src]Struct qt_core::QJsonArray

#[repr(C)]pub struct QJsonArray { /* fields omitted */ }

The QJsonArray class encapsulates a JSON array.

C++ class: QJsonArray.

C++ documentation:

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 removeAt() entries from it and iterate over its content using the standard C++ iterator pattern.

QJsonArray is an implicitly shared class and shares the data with the document it has been created from as long as it is not being modified.

You can convert the array to and from text based JSON through QJsonDocument.

Methods

impl QJsonArray[src]

pub unsafe fn add_assign(
    &self,
    v: impl CastInto<Ref<QJsonValue>>
) -> Ref<QJsonArray>
[src]

Appends value to the array, and returns a reference to the array itself.

Calls C++ function: QJsonArray& QJsonArray::operator+=(const QJsonValue& v).

C++ documentation:

Appends value to the array, and returns a reference to the array itself.

This function was introduced in Qt 5.3.

See also append() and operator<<().

pub unsafe fn append(&self, value: impl CastInto<Ref<QJsonValue>>)[src]

Inserts value at the end of the array.

Calls C++ function: void QJsonArray::append(const QJsonValue& value).

C++ documentation:

Inserts value at the end of the array.

See also prepend() and insert().

pub unsafe fn at(&self, i: c_int) -> CppBox<QJsonValue>[src]

Returns a QJsonValue representing the value for index i.

Calls C++ function: QJsonValue QJsonArray::at(int i) const.

C++ documentation:

Returns a QJsonValue representing the value for index i.

The returned QJsonValue is Undefined, if i is out of bounds.

pub unsafe fn begin_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the first item in the array.

Calls C++ function: QJsonArray::iterator QJsonArray::begin().

C++ documentation:

Returns an STL-style iterator pointing to the first item in the array.

See also constBegin() and end().

pub unsafe fn begin(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QJsonArray::const_iterator QJsonArray::begin() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn cbegin(&self) -> CppBox<ConstIterator>[src]

This is supported on cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a const STL-style iterator pointing to the first item in the array.

Calls C++ function: QJsonArray::const_iterator QJsonArray::cbegin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first item in the array.

See also begin() and cend().

pub unsafe fn cend(&self) -> CppBox<ConstIterator>[src]

This is supported on cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a const STL-style iterator pointing to the imaginary item after the last item in the array.

Calls C++ function: QJsonArray::const_iterator QJsonArray::cend() const.

C++ documentation:

Returns a const STL-style iterator pointing to the imaginary item after the last item in the array.

See also cbegin() and end().

pub unsafe fn const_begin(&self) -> CppBox<ConstIterator>[src]

Returns a const STL-style iterator pointing to the first item in the array.

Calls C++ function: QJsonArray::const_iterator QJsonArray::constBegin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first item in the array.

See also begin() and constEnd().

pub unsafe fn const_end(&self) -> CppBox<ConstIterator>[src]

Returns a const STL-style iterator pointing to the imaginary item after the last item in the array.

Calls C++ function: QJsonArray::const_iterator QJsonArray::constEnd() const.

C++ documentation:

Returns a const STL-style iterator pointing to the imaginary item after the last item in the array.

See also constBegin() and end().

pub unsafe fn contains(&self, element: impl CastInto<Ref<QJsonValue>>) -> bool[src]

Returns true if the array contains an occurrence of value, otherwise false.

Calls C++ function: bool QJsonArray::contains(const QJsonValue& element) const.

C++ documentation:

Returns true if the array contains an occurrence of value, otherwise false.

See also count().

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QJsonArray>>
) -> Ref<QJsonArray>
[src]

Assigns other to this array.

Calls C++ function: QJsonArray& QJsonArray::operator=(const QJsonArray& other).

C++ documentation:

Assigns other to this array.

pub unsafe fn count(&self) -> c_int[src]

Same as size().

Calls C++ function: int QJsonArray::count() const.

C++ documentation:

Same as size().

See also size().

pub unsafe fn empty(&self) -> bool[src]

This function is provided for STL compatibility. It is equivalent to isEmpty() and returns true if the array is empty.

Calls C++ function: bool QJsonArray::empty() const.

C++ documentation:

This function is provided for STL compatibility. It is equivalent to isEmpty() and returns true if the array is empty.

pub unsafe fn end_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the imaginary item after the last item in the array.

Calls C++ function: QJsonArray::iterator QJsonArray::end().

C++ documentation:

Returns an STL-style iterator pointing to the imaginary item after the last item in the array.

See also begin() and constEnd().

pub unsafe fn end(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QJsonArray::const_iterator QJsonArray::end() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn erase(&self, it: impl CastInto<Ref<Iterator>>) -> CppBox<Iterator>[src]

Removes the item pointed to by it, and returns an iterator pointing to the next item.

Calls C++ function: QJsonArray::iterator QJsonArray::erase(QJsonArray::iterator it).

C++ documentation:

Removes the item pointed to by it, and returns an iterator pointing to the next item.

See also removeAt().

pub unsafe fn first(&self) -> CppBox<QJsonValue>[src]

Returns the first value stored in the array.

Calls C++ function: QJsonValue QJsonArray::first() const.

C++ documentation:

Returns the first value stored in the array.

Same as at(0).

See also at().

pub unsafe fn from_string_list(
    list: impl CastInto<Ref<QStringList>>
) -> CppBox<QJsonArray>
[src]

Converts the string list list to a QJsonArray.

Calls C++ function: static QJsonArray QJsonArray::fromStringList(const QStringList& list).

C++ documentation:

Converts the string list list to a QJsonArray.

The values in list will be converted to JSON values.

See also toVariantList() and QJsonValue::fromVariant().

pub unsafe fn from_variant_list(
    list: impl CastInto<Ref<QListOfQVariant>>
) -> CppBox<QJsonArray>
[src]

Converts the variant list list to a QJsonArray.

Calls C++ function: static QJsonArray QJsonArray::fromVariantList(const QList<QVariant>& list).

C++ documentation:

Converts the variant list list to a QJsonArray.

The QVariant values in list will be converted to JSON values.

See also toVariantList() and QJsonValue::fromVariant().

pub unsafe fn index_mut(&self, i: c_int) -> CppBox<QJsonValueRef>[src]

Returns the value at index position i as a modifiable reference. i must be a valid index position in the array (i.e., 0 <= i < size()).

Calls C++ function: QJsonValueRef QJsonArray::operator[](int i).

C++ documentation:

Returns the value at index position i as a modifiable reference. i must be a valid index position in the array (i.e., 0 <= i < size()).

The return value is of type QJsonValueRef, a helper class for QJsonArray and QJsonObject. When you get an object of type QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the character in the QJsonArray of QJsonObject from which you got the reference.

See also at().

pub unsafe fn index(&self, i: c_int) -> CppBox<QJsonValue>[src]

This is an overloaded function.

Calls C++ function: QJsonValue QJsonArray::operator[](int i) const.

C++ documentation:

This is an overloaded function.

Same as at().

pub unsafe fn insert_int_q_json_value(
    &self,
    i: c_int,
    value: impl CastInto<Ref<QJsonValue>>
)
[src]

Inserts value at index position i in the array. If i is 0, the value is prepended to the array. If i is size(), the value is appended to the array.

Calls C++ function: void QJsonArray::insert(int i, const QJsonValue& value).

C++ documentation:

Inserts value at index position i in the array. If i is 0, the value is prepended to the array. If i is size(), the value is appended to the array.

See also append(), prepend(), replace(), and removeAt().

pub unsafe fn insert_iterator_q_json_value(
    &self,
    before: impl CastInto<Ref<Iterator>>,
    value: impl CastInto<Ref<QJsonValue>>
) -> CppBox<Iterator>
[src]

Inserts value before the position pointed to by before, and returns an iterator pointing to the newly inserted item.

Calls C++ function: QJsonArray::iterator QJsonArray::insert(QJsonArray::iterator before, const QJsonValue& value).

C++ documentation:

Inserts value before the position pointed to by before, and returns an iterator pointing to the newly inserted item.

See also erase() and insert().

pub unsafe fn is_empty(&self) -> bool[src]

Returns true if the object is empty. This is the same as size() == 0.

Calls C++ function: bool QJsonArray::isEmpty() const.

C++ documentation:

Returns true if the object is empty. This is the same as size() == 0.

See also size().

pub unsafe fn last(&self) -> CppBox<QJsonValue>[src]

Returns the last value stored in the array.

Calls C++ function: QJsonValue QJsonArray::last() const.

C++ documentation:

Returns the last value stored in the array.

Same as at(size() - 1).

See also at().

pub unsafe fn new() -> CppBox<QJsonArray>[src]

Creates an empty array.

Calls C++ function: [constructor] void QJsonArray::QJsonArray().

C++ documentation:

Creates an empty array.

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QJsonArray>>
) -> CppBox<QJsonArray>
[src]

Creates a copy of other.

Calls C++ function: [constructor] void QJsonArray::QJsonArray(const QJsonArray& other).

C++ documentation:

Creates a copy of other.

Since QJsonArray is implicitly shared, the copy is shallow as long as the object doesn't get modified.

pub unsafe fn pop_back(&self)[src]

This function is provided for STL compatibility. It is equivalent to removeLast(). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

Calls C++ function: void QJsonArray::pop_back().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to removeLast(). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

pub unsafe fn pop_front(&self)[src]

This function is provided for STL compatibility. It is equivalent to removeFirst(). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

Calls C++ function: void QJsonArray::pop_front().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to removeFirst(). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

pub unsafe fn prepend(&self, value: impl CastInto<Ref<QJsonValue>>)[src]

Inserts value at the beginning of the array.

Calls C++ function: void QJsonArray::prepend(const QJsonValue& value).

C++ documentation:

Inserts value at the beginning of the array.

This is the same as insert(0, value) and will prepend value to the array.

See also append() and insert().

pub unsafe fn push_back(&self, t: impl CastInto<Ref<QJsonValue>>)[src]

This function is provided for STL compatibility. It is equivalent to append(value) and will append value to the array.

Calls C++ function: void QJsonArray::push_back(const QJsonValue& t).

C++ documentation:

This function is provided for STL compatibility. It is equivalent to append(value) and will append value to the array.

pub unsafe fn push_front(&self, t: impl CastInto<Ref<QJsonValue>>)[src]

This function is provided for STL compatibility. It is equivalent to prepend(value) and will prepend value to the array.

Calls C++ function: void QJsonArray::push_front(const QJsonValue& t).

C++ documentation:

This function is provided for STL compatibility. It is equivalent to prepend(value) and will prepend value to the array.

pub unsafe fn remove_at(&self, i: c_int)[src]

Removes the value at index position i. i must be a valid index position in the array (i.e., 0 <= i < size()).

Calls C++ function: void QJsonArray::removeAt(int i).

C++ documentation:

Removes the value at index position i. i must be a valid index position in the array (i.e., 0 <= i < size()).

See also insert() and replace().

pub unsafe fn remove_first(&self)[src]

Removes the first item in the array. Calling this function is equivalent to calling removeAt(0). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

Calls C++ function: void QJsonArray::removeFirst().

C++ documentation:

Removes the first item in the array. Calling this function is equivalent to calling removeAt(0). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

See also removeAt() and removeLast().

pub unsafe fn remove_last(&self)[src]

Removes the last item in the array. Calling this function is equivalent to calling removeAt(size() - 1). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

Calls C++ function: void QJsonArray::removeLast().

C++ documentation:

Removes the last item in the array. Calling this function is equivalent to calling removeAt(size() - 1). The array must not be empty. If the array can be empty, call isEmpty() before calling this function.

See also removeAt() and removeFirst().

pub unsafe fn replace(&self, i: c_int, value: impl CastInto<Ref<QJsonValue>>)[src]

Replaces the item at index position i with value. i must be a valid index position in the array (i.e., 0 <= i < size()).

Calls C++ function: void QJsonArray::replace(int i, const QJsonValue& value).

C++ documentation:

Replaces the item at index position i with value. i must be a valid index position in the array (i.e., 0 <= i < size()).

See also operator[]() and removeAt().

pub unsafe fn size(&self) -> c_int[src]

Returns the number of values stored in the array.

Calls C++ function: int QJsonArray::size() const.

C++ documentation:

Returns the number of values stored in the array.

pub unsafe fn swap(&self, other: impl CastInto<Ref<QJsonArray>>)[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Swaps the array other with this. This operation is very fast and never fails.

Calls C++ function: void QJsonArray::swap(QJsonArray& other).

C++ documentation:

Swaps the array other with this. This operation is very fast and never fails.

This function was introduced in Qt 5.10.

pub unsafe fn take_at(&self, i: c_int) -> CppBox<QJsonValue>[src]

Removes the item at index position i and returns it. i must be a valid index position in the array (i.e., 0 <= i < size()).

Calls C++ function: QJsonValue QJsonArray::takeAt(int i).

C++ documentation:

Removes the item at index position i and returns it. i must be a valid index position in the array (i.e., 0 <= i < size()).

If you don't use the return value, removeAt() is more efficient.

See also removeAt().

pub unsafe fn to_variant_list(&self) -> CppBox<QListOfQVariant>[src]

Converts this object to a QVariantList.

Calls C++ function: QList<QVariant> QJsonArray::toVariantList() const.

C++ documentation:

Converts this object to a QVariantList.

Returns the created map.

Trait Implementations

impl<'_> Add<Ref<QJsonValue>> for &'_ QJsonArray[src]

type Output = CppBox<QJsonArray>

The resulting type after applying the + operator.

fn add(self, v: Ref<QJsonValue>) -> CppBox<QJsonArray>[src]

Returns an array that contains all the items in this array followed by the provided value.

Calls C++ function: QJsonArray QJsonArray::operator+(const QJsonValue& v) const.

C++ documentation:

Returns an array that contains all the items in this array followed by the provided value.

This function was introduced in Qt 5.3.

See also operator+=().

impl Begin for QJsonArray[src]

type Output = CppBox<ConstIterator>

Output type.

unsafe fn begin(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QJsonArray::const_iterator QJsonArray::begin() const.

C++ documentation:

This is an overloaded function.

impl BeginMut for QJsonArray[src]

type Output = CppBox<Iterator>

Output type.

unsafe fn begin_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the first item in the array.

Calls C++ function: QJsonArray::iterator QJsonArray::begin().

C++ documentation:

Returns an STL-style iterator pointing to the first item in the array.

See also constBegin() and end().

impl CppDeletable for QJsonArray[src]

unsafe fn delete(&self)[src]

Deletes the array.

Calls C++ function: [destructor] void QJsonArray::~QJsonArray().

C++ documentation:

Deletes the array.

impl End for QJsonArray[src]

type Output = CppBox<ConstIterator>

Output type.

unsafe fn end(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QJsonArray::const_iterator QJsonArray::end() const.

C++ documentation:

This is an overloaded function.

impl EndMut for QJsonArray[src]

type Output = CppBox<Iterator>

Output type.

unsafe fn end_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the imaginary item after the last item in the array.

Calls C++ function: QJsonArray::iterator QJsonArray::end().

C++ documentation:

Returns an STL-style iterator pointing to the imaginary item after the last item in the array.

See also begin() and constEnd().

impl PartialEq<Ref<QJsonArray>> for QJsonArray[src]

fn eq(&self, other: &Ref<QJsonArray>) -> bool[src]

Returns true if this array is equal to other.

Calls C++ function: bool QJsonArray::operator==(const QJsonArray& other) const.

C++ documentation:

Returns true if this array is equal to other.

impl<'_> Shl<Ref<QJsonValue>> for &'_ QJsonArray[src]

type Output = Ref<QJsonArray>

The resulting type after applying the << operator.

fn shl(self, v: Ref<QJsonValue>) -> Ref<QJsonArray>[src]

Appends value to the array, and returns a reference to the array itself.

Calls C++ function: QJsonArray& QJsonArray::operator<<(const QJsonValue& v).

C++ documentation:

Appends value to the array, and returns a reference to the array itself.

This function was introduced in Qt 5.3.

See also operator+=() and append().

impl Size for QJsonArray[src]

unsafe fn size(&self) -> usize[src]

Returns the number of values stored in the array.

Calls C++ function: int QJsonArray::size() const.

C++ documentation:

Returns the number of values stored in the array.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.