6.0.0-rc4Source

QCborValueRef Class

The QCborValueRef class is a reference to a value in a QCborArray or QCborMap. More…

Header#include <QCborValueRef>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes
Since5.12
InheritsQCborValueConstRef

List of all members, including inherited members

Public Functions

QCborValueRef(const QCborValueRef &other)
QCborValueRef &operator=(const QCborValue &other)
QCborValueRef &operator=(const QCborValueRef &other)
QCborValueRefoperator[](qint64 key)
QCborValueRefoperator[](QLatin1StringView key)
QCborValueRefoperator[](const QString &key)

Detailed Description

The operator[] of QCborValue, QCborArray and QCborMap that is not const, and their iterators, give such a reference. Assigning to it changes the value in the container:

QCborArray array{1, 2, 3};
array[1] = u"two"_s;

See also QCborValueConstRef.

Differences from Qt

The reference points to the value in the container: it is invalid once the container gets or loses elements.

Member Function Documentation

QCborValueRef::QCborValueRef(const QCborValueRef &other)

Constructs a reference to the value that other refers to.

QCborValueRef & QCborValueRef::operator=(const QCborValue &other)

Replaces the value that the reference refers to with other, and returns this reference.

QCborValueRef & QCborValueRef::operator=(const QCborValueRef &other)

This is an overloaded function.

Replaces the value that the reference refers to with the value that other refers to, and returns this reference. The references go on referring to two values.

QCborValueRef QCborValueRef::operator[](qint64 key)

Returns a reference to the element or value at key in the array or map that this reference refers to; see QCborValue::operator[]().

QCborValueRef QCborValueRef::operator[](QLatin1StringView key)

This is an overloaded function.

Returns a reference to the value of key in the map that this reference refers to.

QCborValueRef QCborValueRef::operator[](const QString &key)

This is an overloaded function.

Returns a reference to the value of key in the map that this reference refers to.