128 d = std::make_unique<QJsonDocumentPrivate>();
129 d->value =
other.d->value;
151 if (
this != &
other) {
154 d = std::make_unique<QJsonDocumentPrivate>();
157 d->value =
other.d->value;
200 case QMetaType::QVariantMap:
203 case QMetaType::QVariantHash:
206 case QMetaType::QVariantList:
209 case QMetaType::QStringList:
210 doc.d = std::make_unique<QJsonDocumentPrivate>();
233 if (d->value.isArray())
259#if !defined(QT_JSON_READONLY) || defined(Q_QDOC)
267 if (d->value.isArray())
291 if (
val.isArray() ||
val.isMap()) {
292 result.d = std::make_unique<QJsonDocumentPrivate>();
319 return d->value.isArray();
332 return d->value.isMap();
377 d = std::make_unique<QJsonDocumentPrivate>();
392 d = std::make_unique<QJsonDocumentPrivate>();
468 return lhs.d->value == rhs.d->value;
469 return !lhs.d == !rhs.d;
489 return (d ==
nullptr);
492#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
497 dbg <<
"QJsonDocument()";
502 if (
o.d->value.isArray())
506 dbg.nospace() <<
"QJsonDocument("
513#ifndef QT_NO_DATASTREAM
526 if (parseError.error && !
buffer.isEmpty())
527 stream.setStatus(QDataStream::ReadCorruptData);
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
static QCborArray fromStringList(const QStringList &list)
Returns a QCborArray containing all the strings found in the list list.
\inmodule QtCore\reentrant
static QCborValue fromJsonValue(const QJsonValue &v)
Converts the JSON value contained in v into its corresponding CBOR value and returns it.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
static QJsonArray fromVariantList(const QVariantList &list)
Converts the variant list list to a QJsonArray.
QVariantList toVariantList() const
Converts this object to a QVariantList.
QJsonDocumentPrivate()=default
QJsonDocumentPrivate(QCborValue data)
\inmodule QtCore\reentrant
static QJsonDocument fromVariant(const QVariant &variant)
Creates a QJsonDocument from the QVariant variant.
~QJsonDocument()
Deletes the document.
QVariant toVariant() const
Returns a QVariant representing the Json document.
bool isArray() const
Returns true if the document contains an array.
void swap(QJsonDocument &other) noexcept
bool isNull() const
returns true if this document is null.
const QJsonValue operator[](const QString &key) const
Returns a QJsonValue representing the value for the key key.
QByteArray toJson(JsonFormat format=Indented) const
void setArray(const QJsonArray &array)
Sets array as the main object of this document.
void setObject(const QJsonObject &object)
Sets object as the main object of this document.
QJsonDocument()
Constructs an empty and invalid document.
QJsonArray array() const
Returns the QJsonArray contained in the document.
QJsonObject object() const
Returns the QJsonObject contained in the document.
bool isObject() const
Returns true if the document contains an object.
bool isEmpty() const
Returns true if the document doesn't contain any data.
QJsonDocument & operator=(const QJsonDocument &other)
Assigns the other document to this QJsonDocument.
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
Parses json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it.
\inmodule QtCore\reentrant
QVariantMap toVariantMap() const
Converts this object to a QVariantMap.
static QJsonObject fromVariantMap(const QVariantMap &map)
Converts the variant map map to a QJsonObject.
static QJsonObject fromVariantHash(const QVariantHash &map)
Converts the variant hash hash to a QJsonObject.
QCborValue parse(QJsonParseError *error)
static QJsonValue fromTrustedCbor(const QCborValue &v)
static QCborContainerPrivate * container(const QCborValue &v)
static void objectToJson(const QCborContainerPrivate *o, QByteArray &json, int indent, bool compact=false)
static void arrayToJson(const QCborContainerPrivate *a, QByteArray &json, int indent, bool compact=false)
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
QList< QVariant > toList() const
Returns the variant as a QVariantList if the variant has userType() \l QMetaType::QVariantList.
QMap< QString, QVariant > toMap() const
Returns the variant as a QVariantMap if the variant has type() \l QMetaType::QVariantMap.
QHash< QString, QVariant > toHash() const
Returns the variant as a QHash<QString, QVariant> if the variant has type() \l QMetaType::QVariantHas...
QMetaType metaType() const
QStringList toStringList() const
Returns the variant as a QStringList if the variant has userType() \l QMetaType::QStringList,...
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QDataStream & operator>>(QDataStream &stream, QJsonDocument &doc)
QDebug operator<<(QDebug dbg, const QJsonDocument &o)
bool comparesEqual(const QJsonDocument &lhs, const QJsonDocument &rhs) noexcept
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
\inmodule QtCore\reentrant