[][src]Struct qt_core::QJsonObject

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

The QJsonObject class encapsulates a JSON object.

C++ class: QJsonObject.

C++ documentation:

The QJsonObject class encapsulates a JSON object.

A JSON object is a list of key value pairs, where the keys are unique strings and the values are represented by a QJsonValue.

A QJsonObject can be converted to and from a QVariantMap. You can query the number of (key, value) pairs with size(), insert(), and remove() entries from it and iterate over its content using the standard C++ iterator pattern.

QJsonObject 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 object to and from text based JSON through QJsonDocument.

Methods

impl QJsonObject[src]

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

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

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

C++ documentation:

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

See also constBegin() and end().

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

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

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

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

C++ documentation:

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

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 object.

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

C++ documentation:

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

See also constBegin() and end().

pub unsafe fn const_find_q_string(
    &self,
    key: impl CastInto<Ref<QString>>
) -> CppBox<ConstIterator>
[src]

Returns a const iterator pointing to the item with key key in the map.

Calls C++ function: QJsonObject::const_iterator QJsonObject::constFind(const QString& key) const.

C++ documentation:

Returns a const iterator pointing to the item with key key in the map.

If the map contains no item with key key, the function returns constEnd().

pub unsafe fn const_find_q_latin1_string(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
) -> CppBox<ConstIterator>
[src]

This is an overloaded function.

Calls C++ function: QJsonObject::const_iterator QJsonObject::constFind(QLatin1String key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.7.

pub unsafe fn const_find_q_string_view(
    &self,
    key: impl CastInto<Ref<QStringView>>
) -> CppBox<ConstIterator>
[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonObject::const_iterator QJsonObject::constFind(QStringView key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

pub unsafe fn contains_q_string(&self, key: impl CastInto<Ref<QString>>) -> bool[src]

Returns true if the object contains key key.

Calls C++ function: bool QJsonObject::contains(const QString& key) const.

C++ documentation:

Returns true if the object contains key key.

See also insert(), remove(), and take().

pub unsafe fn contains_q_latin1_string(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QJsonObject::contains(QLatin1String key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.7.

pub unsafe fn contains_q_string_view(
    &self,
    key: impl CastInto<Ref<QStringView>>
) -> bool
[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: bool QJsonObject::contains(QStringView key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

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

Assigns other to this object.

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

C++ documentation:

Assigns other to this object.

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Same as size().

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

This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true if the object is empty; otherwise returning false.

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

C++ documentation:

This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true if the object is empty; otherwise returning false.

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 object.

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

C++ documentation:

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

See also begin() and constEnd().

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

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

Removes the (key, value) pair pointed to by the iterator it from the map, and returns an iterator to the next item in the map.

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

C++ documentation:

Removes the (key, value) pair pointed to by the iterator it from the map, and returns an iterator to the next item in the map.

See also remove().

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

Returns an iterator pointing to the item with key key in the map.

Calls C++ function: QJsonObject::iterator QJsonObject::find(const QString& key).

C++ documentation:

Returns an iterator pointing to the item with key key in the map.

If the map contains no item with key key, the function returns end().

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

This is an overloaded function.

Calls C++ function: QJsonObject::iterator QJsonObject::find(QLatin1String key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.7.

pub unsafe fn find_q_string(
    &self,
    key: impl CastInto<Ref<QString>>
) -> CppBox<ConstIterator>
[src]

This is an overloaded function.

Calls C++ function: QJsonObject::const_iterator QJsonObject::find(const QString& key) const.

C++ documentation:

This is an overloaded function.

pub unsafe fn find_q_latin1_string(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
) -> CppBox<ConstIterator>
[src]

This is an overloaded function.

Calls C++ function: QJsonObject::const_iterator QJsonObject::find(QLatin1String key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.7.

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

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonObject::iterator QJsonObject::find(QStringView key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

pub unsafe fn find_q_string_view(
    &self,
    key: impl CastInto<Ref<QStringView>>
) -> CppBox<ConstIterator>
[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonObject::const_iterator QJsonObject::find(QStringView key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

pub unsafe fn from_variant_hash(
    map: impl CastInto<Ref<QHashOfQStringQVariant>>
) -> CppBox<QJsonObject>
[src]

Converts the variant hash hash to a QJsonObject.

Calls C++ function: static QJsonObject QJsonObject::fromVariantHash(const QHash<QString, QVariant>& map).

C++ documentation:

Converts the variant hash hash to a QJsonObject.

The keys in hash will be used as the keys in the JSON object, and the QVariant values will be converted to JSON values.

This function was introduced in Qt 5.5.

See also fromVariantMap(), toVariantHash(), and QJsonValue::fromVariant().

pub unsafe fn from_variant_map(
    map: impl CastInto<Ref<QMapOfQStringQVariant>>
) -> CppBox<QJsonObject>
[src]

Converts the variant map map to a QJsonObject.

Calls C++ function: static QJsonObject QJsonObject::fromVariantMap(const QMap<QString, QVariant>& map).

C++ documentation:

Converts the variant map map to a QJsonObject.

The keys in map will be used as the keys in the JSON object, and the QVariant values will be converted to JSON values.

See also fromVariantHash(), toVariantMap(), and QJsonValue::fromVariant().

pub unsafe fn index_q_string(
    &self,
    key: impl CastInto<Ref<QString>>
) -> CppBox<QJsonValue>
[src]

Returns a QJsonValue representing the value for the key key.

Calls C++ function: QJsonValue QJsonObject::operator[](const QString& key) const.

C++ documentation:

Returns a QJsonValue representing the value for the key key.

This does the same as value().

The returned QJsonValue is QJsonValue::Undefined if the key does not exist.

See also value(), QJsonValue, and QJsonValue::isUndefined().

pub unsafe fn index_q_latin1_string(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
) -> CppBox<QJsonValue>
[src]

This is an overloaded function.

Calls C++ function: QJsonValue QJsonObject::operator[](QLatin1String key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.7.

pub unsafe fn index_q_string_mut(
    &self,
    key: impl CastInto<Ref<QString>>
) -> CppBox<QJsonValueRef>
[src]

Returns a reference to the value for key.

Calls C++ function: QJsonValueRef QJsonObject::operator[](const QString& key).

C++ documentation:

Returns a reference to the value for key.

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 element in the QJsonArray or QJsonObject from which you got the reference.

See also value().

pub unsafe fn index_q_latin1_string_mut(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
) -> CppBox<QJsonValueRef>
[src]

This is an overloaded function.

Calls C++ function: QJsonValueRef QJsonObject::operator[](QLatin1String key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.7.

pub unsafe fn index_q_string_view(
    &self,
    key: impl CastInto<Ref<QStringView>>
) -> CppBox<QJsonValue>
[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonValue QJsonObject::operator[](QStringView key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

pub unsafe fn index_q_string_view_mut(
    &self,
    key: impl CastInto<Ref<QStringView>>
) -> CppBox<QJsonValueRef>
[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonValueRef QJsonObject::operator[](QStringView key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

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

Inserts a new item with the key key and a value of value.

Calls C++ function: QJsonObject::iterator QJsonObject::insert(const QString& key, const QJsonValue& value).

C++ documentation:

Inserts a new item with the key key and a value of value.

If there is already an item with the key key, then that item's value is replaced with value.

Returns an iterator pointing to the inserted item.

If the value is QJsonValue::Undefined, it will cause the key to get removed from the object. The returned iterator will then point to end().

See also remove(), take(), QJsonObject::iterator, and end().

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

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonObject::iterator QJsonObject::insert(QStringView key, const QJsonValue& value).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

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

This is an overloaded function.

Calls C++ function: QJsonObject::iterator QJsonObject::insert(QLatin1String key, const QJsonValue& value).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

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 QJsonObject::isEmpty() const.

C++ documentation:

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

See also size().

pub unsafe fn keys(&self) -> CppBox<QStringList>[src]

Returns a list of all keys in this object.

Calls C++ function: QStringList QJsonObject::keys() const.

C++ documentation:

Returns a list of all keys in this object.

The list is sorted lexographically.

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

This is an overloaded function.

Calls C++ function: int QJsonObject::length() const.

C++ documentation:

This is an overloaded function.

Same as size().

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

Constructs an empty JSON object.

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

C++ documentation:

Constructs an empty JSON object.

See also isEmpty().

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

Creates a copy of other.

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

C++ documentation:

Creates a copy of other.

Since QJsonObject is implicitly shared, the copy is shallow as long as the object does not get modified.

pub unsafe fn remove_q_string(&self, key: impl CastInto<Ref<QString>>)[src]

Removes key from the object.

Calls C++ function: void QJsonObject::remove(const QString& key).

C++ documentation:

Removes key from the object.

See also insert() and take().

pub unsafe fn remove_q_string_view(&self, key: impl CastInto<Ref<QStringView>>)[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: void QJsonObject::remove(QStringView key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

pub unsafe fn remove_q_latin1_string(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
)
[src]

This is an overloaded function.

Calls C++ function: void QJsonObject::remove(QLatin1String key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

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

Returns the number of (key, value) pairs stored in the object.

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

C++ documentation:

Returns the number of (key, value) pairs stored in the object.

pub unsafe fn swap(&self, other: impl CastInto<Ref<QJsonObject>>)[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 object other with this. This operation is very fast and never fails.

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

C++ documentation:

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

This function was introduced in Qt 5.10.

pub unsafe fn take_q_string(
    &self,
    key: impl CastInto<Ref<QString>>
) -> CppBox<QJsonValue>
[src]

Removes key from the object.

Calls C++ function: QJsonValue QJsonObject::take(const QString& key).

C++ documentation:

Removes key from the object.

Returns a QJsonValue containing the value referenced by key. If key was not contained in the object, the returned QJsonValue is QJsonValue::Undefined.

See also insert(), remove(), and QJsonValue.

pub unsafe fn take_q_string_view(
    &self,
    key: impl CastInto<Ref<QStringView>>
) -> CppBox<QJsonValue>
[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonValue QJsonObject::take(QStringView key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

pub unsafe fn take_q_latin1_string(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
) -> CppBox<QJsonValue>
[src]

This is an overloaded function.

Calls C++ function: QJsonValue QJsonObject::take(QLatin1String key).

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

pub unsafe fn to_variant_hash(&self) -> CppBox<QHashOfQStringQVariant>[src]

Converts this object to a QVariantHash.

Calls C++ function: QHash<QString, QVariant> QJsonObject::toVariantHash() const.

C++ documentation:

Converts this object to a QVariantHash.

Returns the created hash.

This function was introduced in Qt 5.5.

See also toVariantMap().

pub unsafe fn to_variant_map(&self) -> CppBox<QMapOfQStringQVariant>[src]

Converts this object to a QVariantMap.

Calls C++ function: QMap<QString, QVariant> QJsonObject::toVariantMap() const.

C++ documentation:

Converts this object to a QVariantMap.

Returns the created map.

See also toVariantHash().

pub unsafe fn value_q_string(
    &self,
    key: impl CastInto<Ref<QString>>
) -> CppBox<QJsonValue>
[src]

Returns a QJsonValue representing the value for the key key.

Calls C++ function: QJsonValue QJsonObject::value(const QString& key) const.

C++ documentation:

Returns a QJsonValue representing the value for the key key.

The returned QJsonValue is QJsonValue::Undefined if the key does not exist.

See also QJsonValue and QJsonValue::isUndefined().

pub unsafe fn value_q_latin1_string(
    &self,
    key: impl CastInto<Ref<QLatin1String>>
) -> CppBox<QJsonValue>
[src]

This is an overloaded function.

Calls C++ function: QJsonValue QJsonObject::value(QLatin1String key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.7.

pub unsafe fn value_q_string_view(
    &self,
    key: impl CastInto<Ref<QStringView>>
) -> CppBox<QJsonValue>
[src]

This is supported on cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QJsonValue QJsonObject::value(QStringView key) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.14.

Trait Implementations

impl Begin for QJsonObject[src]

type Output = CppBox<ConstIterator>

Output type.

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

impl BeginMut for QJsonObject[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 object.

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

C++ documentation:

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

See also constBegin() and end().

impl CppDeletable for QJsonObject[src]

unsafe fn delete(&self)[src]

Destroys the object.

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

C++ documentation:

Destroys the object.

impl End for QJsonObject[src]

type Output = CppBox<ConstIterator>

Output type.

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

impl EndMut for QJsonObject[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 object.

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

C++ documentation:

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

See also begin() and constEnd().

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

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

Returns true if other is equal to this object.

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

C++ documentation:

Returns true if other is equal to this object.

impl Size for QJsonObject[src]

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

Returns the number of (key, value) pairs stored in the object.

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

C++ documentation:

Returns the number of (key, value) pairs stored in the object.

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.