126 d = std::make_unique<QJsonDocumentPrivate>();
127 d->value =
other.d->value;
149 if (
this != &
other) {
152 d = std::make_unique<QJsonDocumentPrivate>();
155 d->value =
other.d->value;
197 case QMetaType::QVariantMap:
200 case QMetaType::QVariantHash:
203 case QMetaType::QVariantList:
206 case QMetaType::QStringList:
207 doc.d = std::make_unique<QJsonDocumentPrivate>();
230 if (d->value.isArray())
255#if !defined(QT_JSON_READONLY) || defined(Q_QDOC)
263 if (d->value.isArray())
287 if (
val.isArray() ||
val.isMap()) {
288 result.d = std::make_unique<QJsonDocumentPrivate>();
315 return d->value.isArray();
328 return d->value.isMap();
373 d = std::make_unique<QJsonDocumentPrivate>();
388 d = std::make_unique<QJsonDocumentPrivate>();
462 return d->value ==
other.d->value;
463 return !d == !
other.d;
483 return (d ==
nullptr);
486#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
491 dbg <<
"QJsonDocument()";
496 if (
o.d->value.isArray())
500 dbg.nospace() <<
"QJsonDocument("
507#ifndef QT_NO_DATASTREAM
520 if (parseError.error && !
buffer.isEmpty())
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
bool operator==(const QJsonDocument &other) const
Returns true if the other document is equal to this document.
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)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
\inmodule QtCore\reentrant