51 #include <private/qnumeric_p.h>
52 #include <private/qcborvalue_p.h>
150 static inline QCborValue doubleValueHelper(
double v)
155 if (convertDoubleTo<qint64>(
v, &
n,
false ))
165 :
value(doubleValueHelper(
v))
485 case QMetaType::Nullptr:
493 case QMetaType::LongLong:
495 case QMetaType::ULongLong:
496 if (
variant.
toULongLong() <=
static_cast<uint64_t
>(std::numeric_limits<qint64>::max()))
514 #ifndef QT_BOOTSTRAPPED
515 case QMetaType::QUrl:
517 case QMetaType::QUuid:
519 case QMetaType::QJsonValue:
521 case QMetaType::QJsonObject:
523 case QMetaType::QJsonArray:
525 case QMetaType::QJsonDocument: {
530 return qvariant_cast<QCborValue>(
variant).toJsonValue();
531 case QMetaType::QCborArray:
532 return qvariant_cast<QCborArray>(
variant).toJsonArray();
533 case QMetaType::QCborMap:
534 return qvariant_cast<QCborMap>(
variant).toJsonObject();
540 if (
string.isEmpty())
562 switch (
value.type()) {
610 switch (
value.type()) {
638 switch (
value.type()) {
657 switch (
value.type()) {
660 if (convertDoubleTo<int>(
toDouble(), &dblInt))
665 const auto n =
value.toInteger();
685 switch (
value.type()) {
687 return value.toInteger();
690 if (convertDoubleTo<qint64>(
toDouble(), &dblInt))
707 return value.toDouble(defaultValue);
717 return value.toString(defaultValue);
729 return value.toString();
786 #if QT_STRINGVIEW_LEVEL < 2
862 switch (
value.type()) {
890 return !(*
this ==
other);
961 switch (
value.type()) {
963 return qHash(
nullptr, seed);
981 #if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
985 switch (
o.value.type()) {
987 dbg <<
"QJsonValue(undefined)";
990 dbg <<
"QJsonValue(null)";
994 dbg.
nospace() <<
"QJsonValue(bool, " <<
o.toBool() <<
')';
997 dbg.
nospace() <<
"QJsonValue(double, " <<
o.toInteger() <<
')';
1000 dbg.
nospace() <<
"QJsonValue(double, " <<
o.toDouble() <<
')';
1003 dbg.
nospace() <<
"QJsonValue(string, " <<
o.toString() <<
')';
1006 dbg.
nospace() <<
"QJsonValue(array, ";
1011 dbg.
nospace() <<
"QJsonValue(object, ";
1012 dbg <<
o.toObject();
1022 #ifndef QT_NO_DATASTREAM
small capitals from c petite p scientific i
[1]
The QCborArray class is used to hold an array of CBOR elements.
static QCborArray fromJsonArray(const QJsonArray &array)
The QCborMap class is used to hold an associative container representable in CBOR.
static QCborMap fromJsonObject(const QJsonObject &o)
The QCborValue class encapsulates a value in CBOR.
The QDataStream class provides serialization of binary data to a QIODevice.
operator>>(QDataStream &ds, qfloat16 &f)
operator<<(QDataStream &ds, qfloat16 f)
The QDebug class provides an output stream for debugging information.
Convenience class for custom QDebug operators.
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
The QJsonArray class encapsulates a JSON array.
static QJsonArray fromStringList(const QStringList &list)
static QJsonArray fromVariantList(const QVariantList &list)
QJsonValue at(qsizetype i) const
QVariantList toVariantList() const
The QJsonDocument class provides a way to read and write JSON documents.
QJsonObject object() const
The QJsonObject class encapsulates a JSON object.
QVariantMap toVariantMap() const
static QJsonObject fromVariantMap(const QVariantMap &map)
QJsonValue value(const QString &key) const
static QJsonObject fromVariantHash(const QVariantHash &map)
static QCborContainerPrivate * container(const QCborValue &v)
static qint64 valueHelper(const QCborValue &v)
The QJsonValue class encapsulates a value in JSON.
QJsonValue & operator=(const QJsonValue &other)
void swap(QJsonValue &other) noexcept
int toInt(int defaultValue=0) const
QJsonObject toObject() const
QJsonArray toArray() const
double toDouble(double defaultValue=0) const
bool operator==(const QJsonValue &other) const
bool toBool(bool defaultValue=false) const
static QJsonValue fromVariant(const QVariant &variant)
const QJsonValue operator[](const QString &key) const
QVariant toVariant() const
bool operator!=(const QJsonValue &other) const
qint64 toInteger(qint64 defaultValue=0) const
The QJsonValueRef class is a helper class for QJsonValue.
QVariant toVariant() const
QJsonValueRef & operator=(const QJsonValue &val)
QJsonObject toObject() const
QJsonArray toArray() const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
The QString class provides a Unicode character string.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
QString toString(StringFormat mode=WithBraces) const
The QVariant class acts like a union for the most common Qt data types.
static auto fromValue(const T &value) -> std::enable_if_t< std::is_copy_constructible_v< T >, QVariant >
QJsonValue toJsonValue() const
double toDouble(bool *ok=nullptr) const
QList< QVariant > toList() const
QMap< QString, QVariant > toMap() const
qlonglong toLongLong(bool *ok=nullptr) const
QJsonArray toJsonArray() const
QHash< QString, QVariant > toHash() const
QJsonDocument toJsonDocument() const
QJsonObject toJsonObject() const
QMetaType metaType() const
qulonglong toULongLong(bool *ok=nullptr) const
QStringList toStringList() const
QHash< QString, QVariant > QVariantHash
QMap< QString, QVariant > QVariantMap
QList< QString > QStringList
EGLOutputLayerEXT EGLint EGLAttrib value
QList< QVariant > QVariantList
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
QCborValue(QCborTag(2), QByteArray("\x01\0\0\0\0\0\0\0\0", 9))
[0]