Struct qt_core::QCborMap

source ·
#[repr(C)]
pub struct QCborMap { /* private fields */ }
Expand description

The QCborMap class is used to hold an associative container representable in CBOR.

C++ class: QCborMap.

C++ documentation:

The QCborMap class is used to hold an associative container representable in CBOR.

This class can be used to hold an associative container in CBOR, a map between a key and a value type. CBOR is the Concise Binary Object Representation, a very compact form of binary data encoding that is a superset of JSON. It was created by the IETF Constrained RESTful Environments (CoRE) WG, which has used it in many new RFCs. It is meant to be used alongside the CoAP protocol.

Unlike JSON and QVariantMap, CBOR map keys can be of any type, not just strings. For that reason, QCborMap is effectively a map between QCborValue keys to QCborValue value elements.

However, for all member functions that take a key parameter, QCborMap provides overloads that will work efficiently with integers and strings. In fact, the use of integer keys is encouraged, since they occupy fewer bytes to transmit and are simpler to encode and decode. Newer protocols designed by the IETF CoRE WG to work specifically with CBOR are known to use them.

QCborMap is not sorted, because of that, searching for keys has linear complexity (O(n)). QCborMap actually keeps the elements in the order that they were inserted, which means that it is possible to make sorted QCborMaps by carefully inserting elements in sorted order. CBOR does not require sorting, but recommends it.

QCborMap can also be converted to and from QVariantMap and QJsonObject. However, when performing the conversion, any non-string keys will be stringified using a one-way method that the conversion back to QCborMap will not undo.

Implementations§

source§

impl QCborMap

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as end().

Calls C++ function: QCborMap::Iterator QCborMap::begin().

C++ documentation:

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as end().

See also constBegin() and end().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

Calls C++ function: QCborMap::ConstIterator QCborMap::begin() const.

C++ documentation:

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

See also begin() and constEnd().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

Calls C++ function: QCborMap::ConstIterator QCborMap::cbegin() const.

C++ documentation:

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

See also begin() and constEnd().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator representing an element just past the last element in the map.

Calls C++ function: QCborMap::ConstIterator QCborMap::cend() const.

C++ documentation:

Returns a map iterator representing an element just past the last element in the map.

See also begin(), constBegin(), find(), and constFind().

source

pub unsafe fn clear(&self)

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Empties this map.

Calls C++ function: void QCborMap::clear().

C++ documentation:

Empties this map.

See also isEmpty().

source

pub unsafe fn compare(&self, other: impl CastInto<Ref<QCborMap>>) -> c_int

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Compares this map and other, comparing each element in sequence, and returns an integer that indicates whether this map should be sorted prior to (if the result is negative) or after other (if the result is positive). If this function returns 0, the two maps are equal and contain the same elements.

Calls C++ function: int QCborMap::compare(const QCborMap& other) const.

C++ documentation:

Compares this map and other, comparing each element in sequence, and returns an integer that indicates whether this map should be sorted prior to (if the result is negative) or after other (if the result is positive). If this function returns 0, the two maps are equal and contain the same elements.

Note that CBOR maps are unordered, which means that two maps containing the very same pairs but in different order will still compare differently. To avoid this, it is recommended to insert elements into the map in a predictable order, such as by ascending key value. In fact, maps with keys in sorted order are required for Canonical CBOR representation.

For more information on CBOR sorting order, see QCborValue::compare().

See also QCborValue::compare(), QCborArray::compare(), and operator==().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

Calls C++ function: QCborMap::ConstIterator QCborMap::constBegin() const.

C++ documentation:

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

See also begin() and constEnd().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator representing an element just past the last element in the map.

Calls C++ function: QCborMap::ConstIterator QCborMap::constEnd() const.

C++ documentation:

Returns a map iterator representing an element just past the last element in the map.

See also begin(), constBegin(), find(), and constFind().

source

pub unsafe fn const_find_i64(&self, key: i64) -> CppBox<ConstIterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator to the key-value pair whose key is key, if the map contains such a pair. If it doesn't, this function returns constEnd().

Calls C++ function: QCborMap::ConstIterator QCborMap::constFind(qint64 key) const.

C++ documentation:

Returns a map iterator to the key-value pair whose key is key, if the map contains such a pair. If it doesn’t, this function returns constEnd().

CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

If the map contains more than one key equal to key, it is undefined which one this function will find. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

value(QLatin1String), value(const QString &), value(const QCborValue &)

See also value(qint64), operator[](qint64), find(qint64), remove(qint64), and contains(qint64).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::ConstIterator QCborMap::constFind(QLatin1String key) const.

C++ documentation:

This is an overloaded function.

Returns a map iterator to the key-value pair whose key is key, if the map contains such a pair. If it doesn't, this function returns constEnd().

If the map contains more than one key equal to key, it is undefined which one this function will find. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

value(qint64), value(const QString &), value(const QCborValue &)

See also value(QLatin1String), operator[](QLatin1String), find(QLatin1String), remove(QLatin1String), and contains(QLatin1String).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::ConstIterator QCborMap::constFind(const QString& key) const.

C++ documentation:

This is an overloaded function.

Returns a map iterator to the key-value pair whose key is key, if the map contains such a pair. If it doesn't, this function returns constEnd().

If the map contains more than one key equal to key, it is undefined which one this function will find. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

value(qint64), value(QLatin1String), value(const QCborValue &)

See also value(const QString &), operator[](const QString &), find(const QString &), remove(const QString &), and contains(const QString &).

source

pub unsafe fn const_find_q_cbor_value( &self, key: impl CastInto<Ref<QCborValue>> ) -> CppBox<ConstIterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::ConstIterator QCborMap::constFind(const QCborValue& key) const.

C++ documentation:

This is an overloaded function.

Returns a map iterator to the key-value pair whose key is key, if the map contains such a pair. If it doesn't, this function returns constEnd().

If the map contains more than one key equal to key, it is undefined which one this function will find. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(const QCborValue &), operator[](const QCborValue &), find(const QCborValue &), remove(const QCborValue &), contains(const QCborValue &), value(qint64), value(QLatin1String), and value(const QString &).

source

pub unsafe fn contains_i64(&self, key: i64) -> bool

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns true if this map contains a key-value pair identified by key key. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

Calls C++ function: bool QCborMap::contains(qint64 key) const.

C++ documentation:

Returns true if this map contains a key-value pair identified by key key. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

See also value(qint64), operator[](qint64), find(qint64), remove(qint64), contains(QLatin1String), remove(const QString &), and remove(const QCborValue &).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns true if this map contains a key-value pair identified by key key.

See also value(QLatin1String), operator[](QLatin1String), find(QLatin1String), remove(QLatin1String), contains(qint64), remove(const QString &), and remove(const QCborValue &).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns true if this map contains a key-value pair identified by key key.

See also value(const QString &), operator[](const QString &), find(const QString &), remove(const QString &), contains(qint64), remove(QLatin1String), and remove(const QCborValue &).

source

pub unsafe fn contains_q_cbor_value( &self, key: impl CastInto<Ref<QCborValue>> ) -> bool

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns true if this map contains a key-value pair identified by key key.

Calls C++ function: bool QCborMap::contains(const QCborValue& key) const.

C++ documentation:

Returns true if this map contains a key-value pair identified by key key.

See also value(const QCborValue &), operator[](const QCborValue &), find(const QCborValue &), remove(const QCborValue &), contains(qint64), remove(QLatin1String), and remove(const QString &).

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QCborMap>> ) -> Ref<QCborMap>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Replaces the contents of this object with a copy of other, then returns a reference to this object.

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

C++ documentation:

Replaces the contents of this object with a copy of other, then returns a reference to this object.

source

pub unsafe fn empty(&self) -> bool

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Synonym for isEmpty(). This function is provided for compatibility with generic code that uses the Standard Library API.

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

C++ documentation:

Synonym for isEmpty(). This function is provided for compatibility with generic code that uses the Standard Library API.

Returns true if this map is empty (size() == 0).

See also isEmpty() and size().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator representing an element just past the last element in the map.

Calls C++ function: QCborMap::Iterator QCborMap::end().

C++ documentation:

Returns a map iterator representing an element just past the last element in the map.

See also begin(), constBegin(), find(), and constFind().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a map iterator representing an element just past the last element in the map.

Calls C++ function: QCborMap::ConstIterator QCborMap::end() const.

C++ documentation:

Returns a map iterator representing an element just past the last element in the map.

See also begin(), constBegin(), find(), and constFind().

source

pub unsafe fn erase_iterator( &self, it: impl CastInto<Ref<Iterator>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::Iterator QCborMap::erase(QCborMap::Iterator it).

C++ documentation:

This is an overloaded function.

Removes the key-value pair pointed to by the map iterator it and returns a pointer to the next element, after removal.

See also remove(), begin(), end(), and insert().

source

pub unsafe fn erase_const_iterator( &self, it: impl CastInto<Ref<ConstIterator>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes the key-value pair pointed to by the map iterator it and returns a pointer to the next element, after removal.

Calls C++ function: QCborMap::Iterator QCborMap::erase(QCborMap::ConstIterator it).

C++ documentation:

Removes the key-value pair pointed to by the map iterator it and returns a pointer to the next element, after removal.

See also remove(), begin(), end(), insert(), and extract().

source

pub unsafe fn extract_iterator( &self, it: impl CastInto<Ref<Iterator>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborValue QCborMap::extract(QCborMap::Iterator it).

source

pub unsafe fn extract_const_iterator( &self, it: impl CastInto<Ref<ConstIterator>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborValue QCborMap::extract(QCborMap::ConstIterator it).

source

pub unsafe fn find_i64_mut(&self, key: i64) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::Iterator QCborMap::find(qint64 key).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::Iterator QCborMap::find(QLatin1String key).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::Iterator QCborMap::find(const QString& key).

source

pub unsafe fn find_q_cbor_value_mut( &self, key: impl CastInto<Ref<QCborValue>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::Iterator QCborMap::find(const QCborValue& key).

source

pub unsafe fn find_i64(&self, key: i64) -> CppBox<ConstIterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::ConstIterator QCborMap::find(qint64 key) const.

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::ConstIterator QCborMap::find(QLatin1String key) const.

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::ConstIterator QCborMap::find(const QString& key) const.

source

pub unsafe fn find_q_cbor_value( &self, key: impl CastInto<Ref<QCborValue>> ) -> CppBox<ConstIterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Calls C++ function: QCborMap::ConstIterator QCborMap::find(const QCborValue& key) const.

source

pub unsafe fn from_json_object( o: impl CastInto<Ref<QJsonObject>> ) -> CppBox<QCborMap>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Converts all JSON items found in the obj object to CBOR using QCborValue::fromJson(), and returns the map composed of those elements.

Calls C++ function: static QCborMap QCborMap::fromJsonObject(const QJsonObject& o).

C++ documentation:

Converts all JSON items found in the obj object to CBOR using QCborValue::fromJson(), and returns the map composed of those elements.

This conversion is lossless, as the CBOR type system is a superset of JSON's. Moreover, the map returned by this function can be converted back to the original obj by using toJsonObject().

See also toJsonObject(), toVariantMap(), QCborValue::fromJsonValue(), and QCborArray::fromJsonArray().

source

pub unsafe fn from_variant_hash( hash: impl CastInto<Ref<QHashOfQStringQVariant>> ) -> CppBox<QCborMap>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Converts all the items in hash to CBOR using QCborValue::fromVariant() and returns the map composed of those elements.

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

C++ documentation:

Converts all the items in hash to CBOR using QCborValue::fromVariant() and returns the map composed of those elements.

Conversion from QVariant is not completely lossless. Please see the documentation in QCborValue::fromVariant() for more information.

See also toVariantHash(), fromVariantMap(), fromJsonObject(), and QCborValue::fromVariant().

source

pub unsafe fn from_variant_map( map: impl CastInto<Ref<QMapOfQStringQVariant>> ) -> CppBox<QCborMap>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Converts all the items in map to CBOR using QCborValue::fromVariant() and returns the map composed of those elements.

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

C++ documentation:

Converts all the items in map to CBOR using QCborValue::fromVariant() and returns the map composed of those elements.

Conversion from QVariant is not completely lossless. Please see the documentation in QCborValue::fromVariant() for more information.

See also toVariantMap(), fromVariantHash(), fromJsonObject(), and QCborValue::fromVariant().

source

pub unsafe fn index_i64(&self, key: i64) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the QCborValue element in this map that corresponds to key key, if there is one. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

Calls C++ function: QCborValue QCborMap::operator[](qint64 key) const.

C++ documentation:

Returns the QCborValue element in this map that corresponds to key key, if there is one. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one this function will return. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

operator[](QLatin1String), operator[](const QString &), operator[](const QCborOperator[] &)

See also value(qint64), find(qint64), constFind(qint64), remove(qint64), and contains(qint64).

source

pub unsafe fn index_q_latin1_string( &self, key: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborValue QCborMap::operator[](QLatin1String key) const.

C++ documentation:

This is an overloaded function.

Returns the QCborValue element in this map that corresponds to key key, if there is one.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one this function will return. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

operator[](qint64), operator[](const QString &), operator[](const QCborOperator[] &)

See also value(QLatin1String), find(QLatin1String), constFind(QLatin1String), remove(QLatin1String), and contains(QLatin1String).

source

pub unsafe fn index_q_string( &self, key: impl CastInto<Ref<QString>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborValue QCborMap::operator[](const QString& key) const.

C++ documentation:

This is an overloaded function.

Returns the QCborValue element in this map that corresponds to key key, if there is one.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one this function will return. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

operator[](qint64), operator[](QLatin1String), operator[](const QCborOperator[] &)

See also value(const QString &), find(const QString &), constFind(const QString &), remove(const QString &), and contains(const QString &).

source

pub unsafe fn index_q_cbor_value( &self, key: impl CastInto<Ref<QCborValue>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the QCborValue element in this map that corresponds to key key, if there is one.

Calls C++ function: QCborValue QCborMap::operator[](const QCborValue& key) const.

C++ documentation:

Returns the QCborValue element in this map that corresponds to key key, if there is one.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one this function will return. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

operator[](qint64), operator[](QLatin1String), operator[](const QCborOperator[] &)

See also value(const QCborValue &), find(const QCborValue &), constFind(const QCborValue &), remove(const QCborValue &), and contains(const QCborValue &).

source

pub unsafe fn index_i64_mut(&self, key: i64) -> CppBox<QCborValueRef>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a QCborValueRef to the value in this map that corresponds to key key. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

Calls C++ function: QCborValueRef QCborMap::operator[](qint64 key).

C++ documentation:

Returns a QCborValueRef to the value in this map that corresponds to key key. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

QCborValueRef has the exact same API as QCborValue, with one important difference: if you assign new values to it, this map will be updated with that new value.

If the map did not have a key equal to key, one is inserted and this function returns a reference to the new value, which will be a QCborValue with an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one the return will reference. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(qint64), find(qint64), contains(qint64), remove(qint64), operator[](QLatin1String), operator[](const QString &), and operator[](const QCborValue &).

source

pub unsafe fn index_q_latin1_string_mut( &self, key: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QCborValueRef>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborValueRef QCborMap::operator[](QLatin1String key).

C++ documentation:

This is an overloaded function.

Returns a QCborValueRef to the value in this map that corresponds to key key.

QCborValueRef has the exact same API as QCborValue, with one important difference: if you assign new values to it, this map will be updated with that new value.

If the map did not have a key equal to key, one is inserted and this function returns a reference to the new value, which will be a QCborValue with an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one the return will reference. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(QLatin1String), find(QLatin1String), contains(QLatin1String), remove(QLatin1String), operator[](qint64), operator[](const QString &), and operator[](const QCborValue &).

source

pub unsafe fn index_q_string_mut( &self, key: impl CastInto<Ref<QString>> ) -> CppBox<QCborValueRef>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborValueRef QCborMap::operator[](const QString& key).

C++ documentation:

This is an overloaded function.

Returns a QCborValueRef to the value in this map that corresponds to key key.

QCborValueRef has the exact same API as QCborValue, with one important difference: if you assign new values to it, this map will be updated with that new value.

If the map did not have a key equal to key, one is inserted and this function returns a reference to the new value, which will be a QCborValue with an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one the return will reference. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(const QString &), find(const QString &), contains(const QString &), remove(const QString &), operator[](qint64), operator[](QLatin1String), and operator[](const QCborValue &).

source

pub unsafe fn index_q_cbor_value_mut( &self, key: impl CastInto<Ref<QCborValue>> ) -> CppBox<QCborValueRef>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborValueRef QCborMap::operator[](const QCborValue& key).

C++ documentation:

This is an overloaded function.

Returns a QCborValueRef to the value in this map that corresponds to key key.

QCborValueRef has the exact same API as QCborValue, with one important difference: if you assign new values to it, this map will be updated with that new value.

If the map did not have a key equal to key, one is inserted and this function returns a reference to the new value, which will be a QCborValue with an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one the return will reference. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(const QCborValue &), find(const QCborValue &), contains(const QCborValue &), remove(const QCborValue &), operator[](qint64), operator[](QLatin1String), and operator[](const QString &).

source

pub unsafe fn insert_i64_q_cbor_value( &self, key: i64, value: impl CastInto<Ref<QCborValue>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::Iterator QCborMap::insert(qint64 key, const QCborValue& value_).

C++ documentation:

This is an overloaded function.

Inserts the key key and value value into this map and returns a map iterator pointing to the newly inserted pair.

If the map already had a key equal to key, its value will be overwritten by value.

See also erase(), remove(qint64), value(qint64), operator[](qint64), find(qint64), contains(qint64), take(qint64), and extract().

source

pub unsafe fn insert_q_latin1_string_q_cbor_value( &self, key: impl CastInto<Ref<QLatin1String>>, value: impl CastInto<Ref<QCborValue>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::Iterator QCborMap::insert(QLatin1String key, const QCborValue& value_).

C++ documentation:

This is an overloaded function.

Inserts the key key and value value into this map and returns a map iterator pointing to the newly inserted pair.

If the map already had a key equal to key, its value will be overwritten by value.

See also erase(), remove(QLatin1String), value(QLatin1String), operator[](QLatin1String), find(QLatin1String), contains(QLatin1String), take(QLatin1String), and extract().

source

pub unsafe fn insert_q_string_q_cbor_value( &self, key: impl CastInto<Ref<QString>>, value: impl CastInto<Ref<QCborValue>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::Iterator QCborMap::insert(const QString& key, const QCborValue& value_).

C++ documentation:

This is an overloaded function.

Inserts the key key and value value into this map and returns a map iterator pointing to the newly inserted pair.

If the map already had a key equal to key, its value will be overwritten by value.

See also erase(), remove(const QString &), value(const QString &), operator[](const QString &), find(const QString &), contains(const QString &), take(const QString &), and extract().

source

pub unsafe fn insert_2_q_cbor_value( &self, key: impl CastInto<Ref<QCborValue>>, value: impl CastInto<Ref<QCborValue>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::Iterator QCborMap::insert(const QCborValue& key, const QCborValue& value_).

C++ documentation:

This is an overloaded function.

Inserts the key key and value value into this map and returns a map iterator pointing to the newly inserted pair.

If the map already had a key equal to key, its value will be overwritten by value.

See also erase(), remove(const QCborValue &), value(const QCborValue &), operator[](const QCborValue &), find(const QCborValue &), contains(const QCborValue &), take(const QCborValue &), and extract().

source

pub unsafe fn insert_q_pair_of_q_cbor_value_q_cbor_value( &self, v: impl CastInto<Ref<QPairOfQCborValueQCborValue>> ) -> CppBox<Iterator>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborMap::Iterator QCborMap::insert(QPair<QCborValue, QCborValue> v).

C++ documentation:

This is an overloaded function.

Inserts the key-value pair in v into this map and returns a map iterator pointing to the newly inserted pair.

If the map already had a key equal to v.first, its value will be overwritten by v.second.

See also operator[], erase(), and extract().

source

pub unsafe fn is_empty(&self) -> bool

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns true if this map is empty (that is, size() is 0).

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

C++ documentation:

Returns true if this map is empty (that is, size() is 0).

See also size() and clear().

source

pub unsafe fn keys(&self) -> CppBox<QVectorOfQCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a list of all keys in this map.

Calls C++ function: QVector<QCborValue> QCborMap::keys() const.

C++ documentation:

Returns a list of all keys in this map.

See also QMap::keys() and QHash::keys().

source

pub unsafe fn new() -> CppBox<QCborMap>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Constructs an empty CBOR Map object.

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

C++ documentation:

Constructs an empty CBOR Map object.

See also isEmpty().

source

pub unsafe fn new_copy(other: impl CastInto<Ref<QCborMap>>) -> CppBox<QCborMap>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Creates a QCborMap object that is a copy of other.

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

C++ documentation:

Creates a QCborMap object that is a copy of other.

source

pub unsafe fn remove_i64(&self, key: i64)

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes the key key and the corresponding value from the map, if it is found. If the map contains no such key, this function does nothing.

Calls C++ function: void QCborMap::remove(qint64 key).

C++ documentation:

Removes the key key and the corresponding value from the map, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

remove(QLatin1String), remove(const QString &), remove(const QCborValue &)

See also value(qint64), operator[](qint64), find(qint64), and contains(qint64).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Removes the key key and the corresponding value from the map, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

remove(qint64), remove(const QString &), remove(const QCborValue &)

See also value(QLatin1String), operator[](QLatin1String), find(QLatin1String), and contains(QLatin1String).

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Removes the key key and the corresponding value from the map, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

remove(qint64), remove(QLatin1String), remove(const QCborValue &)

See also value(const QString &), operator[](const QString &), find(const QString &), and contains(const QString &).

source

pub unsafe fn remove_q_cbor_value(&self, key: impl CastInto<Ref<QCborValue>>)

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes the key key and the corresponding value from the map, if it is found. If the map contains no such key, this function does nothing.

Calls C++ function: void QCborMap::remove(const QCborValue& key).

C++ documentation:

Removes the key key and the corresponding value from the map, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

remove(qint64), remove(QLatin1String), remove(const QString &)

See also value(const QCborValue &), operator[](const QCborValue &), find(const QCborValue &), and contains(const QCborValue &).

source

pub unsafe fn size(&self) -> c_longlong

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the number of elements in this map.

Calls C++ function: long long QCborMap::size() const.

C++ documentation:

Returns the number of elements in this map.

See also isEmpty().

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QCborMap>>)

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Swaps the contents of this map and other.

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

C++ documentation:

Swaps the contents of this map and other.

source

pub unsafe fn take_i64(&self, key: i64) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

Calls C++ function: QCborValue QCborMap::take(qint64 key).

C++ documentation:

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(qint64), operator[](qint64), find(qint64), contains(qint64), take(QLatin1String), take(const QString &), take(const QCborValue &), and insert().

source

pub unsafe fn take_q_latin1_string( &self, key: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

Calls C++ function: QCborValue QCborMap::take(QLatin1String key).

C++ documentation:

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(QLatin1String), operator[](QLatin1String), find(QLatin1String), contains(QLatin1String), take(qint64), take(const QString &), take(const QCborValue &), and insert().

source

pub unsafe fn take_q_string( &self, key: impl CastInto<Ref<QString>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

Calls C++ function: QCborValue QCborMap::take(const QString& key).

C++ documentation:

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(const QString &), operator[](const QString &), find(const QString &), contains(const QString &), take(QLatin1String), take(qint64), take(const QCborValue &), and insert().

source

pub unsafe fn take_q_cbor_value( &self, key: impl CastInto<Ref<QCborValue>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

Calls C++ function: QCborValue QCborMap::take(const QCborValue& key).

C++ documentation:

Removes the key key and the corresponding value from the map and returns the value, if it is found. If the map contains no such key, this function does nothing.

If the map contains more than one key equal to key, it is undefined which one this function will remove. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

See also value(const QCborValue &), operator[](const QCborValue &), find(const QCborValue &), contains(const QCborValue &), take(QLatin1String), take(const QString &), take(qint64), and insert().

source

pub unsafe fn to_cbor_value(&self) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Explicitly constructs a QCborValue object that represents this map. This function is usually not necessary since QCborValue has a constructor for QCborMap, so the conversion is implicit.

Calls C++ function: QCborValue QCborMap::toCborValue() const.

C++ documentation:

Explicitly constructs a QCborValue object that represents this map. This function is usually not necessary since QCborValue has a constructor for QCborMap, so the conversion is implicit.

Converting QCborMap to QCborValue allows it to be used in any context where QCborValues can be used, including as keys and mapped types in QCborMap, as well as QCborValue::toCbor().

See also QCborValue::QCborValue(const QCborMap &).

source

pub unsafe fn to_json_object(&self) -> CppBox<QJsonObject>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Recursively converts every QCborValue value in this array to JSON using QCborValue::toJsonValue() and creates a string key for all keys that aren't strings, then returns the corresponding QJsonObject composed of those associations.

Calls C++ function: QJsonObject QCborMap::toJsonObject() const.

C++ documentation:

Recursively converts every QCborValue value in this array to JSON using QCborValue::toJsonValue() and creates a string key for all keys that aren’t strings, then returns the corresponding QJsonObject composed of those associations.

Please note that CBOR contains a richer and wider type set than JSON, so some information may be lost in this conversion. For more details on what conversions are applied, see QCborValue::toJsonValue().

Map key conversion to string

JSON objects are defined as having string keys, unlike CBOR, so the conversion of a QCborMap to QJsonObject will imply a step of "stringification" of the key values. The conversion will use the special handling of tags and extended types from above and will also convert the rest of the types as follows:

TypeTransformation
Bool"true" and "false"
Null"null"
Undefined"undefined"
IntegerThe decimal string form of the number
DoubleThe decimal string form of the number
Byte arrayUnless tagged differently (see above), encoded as Base64url
ArrayReplaced by the compact form of its Diagnostic notation
MapReplaced by the compact form of its Diagnostic notation
Tags and extended typesTag number is dropped and the tagged value is converted to string

See also fromJsonObject(), QCborValue::toJsonValue(), QCborArray::toJsonArray(), and toVariantMap().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Converts the CBOR values to QVariant using QCborValue::toVariant() and "stringifies" all the CBOR keys in this map, returning the QVariantHash that results from that association list.

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

C++ documentation:

Converts the CBOR values to QVariant using QCborValue::toVariant() and “stringifies” all the CBOR keys in this map, returning the QVariantHash that results from that association list.

QVariantMaps have string keys, unlike CBOR, so the conversion of a QCborMap to QVariantMap will imply a step of "stringification" of the key values. See QCborMap::toJsonObject() for details.

In addition, the conversion to QVariant is not completely lossless. Please see the documentation in QCborValue::toVariant() for more information.

See also fromVariantHash(), toVariantMap(), toJsonObject(), QCborValue::toVariant(), and QCborArray::toVariantList().

source

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

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Converts the CBOR values to QVariant using QCborValue::toVariant() and "stringifies" all the CBOR keys in this map, returning the QVariantMap that results from that association list.

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

C++ documentation:

Converts the CBOR values to QVariant using QCborValue::toVariant() and “stringifies” all the CBOR keys in this map, returning the QVariantMap that results from that association list.

QVariantMaps have string keys, unlike CBOR, so the conversion of a QCborMap to QVariantMap will imply a step of "stringification" of the key values. See QCborMap::toJsonObject() for details.

In addition, the conversion to QVariant is not completely lossless. Please see the documentation in QCborValue::toVariant() for more information.

See also fromVariantMap(), toVariantHash(), toJsonObject(), QCborValue::toVariant(), and QCborArray::toVariantList().

source

pub unsafe fn value_i64(&self, key: i64) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the QCborValue element in this map that corresponds to key key, if there is one. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

Calls C++ function: QCborValue QCborMap::value(qint64 key) const.

C++ documentation:

Returns the QCborValue element in this map that corresponds to key key, if there is one. CBOR recommends using integer keys, since they occupy less space and are simpler to encode and decode.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one the return from function will reference. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

value(QLatin1String), value(const QString &), value(const QCborValue &)

See also operator[](qint64), find(qint64), constFind(qint64), remove(qint64), and contains(qint64).

source

pub unsafe fn value_q_latin1_string( &self, key: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborValue QCborMap::value(QLatin1String key) const.

C++ documentation:

This is an overloaded function.

Returns the QCborValue element in this map that corresponds to key key, if there is one.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one this function will return. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

value(qint64), value(const QString &), value(const QCborValue &)

See also operator[](QLatin1String), find(QLatin1String), constFind(QLatin1String), remove(QLatin1String), and contains(QLatin1String).

source

pub unsafe fn value_q_string( &self, key: impl CastInto<Ref<QString>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QCborValue QCborMap::value(const QString& key) const.

C++ documentation:

This is an overloaded function.

Returns the QCborValue element in this map that corresponds to key key, if there is one.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one this function will return. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

value(qint64), value(QLatin1String), value(const QCborValue &)

See also operator[](const QString &), find(const QString &), constFind(const QString &), remove(const QString &), and contains(const QString &).

source

pub unsafe fn value_q_cbor_value( &self, key: impl CastInto<Ref<QCborValue>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the QCborValue element in this map that corresponds to key key, if there is one.

Calls C++ function: QCborValue QCborMap::value(const QCborValue& key) const.

C++ documentation:

Returns the QCborValue element in this map that corresponds to key key, if there is one.

If the map does not contain key key, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the key was not present from the situation where the key was mapped to an undefined value.

If the map contains more than one key equal to key, it is undefined which one this function will return. QCborMap does not allow inserting duplicate keys, but it is possible to create such a map by decoding a CBOR stream with them. They are usually not permitted and having duplicate keys is usually an indication of a problem in the sender.

value(qint64), value(QLatin1String), value(const QString &)

See also operator[](const QCborValue &), find(const QCborValue &), constFind(const QCborValue &), remove(const QCborValue &), and contains(const QCborValue &).

Trait Implementations§

source§

impl Begin for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

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

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

Calls C++ function: QCborMap::ConstIterator QCborMap::begin() const.

C++ documentation:

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as constEnd().

See also begin() and constEnd().

§

type Output = CppBox<ConstIterator>

Output type.
source§

impl BeginMut for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

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

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as end().

Calls C++ function: QCborMap::Iterator QCborMap::begin().

C++ documentation:

Returns a map iterator pointing to the first key-value pair of this map. If this map is empty, the returned iterator will be the same as end().

See also constBegin() and end().

§

type Output = CppBox<Iterator>

Output type.
source§

impl CppDeletable for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

unsafe fn delete(&self)

Destroys this QCborMap object and frees any associated resources it owns.

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

C++ documentation:

Destroys this QCborMap object and frees any associated resources it owns.

source§

impl End for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

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

Returns a map iterator representing an element just past the last element in the map.

Calls C++ function: QCborMap::ConstIterator QCborMap::end() const.

C++ documentation:

Returns a map iterator representing an element just past the last element in the map.

See also begin(), constBegin(), find(), and constFind().

§

type Output = CppBox<ConstIterator>

Output type.
source§

impl EndMut for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

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

Returns a map iterator representing an element just past the last element in the map.

Calls C++ function: QCborMap::Iterator QCborMap::end().

C++ documentation:

Returns a map iterator representing an element just past the last element in the map.

See also begin(), constBegin(), find(), and constFind().

§

type Output = CppBox<Iterator>

Output type.
source§

impl Lt<Ref<QCborMap>> for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

unsafe fn lt(&self, other: &Ref<QCborMap>) -> bool

Compares this map and other, comparing each element in sequence, and returns true if this map should be sorted before other, false otherwise.

Calls C++ function: bool QCborMap::operator<(const QCborMap& other) const.

C++ documentation:

Compares this map and other, comparing each element in sequence, and returns true if this map should be sorted before other, false otherwise.

Note that CBOR maps are unordered, which means that two maps containing the very same pairs but in different order will still compare differently. To avoid this, it is recommended to insert elements into the map in a predictable order, such as by ascending key value. In fact, maps with keys in sorted order are required for Canonical CBOR representation.

For more information on CBOR sorting order, see QCborValue::compare().

See also compare(), QCborValue::operator==(), QCborMap::operator==(), operator==(), and operator!=().

source§

impl PartialEq<Ref<QCborMap>> for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

fn eq(&self, other: &Ref<QCborMap>) -> bool

Compares this map and other, comparing each element in sequence, and returns true if the two maps contains the same elements in the same order, false otherwise.

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

C++ documentation:

Compares this map and other, comparing each element in sequence, and returns true if the two maps contains the same elements in the same order, false otherwise.

Note that CBOR maps are unordered, which means that two maps containing the very same pairs but in different order will still compare differently. To avoid this, it is recommended to insert elements into the map in a predictable order, such as by ascending key value. In fact, maps with keys in sorted order are required for Canonical CBOR representation.

For more information on CBOR equality in Qt, see, QCborValue::compare().

See also compare(), QCborValue::operator==(), QCborMap::operator==(), operator!=(), and operator<().

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Size for QCborMap

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.
source§

unsafe fn size(&self) -> usize

Returns the number of elements in this map.

Calls C++ function: long long QCborMap::size() const.

C++ documentation:

Returns the number of elements in this map.

See also isEmpty().

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.