18#include <private/qnumeric_p.h>
19#include <private/qcborvalue_p.h>
146 if (convertDoubleTo<qint64>(
v, &
n,
false ))
473 case QMetaType::Nullptr:
475 case QMetaType::Bool:
477 case QMetaType::Short:
478 case QMetaType::UShort:
480 case QMetaType::UInt:
481 case QMetaType::LongLong:
483 case QMetaType::ULongLong:
484 if (
variant.
toULongLong() <=
static_cast<uint64_t
>(std::numeric_limits<qint64>::max()))
487 case QMetaType::Float:
488 case QMetaType::Double: {
492 case QMetaType::QString:
494 case QMetaType::QStringList:
496 case QMetaType::QVariantList:
498 case QMetaType::QVariantMap:
500 case QMetaType::QVariantHash:
502#ifndef QT_BOOTSTRAPPED
503 case QMetaType::QUrl:
505 case QMetaType::QUuid:
507 case QMetaType::QJsonValue:
509 case QMetaType::QJsonObject:
511 case QMetaType::QJsonArray:
513 case QMetaType::QJsonDocument: {
517 case QMetaType::QCborValue:
518 return qvariant_cast<QCborValue>(
variant).toJsonValue();
519 case QMetaType::QCborArray:
520 return qvariant_cast<QCborArray>(
variant).toJsonArray();
521 case QMetaType::QCborMap:
522 return qvariant_cast<QCborMap>(
variant).toJsonObject();
528 if (
string.isEmpty())
550 switch (
value.type()) {
608 switch (
value.type()) {
627 switch (
value.type()) {
630 if (convertDoubleTo<int>(
toDouble(), &dblInt))
635 const auto n =
value.toInteger();
655 switch (
value.type()) {
657 return value.toInteger();
660 if (convertDoubleTo<qint64>(
toDouble(), &dblInt))
677 return value.toDouble(defaultValue);
687 return value.toString(defaultValue);
699 return value.toString();
714 Q_ASSERT(
n == -1 || container ==
nullptr);
744 Q_ASSERT(
n == -1 || container ==
nullptr);
836 switch (
value.type()) {
864 return !(*
this ==
other);
890void QJsonValueRef::detach()
892#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
909 if (is_object &&
value.isUndefined()) {
975 if (!convertDoubleTo<qint64>(
e.fpvalue(), &
v))
1000 return defaultValue;
1014 Q_ASSUME(self.is_object);
1023#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
1024QVariant QJsonValueRef::toVariant()
const
1041 return concrete(*
this);
1074 o.o.reset(
e.container);
1085 switch (
value.type()) {
1101 Q_UNREACHABLE_RETURN(0);
1104#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
1108 switch (
o.value.type()) {
1110 dbg <<
"QJsonValue(undefined)";
1113 dbg <<
"QJsonValue(null)";
1117 dbg.nospace() <<
"QJsonValue(bool, " <<
o.toBool() <<
')';
1120 dbg.nospace() <<
"QJsonValue(double, " <<
o.toInteger() <<
')';
1123 dbg.nospace() <<
"QJsonValue(double, " <<
o.toDouble() <<
')';
1126 dbg.nospace() <<
"QJsonValue(string, " <<
o.toString() <<
')';
1129 dbg.nospace() <<
"QJsonValue(array, ";
1134 dbg.nospace() <<
"QJsonValue(object, ";
1135 dbg <<
o.toObject();
1145#ifndef QT_NO_DATASTREAM
\inmodule QtCore\reentrant
static QCborArray fromJsonArray(const QJsonArray &array)
Converts all JSON items found in the array array to CBOR using QCborValue::fromJson(),...
QString stringAt(qsizetype idx) const
static QCborContainerPrivate * grow(QCborContainerPrivate *d, qsizetype index)
Prepare for an insertion at position index.
static QCborContainerPrivate * detach(QCborContainerPrivate *d, qsizetype reserved)
QList< QtCbor::Element > elements
\inmodule QtCore\reentrant
static QCborMap fromJsonObject(const QJsonObject &o)
Converts all JSON items found in the obj object to CBOR using QCborValue::fromJson(),...
\inmodule QtCore\reentrant
Type
This enum represents the QCborValue type.
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 fromStringList(const QStringList &list)
Converts the string list list to a QJsonArray.
static QJsonArray fromVariantList(const QVariantList &list)
Converts the variant list list to a QJsonArray.
QJsonValue at(qsizetype i) const
Returns a QJsonValue representing the value for index i.
QVariantList toVariantList() const
Converts this object to a QVariantList.
\inmodule QtCore\reentrant
bool isArray() const
Returns true if the document contains an array.
QJsonArray array() const
Returns the QJsonArray contained in the document.
QJsonObject object() const
Returns the QJsonObject contained in the document.
\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.
QJsonValue value(const QString &key) const
Returns a QJsonValue representing the value for the key key.
static QJsonObject fromVariantHash(const QVariantHash &map)
Converts the variant hash hash to a QJsonObject.
static QJsonValue fromTrustedCbor(const QCborValue &v)
static qsizetype indexHelper(QJsonValueConstRef r) noexcept
static const QtCbor::Element & elementHelper(QJsonValueConstRef r) noexcept
static qint64 valueHelper(const QCborValue &v)
static QCborContainerPrivate * container(const QCborValue &v)
static Q_CORE_EXPORT qint64 concreteInt(QJsonValueConstRef self, qint64 defaultValue, bool clamp) noexcept Q_DECL_PURE_FUNCTION
static Q_CORE_EXPORT bool concreteBool(QJsonValueConstRef self, bool defaultValue) noexcept Q_DECL_PURE_FUNCTION
static Q_CORE_EXPORT QJsonValue::Type concreteType(QJsonValueConstRef self) noexcept Q_DECL_PURE_FUNCTION
static Q_CORE_EXPORT QJsonValue concrete(QJsonValueConstRef self) noexcept
static Q_CORE_EXPORT double concreteDouble(QJsonValueConstRef self, double defaultValue) noexcept Q_DECL_PURE_FUNCTION
Q_CORE_EXPORT QJsonArray toArray() const
QString objectKey() const
Q_CORE_EXPORT QVariant toVariant() const
static Q_CORE_EXPORT QString concreteString(QJsonValueConstRef self, const QString &defaultValue)
QCborContainerPrivate * d
Q_CORE_EXPORT QJsonObject toObject() const
\inmodule QtCore \reentrant
\inmodule QtCore\reentrant
bool isDouble() const
Returns true if the value contains a double.
void swap(QJsonValue &other) noexcept
QJsonValue(Type=Null)
Creates a QJsonValue of type type.
QJsonValue & operator=(const QJsonValue &other) noexcept
Assigns the value stored in other to this object.
int toInt(int defaultValue=0) const
QJsonObject toObject() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QJsonArray toArray() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
~QJsonValue()
Destroys the value.
double toDouble(double defaultValue=0) const
Converts the value to a double and returns it.
bool operator==(const QJsonValue &other) const
Returns true if the value is equal to other.
bool toBool(bool defaultValue=false) const
Converts the value to a bool and returns it.
static QJsonValue fromVariant(const QVariant &variant)
Converts variant to a QJsonValue and returns it.
bool isArray() const
Returns true if the value contains an array.
Type type() const
Returns the type of the value.
QString toString() const
Converts the value to a QString and returns it.
bool isObject() const
Returns true if the value contains an object.
const QJsonValue operator[](const QString &key) const
Returns a QJsonValue representing the value for the key key.
QVariant toVariant() const
Converts the value to a \l {QVariant::}{QVariant()}.
bool operator!=(const QJsonValue &other) const
Returns true if the value is not equal to other.
Type
This enum describes the type of the JSON value.
qint64 toInteger(qint64 defaultValue=0) const
const_reference at(qsizetype i) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QString toString(StringFormat mode=WithBraces) const
QJsonValue toJsonValue() const
double toDouble(bool *ok=nullptr) const
Returns the variant as a double if the variant has userType() \l QMetaType::Double,...
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.
qlonglong toLongLong(bool *ok=nullptr) const
Returns the variant as a long long int if the variant has userType() \l QMetaType::LongLong,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
QJsonArray toJsonArray() const
QHash< QString, QVariant > toHash() const
Returns the variant as a QHash<QString, QVariant> if the variant has type() \l QMetaType::QVariantHas...
QJsonDocument toJsonDocument() const
QJsonObject toJsonObject() const
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QMetaType metaType() const
qulonglong toULongLong(bool *ok=nullptr) const
Returns the variant as an unsigned long long int if the variant has type() \l QMetaType::ULongLong,...
QStringList toStringList() const
Returns the variant as a QStringList if the variant has userType() \l QMetaType::QStringList,...
QUrl toUrl() const
Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an ...
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QDataStream & operator>>(QDataStream &stream, QJsonValue &v)
static QJsonValueRef & assignToRef(QJsonValueRef &ref, const QCborValue &value, bool is_object)
QDebug operator<<(QDebug dbg, const QJsonValue &o)
static QCborValue doubleValueHelper(double v)
static QT_BEGIN_NAMESPACE QJsonValue::Type convertFromCborType(QCborValue::Type type) noexcept
size_t qHash(const QJsonValue &value, size_t seed)
static Q_DECL_CONST_FUNCTION bool qt_is_finite(double d)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
static const QTextHtmlElement elements[Html_NumElements]