18#include <private/qnumeric_p.h>
35 if (
unsigned(simpleType) < 0x100)
39 qWarning(
"QCborValue: found unknown type 0x%x",
t);
84#ifndef QT_BOOTSTRAPPED
86 &&
b->len ==
sizeof(
QUuid))
99 if (!
d ||
d->elements.size() != 2)
113 const auto &
e =
d->elements.at(idx);
128 return d->stringAt(idx);
132#if defined(QT_JSON_READONLY) || defined(QT_BOOTSTRAPPED)
133 qFatal(
"Writing JSON is disabled.");
178#ifdef QT_BOOTSTRAPPED
209 for (
qsizetype idx = 0; idx <
d->elements.size(); ++idx)
222 for (
qsizetype idx = 0; idx <
d->elements.size(); idx += 2)
237 if (!
d ||
d->elements.size() != 2)
243 const auto &
e =
d->elements.at(idx);
401#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
538 return toByteArray();
544 return toArray().toVariantList();
547 return toMap().toVariantMap();
551 return taggedValue().toVariant();
556#ifndef QT_BOOTSTRAPPED
560# if QT_CONFIG(regularexpression)
562 return toRegularExpression();
617 return v.toInteger();
639 if (
type == QMetaType::QString) {
641 }
else if (
type == QMetaType::QByteArray) {
707 case QMetaType::Nullptr:
709 case QMetaType::Bool:
711 case QMetaType::Short:
712 case QMetaType::UShort:
714 case QMetaType::LongLong:
715 case QMetaType::UInt:
717 case QMetaType::ULongLong:
718 if (
variant.
toULongLong() <=
static_cast<uint64_t
>(std::numeric_limits<qint64>::max()))
721 case QMetaType::Float:
722 case QMetaType::Double:
724 case QMetaType::QString:
726 case QMetaType::QStringList:
728 case QMetaType::QByteArray:
730 case QMetaType::QDateTime:
732#ifndef QT_BOOTSTRAPPED
733 case QMetaType::QUrl:
735 case QMetaType::QUuid:
738 case QMetaType::QVariantList:
740 case QMetaType::QVariantMap:
742 case QMetaType::QVariantHash:
744#ifndef QT_BOOTSTRAPPED
745#if QT_CONFIG(regularexpression)
746 case QMetaType::QRegularExpression:
749 case QMetaType::QJsonValue:
751 case QMetaType::QJsonObject:
753 case QMetaType::QJsonArray:
755 case QMetaType::QJsonDocument: {
761 case QMetaType::QCborValue:
762 return qvariant_cast<QCborValue>(
variant);
763 case QMetaType::QCborArray:
764 return qvariant_cast<QCborArray>(
variant);
765 case QMetaType::QCborMap:
766 return qvariant_cast<QCborMap>(
variant);
767 case QMetaType::QCborSimpleType:
768 return qvariant_cast<QCborSimpleType>(
variant);
799 retval.
append(
d->valueAt(
i).toVariant());
950 m.detach(
hash.size());
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 QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
\inmodule QtCore\reentrant
QVariantList toVariantList() const
Recursively converts each \l QCborValue in this array using QCborValue::toVariant() and returns the Q...
static QCborArray fromJsonArray(const QJsonArray &array)
Converts all JSON items found in the array array to CBOR using QCborValue::fromJson(),...
QJsonArray toJsonArray() const
Recursively converts every \l QCborValue element in this array to JSON using QCborValue::toJsonValue(...
static QCborArray fromStringList(const QStringList &list)
Returns a QCborArray containing all the strings found in the list list.
static QCborArray fromVariantList(const QVariantList &list)
Converts all the items in the list to CBOR using QCborValue::fromVariant() and returns the array comp...
\inmodule QtCore\reentrant
QVariantMap toVariantMap() const
Converts the CBOR values to QVariant using QCborValue::toVariant() and "stringifies" all the CBOR key...
QVariantHash toVariantHash() const
Converts the CBOR values to QVariant using QCborValue::toVariant() and "stringifies" all the CBOR key...
QJsonObject toJsonObject() const
Recursively converts every \l QCborValue value in this map to JSON using QCborValue::toJsonValue() an...
static QCborMap fromJsonObject(const QJsonObject &o)
Converts all JSON items found in the obj object to CBOR using QCborValue::fromJson(),...
static QCborMap fromVariantMap(const QVariantMap &map)
Converts all the items in map to CBOR using QCborValue::fromVariant() and returns the map composed of...
static QCborMap fromVariantHash(const QVariantHash &hash)
Converts all the items in hash to CBOR using QCborValue::fromVariant() and returns the map composed o...
\inmodule QtCore\reentrant
static QCborValue fromVariant(const QVariant &variant)
Converts the QVariant variant into QCborValue and returns it.
QVariant toVariant() const
Converts this value to a native Qt type and returns the corresponding QVariant.
QJsonValue toJsonValue() const
Converts this QCborValue object to an equivalent representation in JSON and returns it as a QJsonValu...
Type
This enum represents the QCborValue type.
Type type() const
Returns the type of this QCborValue.
static QCborValue fromJsonValue(const QJsonValue &v)
Converts the JSON value contained in v into its corresponding CBOR value and returns it.
T * data() const noexcept
Returns a pointer to the shared data object.
void reserve(qsizetype size)
Ensures that the QHash's internal hash table has space to store at least size items without having to...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
\inmodule QtCore\reentrant
\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
static QJsonValue fromTrustedCbor(const QCborValue &v)
static QJsonObject toJsonObject(const QVariantMap &map)
static QJsonArray toJsonArray(const QVariantList &list)
\inmodule QtCore\reentrant
qsizetype size() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
iterator insert(const Key &key, const T &value)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QUrl fromEncoded(QByteArrayView input, ParsingMode mode=TolerantMode)
Parses input and returns the corresponding QUrl.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QString toString(StringFormat mode=WithBraces) const
static QUuid fromRfc4122(QByteArrayView) noexcept
Creates a QUuid object from the binary representation of the UUID, as specified by RFC 4122 section 4...
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has userType() \l QMetaType::QDateTime,...
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...
bool isNull() const
Returns true if this is a null variant, false otherwise.
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 >
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
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 ...
QHash< int, QWidget * > hash
[35multi]
QMap< QString, QString > map
[6]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
AudioChannelLayoutTag tag
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static QString simpleTypeString(QCborValue::Type t)
static QString makeString(const QCborContainerPrivate *d, qsizetype idx, ConversionMode mode=ConversionMode::FromRaw)
static void appendVariant(QCborContainerPrivate *d, const QVariant &variant)
QJsonValue qt_convertToJson(QCborContainerPrivate *d, qsizetype idx, ConversionMode mode=ConversionMode::FromRaw)
static QString encodeByteArray(const QCborContainerPrivate *d, qsizetype idx, QCborTag encoding)
static QJsonArray convertToJsonArray(QCborContainerPrivate *d, ConversionMode mode=ConversionMode::FromRaw)
static QJsonValue convertExtendedTypeToJson(QCborContainerPrivate *d)
static QJsonObject convertToJsonObject(QCborContainerPrivate *d, ConversionMode mode=ConversionMode::FromRaw)
static QJsonValue fpToJson(double v)
static QString encodeTag(const QCborContainerPrivate *d)
static QString maybeEncodeTag(const QCborContainerPrivate *d)
static Q_DECL_CONST_FUNCTION bool qt_is_finite(double d)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei const GLchar *const * string
[0]
#define QStringLiteral(str)
QList< QPair< QString, QString > > Map
static double toDouble(Value v)
value toMap().value(key)
[3]
value isSimpleType(QCborSimpleType(12))
[1]
char * toString(const MyType &t)
[31]