Struct qt_core::QCborValue

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

The QCborValue class encapsulates a value in CBOR.

C++ class: QCborValue.

C++ documentation:

The QCborValue class encapsulates a value in CBOR.

This class can be used to hold one of the many types available in CBOR. 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.

CBOR has three groups of built-in types:

  • Basic types: integers, floating point (double), boolean, null, etc.
  • String-like types: strings and byte arrays
  • Containers: arrays and maps

Additionally, CBOR supports a form of type extensibility by associating a "tag" to one of the above types to convey more information. For example, a UUID is represented by a tag and a byte array containing the 16 bytes of the UUID content. QCborValue supports creating and decoding several of those extended types directly with Qt classes (like QUuid).

For the complete list, see QCborValue::Type. The type of a QCborValue can be queried using type() or one of the "isXxxx" functions.

Implementations§

source§

impl QCborValue

source

pub unsafe fn compare(&self, other: impl CastInto<Ref<QCborValue>>) -> 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 value and other, and returns an integer that indicates whether this value 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 values are equal and hold the same contents.

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

C++ documentation:

Compares this value and other, and returns an integer that indicates whether this value 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 values are equal and hold the same contents.

If each QCborValue contains an array or map, the comparison is recursive to elements contained in them.

Extended types

QCborValue compares equal a QCborValue containing an extended type, like Url and Url and its equivalent tagged representation. So, for example, the following expression is true:

QCborValue(QUrl(“https://example.com”)) == QCborValue(QCborKnownTags::Url, “https://example.com”);

Do note that Qt types like QUrl and QDateTime will normalize and otherwise modify their arguments. The expression above is true only because the string on the right side is the normalized value that the QCborValue on the left would take. If, for example, the "https" part were uppercase in both sides, the comparison would fail. For information on normalizations performed by QCborValue, please consult the documentation of the constructor taking the Qt type in question.

Sorting order

Sorting order in CBOR is defined in RFC 7049 {https://tools.ietf.org/html/rfc7049#section-3.9}{section 3.9}, which discusses the sorting of keys in a map when following the Canonical encoding. According to the specification, "sorting is performed on the bytes of the representation of the key data items" and lists as consequences that:

  • "If two keys have different lengths, the shorter one sorts earlier;"
  • "If two keys have the same length, the one with the lower value in (byte-wise) lexical order sorts earlier."

This results in surprising sorting of QCborValues, where the result of this function is different from that which would later be retrieved by comparing the contained elements. For example, the QCborValue containing string "zzz" sorts before the QCborValue with string "foobar", even though when comparing as QStrings or QByteArrays the "zzz" sorts after "foobar" (dictionary order).

The specification does not clearly indicate what sorting order should be done for values of different types (it says sorting should not pay "attention to the 3/5 bit splitting for major types"). QCborValue makes the assumption that types should be sorted too. The numeric values of the QCborValue::Type enumeration are in that order, with the exception of the extended types, which compare as their tagged equivalents.

Note: Sorting order is preliminary and is subject to change. Applications should not depend on the order returned by this function for the time being.

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

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QCborValue>> ) -> 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.

Replaces the contents of this QCborObject with a copy of other.

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

C++ documentation:

Replaces the contents of this QCborObject with a copy of other.

source

pub unsafe fn from_cbor_q_cbor_stream_reader( reader: impl CastInto<Ref<QCborStreamReader>> ) -> 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.

Decodes one item from the CBOR stream found in reader and returns the equivalent representation. This function is recursive: if the item is a map or array, it will decode all items found in that map or array, until the outermost object is finished.

Calls C++ function: static QCborValue QCborValue::fromCbor(QCborStreamReader& reader).

C++ documentation:

Decodes one item from the CBOR stream found in reader and returns the equivalent representation. This function is recursive: if the item is a map or array, it will decode all items found in that map or array, until the outermost object is finished.

This function need not be used on the root element of a QCborStreamReader. For example, the following code illustrates how to skip the CBOR signature tag from the beginning of a file:

if (reader.isTag() && reader.toTag() == QCborKnownTags::Signature) reader.next();

QCborValue contents = QCborValue::fromCbor(reader);

The returned value may be partially complete and indistinguishable from a valid QCborValue even if the decoding failed. To determine if there was an error, check if reader.lastError() is indicating an error condition. This function stops decoding immediately after the first error.

See also toCbor(), toDiagnosticNotation(), toVariant(), and toJsonValue().

source

pub unsafe fn from_cbor_q_byte_array_q_cbor_parser_error( ba: impl CastInto<Ref<QByteArray>>, error: impl CastInto<Ptr<QCborParserError>> ) -> 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: static QCborValue QCborValue::fromCbor(const QByteArray& ba, QCborParserError* error = …).

C++ documentation:

This is an overloaded function.

Decodes one item from the CBOR stream found in the byte array ba and returns the equivalent representation. This function is recursive: if the item is a map or array, it will decode all items found in that map or array, until the outermost object is finished.

This function stores the error state, if any, in the object pointed to by error, along with the offset of where the error occurred. If no error happened, it stores NoError in the error state and the number of bytes that it consumed (that is, it stores the offset for the first unused byte). Using that information makes it possible to parse further data that may exist in the same byte array.

The returned value may be partially complete and indistinguishable from a valid QCborValue even if the decoding failed. To determine if there was an error, check if there was an error stored in error. This function stops decoding immediately after the first error.

See also toCbor(), toDiagnosticNotation(), toVariant(), and toJsonValue().

source

pub unsafe fn from_cbor_char_longlong_q_cbor_parser_error( data: *const c_char, len: c_longlong, error: impl CastInto<Ptr<QCborParserError>> ) -> 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: static QCborValue QCborValue::fromCbor(const char* data, long long len, QCborParserError* error = …).

source

pub unsafe fn from_cbor_u8_longlong_q_cbor_parser_error( data: *const u8, len: c_longlong, error: impl CastInto<Ptr<QCborParserError>> ) -> 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: static QCborValue QCborValue::fromCbor(const quint8* data, long long len, QCborParserError* error = …).

source

pub unsafe fn from_cbor_q_byte_array( ba: impl CastInto<Ref<QByteArray>> ) -> 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: static QCborValue QCborValue::fromCbor(const QByteArray& ba).

C++ documentation:

This is an overloaded function.

Decodes one item from the CBOR stream found in the byte array ba and returns the equivalent representation. This function is recursive: if the item is a map or array, it will decode all items found in that map or array, until the outermost object is finished.

This function stores the error state, if any, in the object pointed to by error, along with the offset of where the error occurred. If no error happened, it stores NoError in the error state and the number of bytes that it consumed (that is, it stores the offset for the first unused byte). Using that information makes it possible to parse further data that may exist in the same byte array.

The returned value may be partially complete and indistinguishable from a valid QCborValue even if the decoding failed. To determine if there was an error, check if there was an error stored in error. This function stops decoding immediately after the first error.

See also toCbor(), toDiagnosticNotation(), toVariant(), and toJsonValue().

source

pub unsafe fn from_cbor_char_longlong( data: *const c_char, len: c_longlong ) -> 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: static QCborValue QCborValue::fromCbor(const char* data, long long len).

source

pub unsafe fn from_cbor_u8_longlong( data: *const u8, len: c_longlong ) -> 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: static QCborValue QCborValue::fromCbor(const quint8* data, long long len).

source

pub unsafe fn from_json_value( v: impl CastInto<Ref<QJsonValue>> ) -> 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.

Converts the JSON value contained in v into its corresponding CBOR value and returns it. There is no data loss in converting from JSON to CBOR, as the CBOR type set is richer than JSON's. Additionally, values converted to CBOR using this function can be converted back to JSON using toJsonValue() with no data loss.

Calls C++ function: static QCborValue QCborValue::fromJsonValue(const QJsonValue& v).

C++ documentation:

Converts the JSON value contained in v into its corresponding CBOR value and returns it. There is no data loss in converting from JSON to CBOR, as the CBOR type set is richer than JSON’s. Additionally, values converted to CBOR using this function can be converted back to JSON using toJsonValue() with no data loss.

The following table lists the mapping of JSON types to CBOR types:

JSON TypeCBOR Type
BoolBool
NumberInteger (if the number has no fraction and is in the qint64 range) or Double
StringString
ArrayArray
ObjectMap
NullNull

QJsonValue can also be undefined, indicating a previous operation that failed to complete (for example, searching for a key not present in an object). Undefined values are not JSON types and may not appear in JSON arrays and objects, but this function does return the QCborValue undefined value if the corresponding QJsonValue is undefined.

See also toJsonValue(), fromVariant(), QCborArray::fromJsonArray(), and QCborMap::fromJsonObject().

source

pub unsafe fn from_variant( variant: impl CastInto<Ref<QVariant>> ) -> 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.

Converts the QVariant variant into QCborValue and returns it.

Calls C++ function: static QCborValue QCborValue::fromVariant(const QVariant& variant).

C++ documentation:

Converts the QVariant variant into QCborValue and returns it.

QVariants may contain a large list of different meta types, many of which have no corresponding representation in CBOR. That includes all user-defined meta types. When preparing transmission using CBOR, it is suggested to encode carefully each value to prevent loss of representation.

The following table lists the conversion this function will apply:

Qt (C++) typeCBOR type
invalid (QVariant())Undefined
boolBool
std::nullptr_tNull
short, ushort, int, uint, qint64Integer
quint64Integer, but they are cast to qint64 first so values higher than 263-1 (INT64_MAX) will be wrapped to negative
float, doubleDouble
QByteArrayByteArray
QDateTimeDateTime
QCborSimpleTypeSimple type
QJsonArrayArray, converted using QCborArray::formJsonArray()
QJsonDocumentArray or Map
QJsonObjectMap, converted using QCborMap::fromJsonObject()
QJsonValueconverted using fromJsonValue()
QRegularExpressionRegularExpression
QStringString
QStringListArray
QVariantHashMap
QVariantListArray
QVariantMapMap
QUrlUrl
QUuidUuid

For any other types, this function will return Null if the QVariant itself is null, and otherwise will try to convert to string using QVariant::toString(). If the conversion to string fails, this function returns Undefined.

Please note that the conversions via QVariant::toString() are subject to change at any time. QCborValue may be extended in the future to support more types, which will result in a change in how this function performs conversions.

See also toVariant(), fromJsonValue(), QCborArray::toVariantList(), and QCborMap::toVariantMap().

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.

If this QCborValue is a QCborMap, searches elements for the value whose key matches key. If there's no key matching key in the map or if this QCborValue object is not a map, returns the undefined value.

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

C++ documentation:

If this QCborValue is a QCborMap, searches elements for the value whose key matches key. If there’s no key matching key in the map or if this QCborValue object is not a map, returns the undefined value.

This function is equivalent to:

value.toMap().value(key);

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

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 QCborValue::operator[](QLatin1String key) const.

C++ documentation:

This is an overloaded function.

If this QCborValue is a QCborMap, searches elements for the value whose key matches key. If there's no key matching key in the map or if this QCborValue object is not a map, returns the undefined value.

This function is equivalent to:

value.toMap().value(key);

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

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.

If this QCborValue is a QCborMap, searches elements for the value whose key matches key. If this is an array, returns the element whose index is key. If there's no matching value in the array or map, or if this QCborValue object is not an array or map, returns the undefined value.

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

C++ documentation:

If this QCborValue is a QCborMap, searches elements for the value whose key matches key. If this is an array, returns the element whose index is key. If there’s no matching value in the array or map, or if this QCborValue object is not an array or map, returns the undefined value.

See also operator[], QCborMap::operator[], QCborMap::value(), QCborMap::find(), QCborArray::operator[], and QCborArray::at().

source

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

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns a QCborValueRef that can be used to read or modify the entry in this, as a map or array, with the given key. When this QCborValue is a QCborMap or, for 0 <= key < 0x10000, a QCborArray, this function is equivalent to the matching operator[] on that map or array.

Before returning the reference: if this QCborValue was an array but the key is out of range, the array is first converted to a map (so that map[i] is array[i] for each index, i, with valid array[i]); otherwise, if it was not a map it will be over-written with an empty map.

See also operator[], QCborMap::operator[], QCborMap::value(), QCborMap::find(), QCborArray::operator[], and QCborArray::at().

source

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

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns a QCborValueRef that can be used to read or modify the entry in this, as a map, with the given key. When this QCborValue is a QCborMap, this function is equivalent to the matching operator[] on that map.

Before returning the reference: if this QCborValue was an array, it is first converted to a map (so that map[i] is array[i] for each index, i, with valid array[i]); otherwise, if it was not a map it will be over-written with an empty map.

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

source

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

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

Returns a QCborValueRef that can be used to read or modify the entry in this, as a map, with the given key. When this QCborValue is a QCborMap, this function is equivalent to the matching operator[] on that map.

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

C++ documentation:

Returns a QCborValueRef that can be used to read or modify the entry in this, as a map, with the given key. When this QCborValue is a QCborMap, this function is equivalent to the matching operator[] on that map.

Before returning the reference: if this QCborValue was an array, it is first converted to a map (so that map[i] is array[i] for each index, i, with valid array[i]); otherwise, if it was not a map it will be over-written with an empty map.

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

source

pub unsafe fn is_array(&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 QCborValue is of the array type. The array value can be retrieved using toArray().

Calls C++ function: bool QCborValue::isArray() const.

C++ documentation:

Returns true if this QCborValue is of the array type. The array value can be retrieved using toArray().

See also type() and toArray().

source

pub unsafe fn is_bool(&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 QCborValue is a boolean. The value can be retrieved using toBool().

Calls C++ function: bool QCborValue::isBool() const.

C++ documentation:

Returns true if this QCborValue is a boolean. The value can be retrieved using toBool().

See also type(), toBool(), isTrue(), and isFalse().

source

pub unsafe fn is_byte_array(&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 QCborValue is of the byte array type. The byte array value can be retrieved using toByteArray().

Calls C++ function: bool QCborValue::isByteArray() const.

C++ documentation:

Returns true if this QCborValue is of the byte array type. The byte array value can be retrieved using toByteArray().

See also type() and toByteArray().

source

pub unsafe fn is_container(&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.

This convenience function returns true if the QCborValue is either an array or a map.

Calls C++ function: bool QCborValue::isContainer() const.

C++ documentation:

This convenience function returns true if the QCborValue is either an array or a map.

See also isArray() and isMap().

source

pub unsafe fn is_date_time(&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 QCborValue is of the date/time type. The value can be retrieved using toDateTime(). Date/times are extended types that use the tag DateTime.

Calls C++ function: bool QCborValue::isDateTime() const.

C++ documentation:

Returns true if this QCborValue is of the date/time type. The value can be retrieved using toDateTime(). Date/times are extended types that use the tag DateTime.

Additionally, when decoding from a CBOR stream, QCborValue will interpret tags of value UnixTime_t and convert them to the equivalent date/time.

See also type() and toDateTime().

source

pub unsafe fn is_double(&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 QCborValue is of the floating-point type. The value can be retrieved using toDouble().

Calls C++ function: bool QCborValue::isDouble() const.

C++ documentation:

Returns true if this QCborValue is of the floating-point type. The value can be retrieved using toDouble().

See also type() and toDouble().

source

pub unsafe fn is_false(&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 QCborValue is a boolean with false value. This function exists because, internally, CBOR booleans are stored as two separate types, one for true and one for false.

Calls C++ function: bool QCborValue::isFalse() const.

C++ documentation:

Returns true if this QCborValue is a boolean with false value. This function exists because, internally, CBOR booleans are stored as two separate types, one for true and one for false.

See also type(), isBool(), isTrue(), and toBool().

source

pub unsafe fn is_integer(&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 QCborValue is of the integer type. The integer value can be retrieved using toInteger().

Calls C++ function: bool QCborValue::isInteger() const.

C++ documentation:

Returns true if this QCborValue is of the integer type. The integer value can be retrieved using toInteger().

See also type() and toInteger().

source

pub unsafe fn is_invalid(&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 QCborValue is not of any valid type. Invalid QCborValues are distinct from those with undefined values and they usually represent a decoding error.

Calls C++ function: bool QCborValue::isInvalid() const.

C++ documentation:

Returns true if this QCborValue is not of any valid type. Invalid QCborValues are distinct from those with undefined values and they usually represent a decoding error.

See also isUndefined() and isNull().

source

pub unsafe fn is_map(&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 QCborValue is of the map type. The map value can be retrieved using toMap().

Calls C++ function: bool QCborValue::isMap() const.

C++ documentation:

Returns true if this QCborValue is of the map type. The map value can be retrieved using toMap().

See also type() and toMap().

source

pub unsafe fn is_null(&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 QCborValue is of the null type.

Calls C++ function: bool QCborValue::isNull() const.

C++ documentation:

Returns true if this QCborValue is of the null type.

CBOR null values are used to indicate optional values that were not provided. They are distinct from undefined values, in that null values are usually not the result of an earlier error or problem.

Null values are distinct from undefined values and from invalid QCborValue objects. The API will not create invalid QCborValues, but they may exist as a result of a parsing error.

See also type(), isUndefined(), and isInvalid().

source

pub unsafe fn is_regular_expression(&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 QCborValue contains a regular expression's pattern. The pattern can be retrieved using toRegularExpression().

Calls C++ function: bool QCborValue::isRegularExpression() const.

C++ documentation:

Returns true if this QCborValue contains a regular expression’s pattern. The pattern can be retrieved using toRegularExpression().

See also type() and toRegularExpression().

source

pub unsafe fn is_simple_type_0a(&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 QCborValue is of one of the CBOR simple types. The type itself can later be retrieved using type(), even for types that don't have an enumeration in the API. They can also be checked with the isSimpleType(QCborSimpleType) overload.

Calls C++ function: bool QCborValue::isSimpleType() const.

C++ documentation:

Returns true if this QCborValue is of one of the CBOR simple types. The type itself can later be retrieved using type(), even for types that don’t have an enumeration in the API. They can also be checked with the isSimpleType(QCborSimpleType) overload.

See also QCborSimpleType, isSimpleType(QCborSimpleType), and toSimpleType().

source

pub unsafe fn is_simple_type_1a(&self, st: QCborSimpleType) -> 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 QCborValue::isSimpleType(QCborSimpleType st) const.

C++ documentation:

This is an overloaded function.

Returns true if this QCborValue is of a simple type and toSimpleType() would return st, false otherwise. This function can be used to check for any CBOR simple type, even those for which there is no enumeration in the API. For example, for the simple type of value 12, you could write:

value.isSimpleType(QCborSimpleType(12));

See also QCborValue::QCborValue(QCborSimpleType), isSimpleType(), isFalse(), isTrue(), isNull, isUndefined(), and toSimpleType().

source

pub unsafe fn is_string(&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 QCborValue is of the string type. The string value can be retrieved using toString().

Calls C++ function: bool QCborValue::isString() const.

C++ documentation:

Returns true if this QCborValue is of the string type. The string value can be retrieved using toString().

See also type() and toString().

source

pub unsafe fn is_tag(&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 QCborValue is of the tag type. The tag value can be retrieved using tag() and the tagged value using taggedValue().

Calls C++ function: bool QCborValue::isTag() const.

C++ documentation:

Returns true if this QCborValue is of the tag type. The tag value can be retrieved using tag() and the tagged value using taggedValue().

This function also returns true for extended types that the API recognizes. For code that handles extended types directly before the Qt API is updated to support them, it is possible to recreate the tag + tagged value pair by using taggedValue().

See also type(), tag(), taggedValue(), and taggedValue().

source

pub unsafe fn is_true(&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 QCborValue is a boolean with true value. This function exists because, internally, CBOR booleans are stored as two separate types, one for false and one for true.

Calls C++ function: bool QCborValue::isTrue() const.

C++ documentation:

Returns true if this QCborValue is a boolean with true value. This function exists because, internally, CBOR booleans are stored as two separate types, one for false and one for true.

See also type(), isBool(), isFalse(), and toBool().

source

pub unsafe fn is_undefined(&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 QCborValue is of the undefined type.

Calls C++ function: bool QCborValue::isUndefined() const.

C++ documentation:

Returns true if this QCborValue is of the undefined type.

CBOR undefined values are used to indicate missing information, usually as a result of a previous operation that did not complete as expected. They are also used by the QCborArray and QCborMap API to indicate the searched item was not found.

Undefined values are distinct from null values.

QCborValue objects with undefined values are also different from invalid QCborValue objects. The API will not create invalid QCborValues, but they may exist as a result of a parsing error.

See also type(), isNull(), and isInvalid().

source

pub unsafe fn is_url(&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 QCborValue is of the URL type. The URL value can be retrieved using toUrl().

Calls C++ function: bool QCborValue::isUrl() const.

C++ documentation:

Returns true if this QCborValue is of the URL type. The URL value can be retrieved using toUrl().

See also type() and toUrl().

source

pub unsafe fn is_uuid(&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 QCborValue contains a UUID. The value can be retrieved using toUuid().

Calls C++ function: bool QCborValue::isUuid() const.

C++ documentation:

Returns true if this QCborValue contains a UUID. The value can be retrieved using toUuid().

See also type() and toUuid().

source

pub unsafe fn new() -> 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.

Creates a QCborValue of the Undefined type.

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

C++ documentation:

Creates a QCborValue of the Undefined type.

CBOR undefined values are used to indicate missing information, usually as a result of a previous operation that did not complete as expected. They are also used by the QCborArray and QCborMap API to indicate the searched item was not found.

Undefined values are represented by the Undefined simple type. Because of that, QCborValues with undefined values will also return true for isSimpleType() and isSimpleType(QCborSimpleType::Undefined).

Undefined values are different from null values.

QCborValue objects with undefined values are also different from invalid QCborValue objects. The API will not create invalid QCborValues, but they may exist as a result of a parsing error.

See also isUndefined(), isNull(), and isSimpleType().

source

pub unsafe fn from_type(t: Type) -> 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.

Creates a QCborValue of type t_. The value associated with such a type (if any) will be default constructed.

Calls C++ function: [constructor] void QCborValue::QCborValue(QCborValue::Type t_).

C++ documentation:

Creates a QCborValue of type t_. The value associated with such a type (if any) will be default constructed.

See also type().

source

pub unsafe fn from_bool(b: bool) -> 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.

Creates a QCborValue with boolean value b. The value can later be retrieved using toBool().

Calls C++ function: [constructor] void QCborValue::QCborValue(bool b_).

C++ documentation:

Creates a QCborValue with boolean value b. The value can later be retrieved using toBool().

Internally, CBOR booleans are represented by a pair of types, one for true and one for false. For that reason, boolean QCborValues will return true for isSimpleType() and one of isSimpleType(QCborSimpleType::False) or isSimpleType(QCborSimpleType::True).

See also toBool(), isBool(), isTrue(), isFalse(), and isSimpleType().

source

pub unsafe fn from_int(i: c_int) -> 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: [constructor] void QCborValue::QCborValue(int i).

source

pub unsafe fn from_uint(u: c_uint) -> 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: [constructor] void QCborValue::QCborValue(unsigned int u).

source

pub unsafe fn from_i64(i: 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.

Creates a QCborValue with integer value i. The value can later be retrieved using toInteger().

Calls C++ function: [constructor] void QCborValue::QCborValue(qint64 i).

C++ documentation:

Creates a QCborValue with integer value i. The value can later be retrieved using toInteger().

CBOR integer values are distinct from floating point values. Therefore, QCborValue objects with integers will compare differently to QCborValue objects containing floating-point, even if the values contained in the objects are equivalent.

See also toInteger(), isInteger(), and isDouble().

source

pub unsafe fn from_double(v: c_double) -> 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.

Creates a QCborValue with floating point value d. The value can later be retrieved using toDouble().

Calls C++ function: [constructor] void QCborValue::QCborValue(double v).

C++ documentation:

Creates a QCborValue with floating point value d. The value can later be retrieved using toDouble().

CBOR floating point values are distinct from integer values. Therefore, QCborValue objects with integers will compare differently to QCborValue objects containing floating-point, even if the values contained in the objects are equivalent.

See also toDouble(), isDouble(), and isInteger().

source

pub unsafe fn from_q_cbor_simple_type(st: QCborSimpleType) -> 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.

Creates a QCborValue of simple type st. The type can later later be retrieved using toSimpleType() as well as isSimpleType(st).

Calls C++ function: [constructor] void QCborValue::QCborValue(QCborSimpleType st).

C++ documentation:

Creates a QCborValue of simple type st. The type can later later be retrieved using toSimpleType() as well as isSimpleType(st).

CBOR simple types are types that do not have any associated value, like C++'s std::nullptr_t type, whose only possible value is nullptr.

If st is QCborSimpleType::Null, the resulting QCborValue will be of the Null type and similarly for QCborSimpleType::Undefined. If st is QCborSimpleType::False or QCborSimpleType::True, the created QCborValue will be a boolean containing a value of false or true, respectively.

This function can be used with simple types not defined in the API. For example, to create a QCborValue with simple type 12, one could write:

QCborValue value(QCborSimpleType(12));

Simple types should not be used until a specification for them has been published, since other implementations may not support them properly. Simple type values 24 to 31 are reserved and must not be used.

isSimpleType(), isNull(), isUndefined(), isTrue(), isFalse()

source

pub unsafe fn from_q_byte_array( ba: impl CastInto<Ref<QByteArray>> ) -> 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.

Creates a QCborValue with byte array value ba. The value can later be retrieved using toByteArray().

Calls C++ function: [constructor] void QCborValue::QCborValue(const QByteArray& ba).

C++ documentation:

Creates a QCborValue with byte array value ba. The value can later be retrieved using toByteArray().

See also toByteArray(), isByteArray(), and isString().

source

pub unsafe fn from_q_string( s: 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.

Creates a QCborValue with string value s. The value can later be retrieved using toString().

Calls C++ function: [constructor] void QCborValue::QCborValue(const QString& s).

C++ documentation:

Creates a QCborValue with string value s. The value can later be retrieved using toString().

See also toString(), isString(), and isByteArray().

source

pub unsafe fn from_q_latin1_string( s: 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: [constructor] void QCborValue::QCborValue(QLatin1String s).

C++ documentation:

This is an overloaded function.

Creates a QCborValue with string value s. The value can later be retrieved using toString().

See also toString(), isString(), and isByteArray().

source

pub unsafe fn from_char(s: *const c_char) -> 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.

Default constructs an instance of QCborValue.

Calls C++ function: [constructor] void QCborValue::QCborValue(const char* s).

C++ documentation:

Default constructs an instance of QCborValue.

source

pub unsafe fn from_q_cbor_array( a: impl CastInto<Ref<QCborArray>> ) -> 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: [constructor] void QCborValue::QCborValue(const QCborArray& a).

source

pub unsafe fn from_q_cbor_map( m: impl CastInto<Ref<QCborMap>> ) -> 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: [constructor] void QCborValue::QCborValue(const QCborMap& m).

source

pub unsafe fn from_q_cbor_tag_q_cbor_value( tag: QCborTag, tagged_value: 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.

Calls C++ function: [constructor] void QCborValue::QCborValue(QCborTag tag, const QCborValue& taggedValue = …).

source

pub unsafe fn from_q_cbor_known_tags_q_cbor_value( t: QCborKnownTags, tv: 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.

Calls C++ function: [constructor] void QCborValue::QCborValue(QCborKnownTags t_, const QCborValue& tv = …).

source

pub unsafe fn from_q_date_time( dt: impl CastInto<Ref<QDateTime>> ) -> 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.

Creates a QCborValue object of the date/time extended type and containing the value represented by dt. The value can later be retrieved using toDateTime().

Calls C++ function: [constructor] void QCborValue::QCborValue(const QDateTime& dt).

C++ documentation:

Creates a QCborValue object of the date/time extended type and containing the value represented by dt. The value can later be retrieved using toDateTime().

The CBOR date/time types are extension types using tags: either a string (in ISO date format) tagged as a DateTime or a number (of seconds since the start of 1970, UTC) tagged as a UnixTime_t. When parsing CBOR streams, QCborValue will convert UnixTime_t to the string-based type.

See also toDateTime(), isDateTime(), and taggedValue().

source

pub unsafe fn from_q_url(url: impl CastInto<Ref<QUrl>>) -> 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.

Creates a QCborValue object of the URL extended type and containing the value represented by url. The value can later be retrieved using toUrl().

Calls C++ function: [constructor] void QCborValue::QCborValue(const QUrl& url).

C++ documentation:

Creates a QCborValue object of the URL extended type and containing the value represented by url. The value can later be retrieved using toUrl().

The CBOR URL type is an extended type represented by a string tagged as an Url.

See also toUrl(), isUrl(), and taggedValue().

source

pub unsafe fn from_q_regular_expression( rx: impl CastInto<Ref<QRegularExpression>> ) -> 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.

Creates a QCborValue object of the regular expression pattern extended type and containing the value represented by rx. The value can later be retrieved using toRegularExpression().

Calls C++ function: [constructor] void QCborValue::QCborValue(const QRegularExpression& rx).

C++ documentation:

Creates a QCborValue object of the regular expression pattern extended type and containing the value represented by rx. The value can later be retrieved using toRegularExpression().

The CBOR regular expression type is an extended type represented by a string tagged as an RegularExpression. Note that CBOR regular expressions only store the patterns, so any flags that the QRegularExpression object may carry will be lost.

See also toRegularExpression(), isRegularExpression(), and taggedValue().

source

pub unsafe fn from_q_uuid(uuid: impl CastInto<Ref<QUuid>>) -> 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.

Creates a QCborValue object of the UUID extended type and containing the value represented by uuid. The value can later be retrieved using toUuid().

Calls C++ function: [constructor] void QCborValue::QCborValue(const QUuid& uuid).

C++ documentation:

Creates a QCborValue object of the UUID extended type and containing the value represented by uuid. The value can later be retrieved using toUuid().

The CBOR UUID type is an extended type represented by a byte array tagged as an Uuid.

See also toUuid(), isUuid(), and taggedValue().

source

pub unsafe fn from_q_cbor_tag(tag: QCborTag) -> 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: [constructor] void QCborValue::QCborValue(QCborTag tag).

source

pub unsafe fn from_q_cbor_known_tags(t: QCborKnownTags) -> 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: [constructor] void QCborValue::QCborValue(QCborKnownTags t_).

source

pub unsafe fn from_q_string_view( s: impl CastInto<Ref<QStringView>> ) -> CppBox<QCborValue>

Available on cpp_lib_version="5.14.0" only.

Creates a QCborValue with string value s. The value can later be retrieved using toString().

Calls C++ function: [constructor] void QCborValue::QCborValue(QStringView s).

C++ documentation:

Creates a QCborValue with string value s. The value can later be retrieved using toString().

See also toString(), isString(), and isByteArray().

source

pub unsafe fn new_copy( other: 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.

Copies the contents of other into this object.

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

C++ documentation:

Copies the contents of other into this object.

source

pub unsafe fn static_meta_object() -> Ref<QMetaObject>

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 reference to the staticMetaObject field.

source

pub unsafe fn swap(&self, other: 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.

Swaps the contents of this QCborValue object and other.

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

C++ documentation:

Swaps the contents of this QCborValue object and other.

source

pub unsafe fn tag_1a(&self, default_value: QCborTag) -> QCborTag

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 tag of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

Calls C++ function: QCborTag QCborValue::tag(QCborTag defaultValue = …) const.

C++ documentation:

Returns the tag of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

CBOR represents extended types by associating a number (the tag) with a stored representation. This function returns that number. To retrieve the representation, use taggedValue().

See also isTag(), taggedValue(), isDateTime(), isUrl(), isRegularExpression(), and isUuid().

source

pub unsafe fn tag_0a(&self) -> QCborTag

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 tag of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

Calls C++ function: QCborTag QCborValue::tag() const.

C++ documentation:

Returns the tag of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

CBOR represents extended types by associating a number (the tag) with a stored representation. This function returns that number. To retrieve the representation, use taggedValue().

See also isTag(), taggedValue(), isDateTime(), isUrl(), isRegularExpression(), and isUuid().

source

pub unsafe fn tagged_value_1a( &self, default_value: 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 tagged value of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

Calls C++ function: QCborValue QCborValue::taggedValue(const QCborValue& defaultValue = …) const.

C++ documentation:

Returns the tagged value of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

CBOR represents extended types by associating a number (the tag) with a stored representation. This function returns that representation. To retrieve the tag, use tag().

See also isTag(), tag(), isDateTime(), isUrl(), isRegularExpression(), and isUuid().

source

pub unsafe fn tagged_value_0a(&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.

Returns the tagged value of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

Calls C++ function: QCborValue QCborValue::taggedValue() const.

C++ documentation:

Returns the tagged value of this extended QCborValue object, if it is of the tag type, defaultValue otherwise.

CBOR represents extended types by associating a number (the tag) with a stored representation. This function returns that representation. To retrieve the tag, use tag().

See also isTag(), tag(), isDateTime(), isUrl(), isRegularExpression(), and isUuid().

source

pub unsafe fn to_array_0a(&self) -> CppBox<QCborArray>

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 array value stored in this QCborValue, if it is of the array type. Otherwise, it returns defaultValue.

Calls C++ function: QCborArray QCborValue::toArray() const.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QCborArray QCborValue::toArray(const QCborArray &defaultValue) const:

Returns the array value stored in this QCborValue, if it is of the array type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QCborArray.

See also isArray(), isByteArray(), isMap(), isContainer(), and toMap().

source

pub unsafe fn to_array_1a( &self, default_value: impl CastInto<Ref<QCborArray>> ) -> CppBox<QCborArray>

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 array value stored in this QCborValue, if it is of the array type. Otherwise, it returns defaultValue.

Calls C++ function: QCborArray QCborValue::toArray(const QCborArray& defaultValue) const.

C++ documentation:

Returns the array value stored in this QCborValue, if it is of the array type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QCborArray.

See also isArray(), isByteArray(), isMap(), isContainer(), and toMap().

source

pub unsafe fn to_bool_1a(&self, default_value: bool) -> 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 the boolean value stored in this QCborValue, if it is of a boolean type. Otherwise, it returns defaultValue.

Calls C++ function: bool QCborValue::toBool(bool defaultValue = …) const.

C++ documentation:

Returns the boolean value stored in this QCborValue, if it is of a boolean type. Otherwise, it returns defaultValue.

See also isBool(), isTrue(), and isFalse().

source

pub unsafe fn to_bool_0a(&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 the boolean value stored in this QCborValue, if it is of a boolean type. Otherwise, it returns defaultValue.

Calls C++ function: bool QCborValue::toBool() const.

C++ documentation:

Returns the boolean value stored in this QCborValue, if it is of a boolean type. Otherwise, it returns defaultValue.

See also isBool(), isTrue(), and isFalse().

source

pub unsafe fn to_byte_array_1a( &self, default_value: impl CastInto<Ref<QByteArray>> ) -> CppBox<QByteArray>

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 byte array value stored in this QCborValue, if it is of the byte array type. Otherwise, it returns defaultValue.

Calls C++ function: QByteArray QCborValue::toByteArray(const QByteArray& defaultValue = …) const.

C++ documentation:

Returns the byte array value stored in this QCborValue, if it is of the byte array type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QByteArray.

See also isByteArray(), isString(), and toString().

source

pub unsafe fn to_byte_array_0a(&self) -> CppBox<QByteArray>

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 byte array value stored in this QCborValue, if it is of the byte array type. Otherwise, it returns defaultValue.

Calls C++ function: QByteArray QCborValue::toByteArray() const.

C++ documentation:

Returns the byte array value stored in this QCborValue, if it is of the byte array type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QByteArray.

See also isByteArray(), isString(), and toString().

source

pub unsafe fn to_cbor_q_flags_encoding_option( &self, opt: QFlags<EncodingOption> ) -> CppBox<QByteArray>

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

Encodes this QCborValue object to its CBOR representation, using the options specified in opt, and return the byte array containing that representation.

Calls C++ function: QByteArray QCborValue::toCbor(QFlags<QCborValue::EncodingOption> opt = …).

C++ documentation:

Encodes this QCborValue object to its CBOR representation, using the options specified in opt, and return the byte array containing that representation.

This function will not fail, except if this QCborValue or any of the contained items, if this is a map or array, are invalid. Invalid types are not produced normally by the API, but can result from decoding errors.

By default, this function performs no transformation on the values in the QCborValue, writing all floating point directly as double-precision (double) types. If the UseFloat option is specified, it will use single precision (float) for any floating point value for which there's no loss of precision in using that representation. That includes infinities and NaN values.

Similarly, if UseFloat16 is specified, this function will try to use half-precision (qfloat16) floating point if the conversion to that results in no loss of precision. This is always true for infinities and NaN.

If UseIntegers is specified, it will use integers for any floating point value that contains an actual integer.

See also fromCbor(), fromVariant(), and fromJsonValue().

source

pub unsafe fn to_cbor_q_cbor_stream_writer_q_flags_encoding_option( &self, writer: impl CastInto<Ref<QCborStreamWriter>>, opt: QFlags<EncodingOption> )

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 QCborValue::toCbor(QCborStreamWriter& writer, QFlags<QCborValue::EncodingOption> opt = …).

C++ documentation:

This is an overloaded function.

Encodes this QCborValue object to its CBOR representation, using the options specified in opt, to the writer specified by writer. The same writer can be used by multiple QCborValues, for example, in order to encode different elements in a larger array.

This function will not fail, except if this QCborValue or any of the contained items, if this is a map or array, are invalid. Invalid types are not produced normally by the API, but can result from decoding errors.

By default, this function performs no transformation on the values in the QCborValue, writing all floating point directly as double-precision (binary64) types. If the UseFloat option is specified, it will use single precision (binary32) for any floating point value for which there's no loss of precision in using that representation. That includes infinities and NaN values.

Similarly, if UseFloat16 is specified, this function will try to use half-precision (binary16) floating point if the conversion to that results in no loss of precision. This is always true for infinities and NaN.

If UseIntegers is specified, it will use integers for any floating point value that contains an actual integer.

See also fromCbor(), fromVariant(), and fromJsonValue().

source

pub unsafe fn to_cbor(&self) -> CppBox<QByteArray>

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

Encodes this QCborValue object to its CBOR representation, using the options specified in opt, and return the byte array containing that representation.

Calls C++ function: QByteArray QCborValue::toCbor().

C++ documentation:

Encodes this QCborValue object to its CBOR representation, using the options specified in opt, and return the byte array containing that representation.

This function will not fail, except if this QCborValue or any of the contained items, if this is a map or array, are invalid. Invalid types are not produced normally by the API, but can result from decoding errors.

By default, this function performs no transformation on the values in the QCborValue, writing all floating point directly as double-precision (double) types. If the UseFloat option is specified, it will use single precision (float) for any floating point value for which there's no loss of precision in using that representation. That includes infinities and NaN values.

Similarly, if UseFloat16 is specified, this function will try to use half-precision (qfloat16) floating point if the conversion to that results in no loss of precision. This is always true for infinities and NaN.

If UseIntegers is specified, it will use integers for any floating point value that contains an actual integer.

See also fromCbor(), fromVariant(), and fromJsonValue().

source

pub unsafe fn to_cbor_q_cbor_stream_writer( &self, writer: impl CastInto<Ref<QCborStreamWriter>> )

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 QCborValue::toCbor(QCborStreamWriter& writer).

C++ documentation:

This is an overloaded function.

Encodes this QCborValue object to its CBOR representation, using the options specified in opt, to the writer specified by writer. The same writer can be used by multiple QCborValues, for example, in order to encode different elements in a larger array.

This function will not fail, except if this QCborValue or any of the contained items, if this is a map or array, are invalid. Invalid types are not produced normally by the API, but can result from decoding errors.

By default, this function performs no transformation on the values in the QCborValue, writing all floating point directly as double-precision (binary64) types. If the UseFloat option is specified, it will use single precision (binary32) for any floating point value for which there's no loss of precision in using that representation. That includes infinities and NaN values.

Similarly, if UseFloat16 is specified, this function will try to use half-precision (binary16) floating point if the conversion to that results in no loss of precision. This is always true for infinities and NaN.

If UseIntegers is specified, it will use integers for any floating point value that contains an actual integer.

See also fromCbor(), fromVariant(), and fromJsonValue().

source

pub unsafe fn to_date_time_1a( &self, default_value: impl CastInto<Ref<QDateTime>> ) -> CppBox<QDateTime>

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 date/time value stored in this QCborValue, if it is of the date/time extended type. Otherwise, it returns defaultValue.

Calls C++ function: QDateTime QCborValue::toDateTime(const QDateTime& defaultValue = …) const.

C++ documentation:

Returns the date/time value stored in this QCborValue, if it is of the date/time extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QDateTime.

See also isDateTime(), isTag(), and taggedValue().

source

pub unsafe fn to_date_time_0a(&self) -> CppBox<QDateTime>

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 date/time value stored in this QCborValue, if it is of the date/time extended type. Otherwise, it returns defaultValue.

Calls C++ function: QDateTime QCborValue::toDateTime() const.

C++ documentation:

Returns the date/time value stored in this QCborValue, if it is of the date/time extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QDateTime.

See also isDateTime(), isTag(), and taggedValue().

source

pub unsafe fn to_diagnostic_notation_1a( &self, opts: QFlags<DiagnosticNotationOption> ) -> CppBox<QString>

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

Creates the diagnostic notation equivalent of this CBOR object and returns it. The opts parameter controls the dialect of the notation. Diagnostic notation is useful in debugging, to aid the developer in understanding what value is stored in the QCborValue or in a CBOR stream. For that reason, the Qt API provides no support for parsing the diagnostic back into the in-memory format or CBOR stream, though the representation is unique and it would be possible.

Calls C++ function: QString QCborValue::toDiagnosticNotation(QFlags<QCborValue::DiagnosticNotationOption> opts = …) const.

C++ documentation:

Creates the diagnostic notation equivalent of this CBOR object and returns it. The opts parameter controls the dialect of the notation. Diagnostic notation is useful in debugging, to aid the developer in understanding what value is stored in the QCborValue or in a CBOR stream. For that reason, the Qt API provides no support for parsing the diagnostic back into the in-memory format or CBOR stream, though the representation is unique and it would be possible.

CBOR diagnostic notation is specified by section 6 of RFC 7049. It is a text representation of the CBOR stream and it is very similar to JSON, but it supports the CBOR types not found in JSON. The extended format enabled by the ExtendedFormat flag is currently in some IETF drafts and its format is subject to change.

This function produces the equivalent representation of the stream that toCbor() would produce, without any transformation option provided there. This also implies this function may not produce a representation of the stream that was used to create the object, if it was created using fromCbor(), as that function may have applied transformations. For a high-fidelity notation of a stream, without transformation, see the cbordump example.

See also toCbor() and QJsonDocument::toJson().

source

pub unsafe fn to_diagnostic_notation_0a(&self) -> CppBox<QString>

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

Creates the diagnostic notation equivalent of this CBOR object and returns it. The opts parameter controls the dialect of the notation. Diagnostic notation is useful in debugging, to aid the developer in understanding what value is stored in the QCborValue or in a CBOR stream. For that reason, the Qt API provides no support for parsing the diagnostic back into the in-memory format or CBOR stream, though the representation is unique and it would be possible.

Calls C++ function: QString QCborValue::toDiagnosticNotation() const.

C++ documentation:

Creates the diagnostic notation equivalent of this CBOR object and returns it. The opts parameter controls the dialect of the notation. Diagnostic notation is useful in debugging, to aid the developer in understanding what value is stored in the QCborValue or in a CBOR stream. For that reason, the Qt API provides no support for parsing the diagnostic back into the in-memory format or CBOR stream, though the representation is unique and it would be possible.

CBOR diagnostic notation is specified by section 6 of RFC 7049. It is a text representation of the CBOR stream and it is very similar to JSON, but it supports the CBOR types not found in JSON. The extended format enabled by the ExtendedFormat flag is currently in some IETF drafts and its format is subject to change.

This function produces the equivalent representation of the stream that toCbor() would produce, without any transformation option provided there. This also implies this function may not produce a representation of the stream that was used to create the object, if it was created using fromCbor(), as that function may have applied transformations. For a high-fidelity notation of a stream, without transformation, see the cbordump example.

See also toCbor() and QJsonDocument::toJson().

source

pub unsafe fn to_double_1a(&self, default_value: c_double) -> c_double

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 floating point value stored in this QCborValue, if it is of the Double type. If it is of the Integer type, this function returns the integer value converted to double. In any other case, it returns defaultValue.

Calls C++ function: double QCborValue::toDouble(double defaultValue = …) const.

C++ documentation:

Returns the floating point value stored in this QCborValue, if it is of the Double type. If it is of the Integer type, this function returns the integer value converted to double. In any other case, it returns defaultValue.

See also isDouble(), isInteger(), and toInteger().

source

pub unsafe fn to_double_0a(&self) -> c_double

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 floating point value stored in this QCborValue, if it is of the Double type. If it is of the Integer type, this function returns the integer value converted to double. In any other case, it returns defaultValue.

Calls C++ function: double QCborValue::toDouble() const.

C++ documentation:

Returns the floating point value stored in this QCborValue, if it is of the Double type. If it is of the Integer type, this function returns the integer value converted to double. In any other case, it returns defaultValue.

See also isDouble(), isInteger(), and toInteger().

source

pub unsafe fn to_integer_1a(&self, default_value: i64) -> i64

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 integer value stored in this QCborValue, if it is of the integer type. If it is of the Double type, this function returns the floating point value converted to integer. In any other case, it returns defaultValue.

Calls C++ function: qint64 QCborValue::toInteger(qint64 defaultValue = …) const.

C++ documentation:

Returns the integer value stored in this QCborValue, if it is of the integer type. If it is of the Double type, this function returns the floating point value converted to integer. In any other case, it returns defaultValue.

See also isInteger(), isDouble(), and toDouble().

source

pub unsafe fn to_integer_0a(&self) -> i64

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 integer value stored in this QCborValue, if it is of the integer type. If it is of the Double type, this function returns the floating point value converted to integer. In any other case, it returns defaultValue.

Calls C++ function: qint64 QCborValue::toInteger() const.

C++ documentation:

Returns the integer value stored in this QCborValue, if it is of the integer type. If it is of the Double type, this function returns the floating point value converted to integer. In any other case, it returns defaultValue.

See also isInteger(), isDouble(), and toDouble().

source

pub unsafe fn to_json_value(&self) -> CppBox<QJsonValue>

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

Converts this QCborValue object to an equivalent representation in JSON and returns it as a QJsonValue.

Calls C++ function: QJsonValue QCborValue::toJsonValue() const.

C++ documentation:

Converts this QCborValue object to an equivalent representation in JSON and returns it as a QJsonValue.

Please note that CBOR contains a richer and wider type set than JSON, so some information may be lost in this conversion. The following table compares CBOR types to JSON types and indicates whether information may be lost or not.

CBOR TypeJSON TypeComments
BoolBoolNo data loss possible
DoubleNumberInfinities and NaN will be converted to Null; no data loss for other values
IntegerNumberData loss possible in the conversion if the integer is larger than 253 or smaller than -253.
NullNullNo data loss possible
UndefinedNullType information lost
StringStringNo data loss possible
Byte ArrayStringConverted to a lossless encoding like Base64url, but the distinction between strings and byte arrays is lost
Other simple typesStringType information lost
ArrayArrayConversion applies to each contained value
MapObjectKeys are converted to string; values converted according to this table
Tags and extended typesSpecialThe tag number itself is lost and the tagged value is converted to JSON

For information on the conversion of CBOR map keys to string, see QCborMap::toJsonObject().

If this QCborValue contains the undefined value, this function will return an undefined QJsonValue too. Note that JSON does not support undefined values and undefined QJsonValues are an extension to the specification. They cannot be held in a QJsonArray or QJsonObject, but can be returned from functions to indicate a failure. For all other intents and purposes, they are the same as null.

Special handling of tags and extended types

Some tags are handled specially and change the transformation of the tagged value from CBOR to JSON. The following table lists those special cases:

TagCBOR typeTransformation
ExpectedBase64urlByte arrayEncodes the byte array as Base64url
ExpectedBase64Byte arrayEncodes the byte array as Base64
ExpectedBase16Byte arrayEncodes the byte array as hex
UrlUrl and StringUses QUrl::toEncoded() to normalize the encoding to the URL's fully encoded format
UuidUuid and Byte arrayUses QUuid::toString() to create the string representation

See also fromJsonValue(), toVariant(), QCborArray::toJsonArray(), and QCborMap::toJsonObject().

source

pub unsafe fn to_map_0a(&self) -> 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.

Returns the map value stored in this QCborValue, if it is of the map type. Otherwise, it returns defaultValue.

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

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QCborMap QCborValue::toMap(const QCborMap &defaultValue) const:

Returns the map value stored in this QCborValue, if it is of the map type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QCborMap.

See also isMap(), isArray(), isContainer(), and toArray().

source

pub unsafe fn to_map_1a( &self, default_value: 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.

Returns the map value stored in this QCborValue, if it is of the map type. Otherwise, it returns defaultValue.

Calls C++ function: QCborMap QCborValue::toMap(const QCborMap& defaultValue) const.

C++ documentation:

Returns the map value stored in this QCborValue, if it is of the map type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QCborMap.

See also isMap(), isArray(), isContainer(), and toArray().

source

pub unsafe fn to_regular_expression_1a( &self, default_value: impl CastInto<Ref<QRegularExpression>> ) -> CppBox<QRegularExpression>

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 regular expression value stored in this QCborValue, if it is of the regular expression pattern extended type. Otherwise, it returns defaultValue.

Calls C++ function: QRegularExpression QCborValue::toRegularExpression(const QRegularExpression& defaultValue = …) const.

C++ documentation:

Returns the regular expression value stored in this QCborValue, if it is of the regular expression pattern extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QRegularExpression.

See also isRegularExpression(), isTag(), and taggedValue().

source

pub unsafe fn to_regular_expression_0a(&self) -> CppBox<QRegularExpression>

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 regular expression value stored in this QCborValue, if it is of the regular expression pattern extended type. Otherwise, it returns defaultValue.

Calls C++ function: QRegularExpression QCborValue::toRegularExpression() const.

C++ documentation:

Returns the regular expression value stored in this QCborValue, if it is of the regular expression pattern extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QRegularExpression.

See also isRegularExpression(), isTag(), and taggedValue().

source

pub unsafe fn to_simple_type_1a( &self, default_value: QCborSimpleType ) -> QCborSimpleType

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 simple type this QCborValue is of, if it is a simple type. If it is not a simple type, it returns defaultValue.

Calls C++ function: QCborSimpleType QCborValue::toSimpleType(QCborSimpleType defaultValue = …) const.

C++ documentation:

Returns the simple type this QCborValue is of, if it is a simple type. If it is not a simple type, it returns defaultValue.

The following types are simple types and this function will return the listed values:

QCborValue::FalseQCborSimpleType::False
QCborValue::TrueQCborSimpleType::True
QCborValue::NullQCborSimpleType::Null
QCborValue::UndefinedQCborSimpleType::Undefined

See also type(), isSimpleType(), isBool(), isTrue(), isFalse(), isTrue(), isNull(), and isUndefined().

source

pub unsafe fn to_simple_type_0a(&self) -> QCborSimpleType

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 simple type this QCborValue is of, if it is a simple type. If it is not a simple type, it returns defaultValue.

Calls C++ function: QCborSimpleType QCborValue::toSimpleType() const.

C++ documentation:

Returns the simple type this QCborValue is of, if it is a simple type. If it is not a simple type, it returns defaultValue.

The following types are simple types and this function will return the listed values:

QCborValue::FalseQCborSimpleType::False
QCborValue::TrueQCborSimpleType::True
QCborValue::NullQCborSimpleType::Null
QCborValue::UndefinedQCborSimpleType::Undefined

See also type(), isSimpleType(), isBool(), isTrue(), isFalse(), isTrue(), isNull(), and isUndefined().

source

pub unsafe fn to_string_1a( &self, default_value: impl CastInto<Ref<QString>> ) -> CppBox<QString>

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 string value stored in this QCborValue, if it is of the string type. Otherwise, it returns defaultValue.

Calls C++ function: QString QCborValue::toString(const QString& defaultValue = …) const.

C++ documentation:

Returns the string value stored in this QCborValue, if it is of the string type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QString.

See also isString(), isByteArray(), and toByteArray().

source

pub unsafe fn to_string_0a(&self) -> CppBox<QString>

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 string value stored in this QCborValue, if it is of the string type. Otherwise, it returns defaultValue.

Calls C++ function: QString QCborValue::toString() const.

C++ documentation:

Returns the string value stored in this QCborValue, if it is of the string type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QString.

See also isString(), isByteArray(), and toByteArray().

source

pub unsafe fn to_url_1a( &self, default_value: impl CastInto<Ref<QUrl>> ) -> CppBox<QUrl>

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 URL value stored in this QCborValue, if it is of the URL extended type. Otherwise, it returns defaultValue.

Calls C++ function: QUrl QCborValue::toUrl(const QUrl& defaultValue = …) const.

C++ documentation:

Returns the URL value stored in this QCborValue, if it is of the URL extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QUrl.

See also isUrl(), isTag(), and taggedValue().

source

pub unsafe fn to_url_0a(&self) -> CppBox<QUrl>

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 URL value stored in this QCborValue, if it is of the URL extended type. Otherwise, it returns defaultValue.

Calls C++ function: QUrl QCborValue::toUrl() const.

C++ documentation:

Returns the URL value stored in this QCborValue, if it is of the URL extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QUrl.

See also isUrl(), isTag(), and taggedValue().

source

pub unsafe fn to_uuid_1a( &self, default_value: impl CastInto<Ref<QUuid>> ) -> CppBox<QUuid>

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 UUID value stored in this QCborValue, if it is of the UUID extended type. Otherwise, it returns defaultValue.

Calls C++ function: QUuid QCborValue::toUuid(const QUuid& defaultValue = …) const.

C++ documentation:

Returns the UUID value stored in this QCborValue, if it is of the UUID extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QUuid.

See also isUuid(), isTag(), and taggedValue().

source

pub unsafe fn to_uuid_0a(&self) -> CppBox<QUuid>

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 UUID value stored in this QCborValue, if it is of the UUID extended type. Otherwise, it returns defaultValue.

Calls C++ function: QUuid QCborValue::toUuid() const.

C++ documentation:

Returns the UUID value stored in this QCborValue, if it is of the UUID extended type. Otherwise, it returns defaultValue.

Note that this function performs no conversion from other types to QUuid.

See also isUuid(), isTag(), and taggedValue().

source

pub unsafe fn to_variant(&self) -> CppBox<QVariant>

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

Converts this value to a native Qt type and returns the corresponding QVariant.

Calls C++ function: QVariant QCborValue::toVariant() const.

C++ documentation:

Converts this value to a native Qt type and returns the corresponding QVariant.

The following table lists the mapping performed between QCborValue types and Qt meta types.

CBOR TypeQt or C++ typeNotes
Integerqint64
Doubledouble
Boolbool
Nullstd::nullptr_t
Undefinedno type (QVariant())
Byte arrayQByteArray
StringQString
ArrayQVariantListRecursively converts all values
MapQVariantMapKey types are "stringified"
Other simple typesQCborSimpleType
DateTimeQDateTime
UrlQUrl
RegularExpressionQRegularExpression
UuidQUuid
Other tagsSpecialThe tag is ignored and the tagged value is converted using this function

Note that values in both CBOR Maps and Arrays are converted recursively using this function too and placed in QVariantMap and QVariantList instead. You will not find QCborMap and QCborArray stored inside the QVariants.

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.

See also fromVariant(), toJsonValue(), QCborArray::toVariantList(), and QCborMap::toVariantMap().

source

pub unsafe fn type_(&self) -> Type

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 type of this QCborValue. The type can also later be retrieved by one of the "isXxx" functions.

Calls C++ function: QCborValue::Type QCborValue::type() const.

C++ documentation:

Returns the type of this QCborValue. The type can also later be retrieved by one of the “isXxx” functions.

See also isInteger(), isByteArray(), isString(), isArray(), isMap(), isTag(), isFalse(), isTrue(), isBool(), isNull(), isUndefined, isDouble(), isDateTime(), isUrl(), isRegularExpression(), and isUuid().

Trait Implementations§

source§

impl CppDeletable for QCborValue

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)

Disposes of the current QCborValue object and frees any associated resources.

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

C++ documentation:

Disposes of the current QCborValue object and frees any associated resources.

source§

impl Lt<Ref<QCborValue>> for QCborValue

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<QCborValue>) -> bool

Compares this value and other, and returns true if this value should be sorted before other, false otherwise. If each QCborValue contains an array or map, the comparison is recursive to elements contained in them.

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

C++ documentation:

Compares this value and other, and returns true if this value should be sorted before other, false otherwise. If each QCborValue contains an array or map, the comparison is recursive to elements contained in them.

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

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

source§

impl PartialEq<Ref<QCborValue>> for QCborValue

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<QCborValue>) -> bool

Compares this value and other, and returns true if they hold the same contents, false otherwise. If each QCborValue contains an array or map, the comparison is recursive to elements contained in them.

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

C++ documentation:

Compares this value and other, and returns true if they hold the same contents, false otherwise. If each QCborValue contains an array or map, the comparison is recursive to elements contained in them.

For more information on CBOR equality in Qt, see, 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.

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.