18#include <private/qnumeric_p.h>
19#include <private/qcborvalue_p.h>
150 if (convertDoubleTo<qint64>(
v, &
n,
false ))
478 case QMetaType::Nullptr:
480 case QMetaType::Bool:
482 case QMetaType::Short:
483 case QMetaType::UShort:
485 case QMetaType::UInt:
486 case QMetaType::LongLong:
488 case QMetaType::ULongLong:
489 if (
variant.
toULongLong() <=
static_cast<uint64_t
>(std::numeric_limits<qint64>::max()))
492 case QMetaType::Float:
493 case QMetaType::Double: {
497 case QMetaType::QString:
499 case QMetaType::QStringList:
501 case QMetaType::QVariantList:
503 case QMetaType::QVariantMap:
505 case QMetaType::QVariantHash:
507#ifndef QT_BOOTSTRAPPED
508 case QMetaType::QUrl:
510 case QMetaType::QUuid:
512 case QMetaType::QJsonValue:
514 case QMetaType::QJsonObject:
516 case QMetaType::QJsonArray:
518 case QMetaType::QJsonDocument: {
522 case QMetaType::QCborValue:
523 return qvariant_cast<QCborValue>(
variant).toJsonValue();
524 case QMetaType::QCborArray:
525 return qvariant_cast<QCborArray>(
variant).toJsonArray();
526 case QMetaType::QCborMap:
527 return qvariant_cast<QCborMap>(
variant).toJsonObject();
533 if (
string.isEmpty())
555 switch (
value.type()) {
614 switch (
value.type()) {
633 switch (
value.type()) {
636 if (convertDoubleTo<int>(
toDouble(), &dblInt))
641 const auto n =
value.toInteger();
661 switch (
value.type()) {
663 return value.toInteger();
666 if (convertDoubleTo<qint64>(
toDouble(), &dblInt))
683 return value.toDouble(defaultValue);
693 return value.toString(defaultValue);
705 return value.toString();
720 Q_ASSERT(
n == -1 || container ==
nullptr);
750 Q_ASSERT(
n == -1 || container ==
nullptr);
836 if (lhs.value.type() != rhs.value.type()) {
837 if (lhs.isDouble() && rhs.isDouble()) {
839 return lhs.
toDouble() == rhs.toDouble();
844 switch (lhs.value.type()) {
851 return lhs.toDouble() == rhs.toDouble();
856 return lhs.toString() == rhs.toString();
858 return lhs.toArray() == rhs.toArray();
860 return lhs.toObject() == rhs.toObject();
896void QJsonValueRef::detach()
898#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
915 if (is_object &&
value.isUndefined()) {
983 if (!convertDoubleTo<qint64>(e.fpvalue(), &
v))
1000 return defaultValue;
1008 return defaultValue;
1031#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
1032QVariant QJsonValueRef::toVariant()
const
1049 return concrete(*
this);
1057 auto &e =
d->elements[
index];
1080 auto &e =
d->elements[
index];
1081 if (e.flags & QtCbor::Element::IsContainer && e.container !=
x)
1082 o.o.reset(e.container);
1093 switch (
value.type()) {
1109 Q_UNREACHABLE_RETURN(0);
1112#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
1116 switch (
o.value.type()) {
1118 dbg <<
"QJsonValue(undefined)";
1121 dbg <<
"QJsonValue(null)";
1125 dbg.nospace() <<
"QJsonValue(bool, " <<
o.toBool() <<
')';
1128 dbg.nospace() <<
"QJsonValue(double, " <<
o.toInteger() <<
')';
1131 dbg.nospace() <<
"QJsonValue(double, " <<
o.toDouble() <<
')';
1134 dbg.nospace() <<
"QJsonValue(string, " <<
o.toString() <<
')';
1137 dbg.nospace() <<
"QJsonValue(array, ";
1142 dbg.nospace() <<
"QJsonValue(object, ";
1143 dbg <<
o.toObject();
1153#ifndef QT_NO_DATASTREAM
1219 stream.setStatus(QDataStream::ReadCorruptData);
\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
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 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()}.
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]
bool comparesEqual(const QJsonValue &lhs, const QJsonValue &rhs) noexcept
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]
QCborValue(QCborTag(2), QByteArray("\x01\0\0\0\0\0\0\0\0", 9))
[0]