8#include <QtCore/qcompare.h>
9#include <QtCore/qjsonparseerror.h>
10#if (QT_VERSION >= QT_VERSION_CHECK(7
, 0
, 0
)) || defined(QT_BOOTSTRAPPED)
11#include <QtCore/qjsonvalue.h>
13#include <QtCore/qlatin1stringview.h>
14#include <QtCore/qscopedpointer.h>
15#include <QtCore/qstringview.h>
32 static const uint BinaryFormatTag = (
'q') | (
'b' << 8) | (
'j' << 16) | (
's' << 24);
34 static const uint BinaryFormatTag = (
'q' << 24) | (
'b' << 16) | (
'j' << 8) | (
's');
38 explicit QJsonDocument(
const QJsonObject &object);
39 explicit QJsonDocument(QJsonObject &&object);
40 explicit QJsonDocument(
const QJsonArray &array);
41 explicit QJsonDocument(QJsonArray &&array);
44 QJsonDocument(
const QJsonDocument &other);
45 QJsonDocument &operator =(
const QJsonDocument &other);
47 QT_CORE_INLINE_SINCE(6, 12)
48 QJsonDocument(QJsonDocument &&other)
noexcept;
49 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QJsonDocument)
51 QT_CORE_INLINE_SINCE(6, 12)
52 void swap(QJsonDocument &other)
noexcept;
54 static QJsonDocument fromVariant(
const QVariant &variant);
55 QVariant toVariant()
const;
57#if (QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)) && !defined(QT_BOOTSTRAPPED)
63 using JsonFormat = QJsonValue::JsonFormat;
64# ifdef __cpp_using_enum
65 using enum QJsonValue::JsonFormat;
68 static constexpr auto Indented = JsonFormat::Indented;
69 static constexpr auto Compact = JsonFormat::Compact;
73 static QJsonDocument fromJson(
const QByteArray &json, QJsonParseError *error =
nullptr);
75 QByteArray toJson(JsonFormat format = JsonFormat::Indented)
const;
79 bool isObject()
const;
81 QJsonObject object()
const;
82 QJsonArray array()
const;
84 void setObject(
const QJsonObject &object);
85 void setArray(
const QJsonArray &array);
87 const QJsonValue operator[](
const QString &key)
const;
88 const QJsonValue operator[](QStringView key)
const;
89 const QJsonValue operator[](QLatin1StringView key)
const;
90 const QJsonValue operator[](qsizetype i)
const;
91#if QT_CORE_REMOVED_SINCE(6
, 8
)
92 bool operator==(
const QJsonDocument &other)
const;
93 bool operator!=(
const QJsonDocument &other)
const {
return !operator==(other); }
98 friend class QJsonValue;
99 friend class QJsonPrivate::Parser;
100 friend Q_CORE_EXPORT QDebug operator<<(QDebug,
const QJsonDocument &);
101 friend Q_CORE_EXPORT
bool comparesEqual(
const QJsonDocument &lhs,
102 const QJsonDocument &rhs)
noexcept;
103 Q_DECLARE_EQUALITY_COMPARABLE(QJsonDocument)
105 inline explicit QJsonDocument(QCborValue data);
107 QJsonDocumentPrivate *d =
nullptr;
112#if QT_CORE_INLINE_IMPL_SINCE(6
, 12
)
113QJsonDocument::QJsonDocument(QJsonDocument &&other)
noexcept
114 : d(std::exchange(other.d,
nullptr))
118void QJsonDocument::swap(QJsonDocument &other)
noexcept
120 qt_ptr_swap(d, other.d);
124#if !defined(QT_NO_DEBUG_STREAM)
125Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QJsonDocument &);
128#ifndef QT_NO_DATASTREAM
129Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QJsonDocument &);
130Q_CORE_EXPORT
QDataStream &operator>>(QDataStream &, QJsonDocument &);
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QCborArray toArray(const QCborArray &a) const
QCborMap toMap(const QCborMap &m) const
QVariant toVariant() const
QCborValueConstRef & operator=(const QCborValueConstRef &)=delete
QCborArray toArray() const
bool toBool(bool defaultValue=false) const
QCborValue taggedValue(const QCborValue &defaultValue=QCborValue()) const
QCborSimpleType toSimpleType(QCborSimpleType defaultValue=QCborSimpleType::Undefined) const
bool isSimpleType() const
bool isRegularExpression() const
QCborValue::Type type() const
QCborValueConstRef(const QCborValueConstRef &)=default
QCborTag tag(QCborTag defaultValue=QCborTag(-1)) const
constexpr QCborValueConstRef()
QByteArray toByteArray(const QByteArray &defaultValue={}) const
qint64 toInteger(qint64 defaultValue=0) const
bool isSimpleType(QCborSimpleType st) const
QUuid toUuid(const QUuid &defaultValue={}) const
QCborContainerPrivate * d
QAnyStringView toStringView(QAnyStringView defaultValue={}) const
friend bool comparesEqual(const QCborValueConstRef &lhs, const QCborValueConstRef &rhs) noexcept
friend bool comparesEqual(const QCborValueConstRef &lhs, const QCborValue &rhs) noexcept
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt=QCborValue::Compact) const
int compare(const QCborValue &other) const
friend Qt::strong_ordering compareThreeWay(const QCborValueConstRef &lhs, const QCborValue &rhs) noexcept
operator QCborValue() const
friend Qt::strong_ordering compareThreeWay(const QCborValueConstRef &lhs, const QCborValueConstRef &rhs) noexcept
constexpr QCborValueConstRef(QCborContainerPrivate *dd, qsizetype ii)
QCborValue concrete() const noexcept
QString toString(const QString &defaultValue={}) const
QUrl toUrl(const QUrl &defaultValue={}) const
QJsonValue toJsonValue() const
friend size_t qHash(const QCborValueConstRef &key, size_t seed=0) noexcept
double toDouble(double defaultValue=0) const
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\keyword 16-bit Floating Point Support\inmodule QtCore \inheaderfile QFloat16
Combined button and popup list for selecting options.
QMutableListIterator< QByteArray > QMutableByteArrayListIterator
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QList< QVariant > QVariantList
#define qCWarning(category,...)
#define Q_STATIC_LOGGING_CATEGORY(name,...)
#define QStringLiteral(str)
\inmodule QtCore\reentrant
QString errorString() const
\variable QCborParserError::offset
~QListSpecialMethods()=default
QListSpecialMethods & operator=(const QListSpecialMethods &)=default
QListSpecialMethods(QListSpecialMethods &&)=default
QListSpecialMethods & operator=(QListSpecialMethods &&)=default
QListSpecialMethods()=default
QListSpecialMethods(const QListSpecialMethods &)=default
QByteArray join(QByteArrayView sep={}) const
static T value(const Iterator &it)
static T value(Iterator &it)
static QCborValueConstRef key(Iterator &it)
static QCborValueConstRef key(const Iterator &it)