7#include <QtCore/qbytearray.h>
8#include <QtCore/qdatetime.h>
9#include <QtCore/qcborcommon.h>
10#if QT_CONFIG(regularexpression)
11# include <QtCore/qregularexpression.h>
13#include <QtCore/qstring.h>
14#include <QtCore/qstringview.h>
15#include <QtCore/qurl.h>
16#include <QtCore/quuid.h>
17#include <QtCore/qvariant.h>
20#if defined(False) && defined(True)
25#if 0 && __has_include(<compare>)
54 SortKeysInMaps = 0x01,
56#ifndef QT_BOOTSTRAPPED
57 UseFloat16 = UseFloat | 0x04,
116#ifndef QT_NO_CAST_FROM_ASCII
129#ifndef QT_BOOTSTRAPPED
131# if QT_CONFIG(regularexpression)
148 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(
QCborValue)
166 bool isBool()
const {
return isFalse() || isTrue(); }
179 return int(
type()) >> 8 == int(SimpleType) >> 8;
183 return type() == type_helper(st);
191 {
return isInteger() ? value_helper() : isDouble() ?
qint64(fp_helper()) : defaultValue; }
192 bool toBool(
bool defaultValue =
false)
const
193 {
return isBool() ? isTrue() : defaultValue; }
195 {
return isDouble() ? fp_helper() : isInteger() ? double(value_helper()) : defaultValue; }
203#ifndef QT_BOOTSTRAPPED
204 QUrl toUrl(
const QUrl &defaultValue = {})
const;
205# if QT_CONFIG(regularexpression)
208 QUuid toUuid(
const QUuid &defaultValue = {})
const;
222 QCborValueRef operator[](
const QString &
key);
225#if 0 && __has_include(<compare>)
229 if (
c > 0)
return std::partial_ordering::greater;
230 if (
c == 0)
return std::partial_ordering::equivalent;
231 return std::partial_ordering::less;
237 {
return !(*
this ==
other); }
247#if QT_CONFIG(cborstreamreader)
255#if QT_CONFIG(cborstreamwriter)
256 QByteArray toCbor(EncodingOptions
opt = NoTransformation)
const;
260 QString toDiagnosticNotation(DiagnosticNotationOptions opts = Compact)
const;
263 friend class QCborValueRef;
272 qint64 value_helper()
const
277 double fp_helper()
const
279 static_assert(
sizeof(double) ==
sizeof(
n));
281 memcpy(&
d, &
n,
sizeof(
d));
290 constexpr static bool isTag_helper(
Type tt)
292 return tt ==
Tag || tt >= 0x10000;
310 bool isTag()
const {
return concrete().isTag(); }
313 bool isBool()
const {
return isFalse() || isTrue(); }
328 return concrete().toSimpleType(defaultValue);
332 {
return concrete().tag(defaultValue); }
337 {
return concrete().toInteger(defaultValue); }
338 bool toBool(
bool defaultValue =
false)
const
339 {
return concrete().toBool(defaultValue); }
341 {
return concrete().toDouble(defaultValue); }
344 {
return concrete().toByteArray(defaultValue); }
346 {
return concrete().toString(defaultValue); }
348 {
return concrete().toDateTime(defaultValue); }
349#ifndef QT_BOOTSTRAPPED
351 {
return concrete().toUrl(defaultValue); }
352# if QT_CONFIG(regularexpression)
354 {
return concrete().toRegularExpression(defaultValue); }
357 {
return concrete().toUuid(defaultValue); }
371 {
return concrete().compare(
other); }
372#if 0 && __has_include(<compare>)
376 if (
c > 0)
return std::strong_ordering::greater;
377 if (
c == 0)
return std::strong_ordering::equivalent;
378 return std::strong_ordering::less;
384 {
return !(*
this ==
other); }
392#if QT_CONFIG(cborstreamwriter)
394 {
return concrete().toCbor(
opt); }
396 {
return concrete().toCbor(writer,
opt); }
400 {
return concrete().toDiagnosticNotation(
opt); }
412 static Q_CORE_EXPORT
bool
414 static Q_CORE_EXPORT
double
416 static Q_CORE_EXPORT
qint64
436 QCborValueRef(
const QCborValueRef &)
noexcept =
default;
437 QCborValueRef(QCborValueRef &&)
noexcept =
default;
439 { assign(*
this,
other);
return *
this; }
441 { assign(*
this, std::move(
other));
other.container =
nullptr;
return *
this; }
443 { assign(*
this,
other);
return *
this; }
445 QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](
qint64 key);
447 QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](
const QString &
key);
449#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
453 operator QCborValue()
const {
return concrete(); }
460 bool isTag()
const {
return QCborValue::isTag_helper(
type()); }
463 bool isBool()
const {
return isFalse() || isTrue(); }
472 bool isContainer()
const {
return isMap() || isArray(); }
479 return type() == QCborValue::type_helper(st);
487 {
return concrete().tag(defaultValue); }
492 {
return concreteIntegral(*
this, defaultValue); }
493 bool toBool(
bool defaultValue =
false)
const
494 {
return concreteBoolean(*
this, defaultValue); }
495 double toDouble(
double defaultValue = 0)
const
496 {
return concreteDouble(*
this, defaultValue); }
499 {
return concreteByteArray(*
this, defaultValue); }
501 {
return concreteString(*
this, defaultValue); }
503 {
return concrete().toDateTime(defaultValue); }
504#ifndef QT_BOOTSTRAPPED
505 QUrl toUrl(
const QUrl &defaultValue = {})
const
506 {
return concrete().toUrl(defaultValue); }
507# if QT_CONFIG(regularexpression)
509 {
return concrete().toRegularExpression(defaultValue); }
511 QUuid toUuid(
const QUuid &defaultValue = {})
const
512 {
return concrete().toUuid(defaultValue); }
526 {
return concrete().compare(
other); }
527#if 0 && __has_include(<compare>)
531 if (
c > 0)
return std::strong_ordering::greater;
532 if (
c == 0)
return std::strong_ordering::equivalent;
533 return std::strong_ordering::less;
539 {
return !(*
this ==
other); }
547#if QT_CONFIG(cborstreamwriter)
548 using QCborValueConstRef::toCbor;
550 {
return std::as_const(*this).toCbor(
opt); }
556 {
return std::as_const(*this).toDiagnosticNotation(
opt); }
559 static QCborValue concrete(QCborValueRef that)
noexcept;
560 QCborValue concrete() const noexcept {
return concrete(*
this); }
563 QCborValue::Type concreteType() const noexcept {
return concreteType(*
this); }
583 QT7_ONLY(Q_CORE_EXPORT)
static void assign(QCborValueRef that,
const QCborValue &
other);
584 QT7_ONLY(Q_CORE_EXPORT)
static void assign(QCborValueRef that,
QCborValue &&
other);
585 QT7_ONLY(Q_CORE_EXPORT)
static void assign(QCborValueRef that,
const QCborValueRef
other);
593#if !defined(QT_NO_DEBUG_STREAM)
597#ifndef QT_NO_DATASTREAM
598#if QT_CONFIG(cborstreamwriter)
606#if defined(QT_X11_DEFINES_FOUND)
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QVariant toVariant() const
QCborValueConstRef & operator=(const QCborValueConstRef &)=delete
bool operator!=(const QCborValue &other) const
bool toBool(bool defaultValue=false) const
QCborValue taggedValue(const QCborValue &defaultValue=QCborValue()) const
bool operator<(const QCborValue &other) const
QCborSimpleType toSimpleType(QCborSimpleType defaultValue=QCborSimpleType::Undefined) const
QDateTime toDateTime(const QDateTime &defaultValue={}) 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
bool operator==(const QCborValue &other) const
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt=QCborValue::Compact) const
int compare(const QCborValue &other) const
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
double toDouble(double defaultValue=0) const
\inmodule QtCore\reentrant
bool isUndefined() const
Returns true if this QCborValue is of the undefined type.
bool isSimpleType() const
Returns true if this QCborValue is of one of the CBOR simple types.
bool isDateTime() const
Returns true if this QCborValue is of the date/time type.
bool isString() const
Returns true if this QCborValue is of the string type.
bool operator==(const QCborValue &other) const noexcept
Compares this value and other, and returns true if they hold the same contents, false otherwise.
EncodingOption
This enum is used in the options argument to toCbor(), modifying the behavior of the encoder.
bool isNull() const
Returns true if this QCborValue is of the null type.
bool operator!=(const QCborValue &other) const noexcept
Compares this value and other, and returns true if contents differ, false otherwise.
QCborValue(QCborSimpleType st)
Creates a QCborValue of simple type st.
QCborValue(QCborKnownTags t_, const QCborValue &tv=QCborValue())
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCborValue(double v)
Creates a QCborValue with floating point value d.
QCborValue(QCborValue &&other) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCborValue(Type t_)
Creates a QCborValue of type t_.
bool isUrl() const
Returns true if this QCborValue is of the URL type.
bool isByteArray() const
Returns true if this QCborValue is of the byte array type.
qint64 toInteger(qint64 defaultValue=0) const
Returns the integer value stored in this QCborValue, if it is of the integer type.
Type
This enum represents the QCborValue type.
bool operator<(const QCborValue &other) const
Compares this value and other, and returns true if this value should be sorted before other,...
~QCborValue()
Disposes of the current QCborValue object and frees any associated resources.
bool isBool() const
Returns true if this QCborValue is a boolean.
bool isRegularExpression() const
Returns true if this QCborValue contains a regular expression's pattern.
bool isDouble() const
Returns true if this QCborValue is of the floating-point type.
bool isContainer() const
This convenience function returns true if the QCborValue is either an array or a map.
bool isInvalid() const
Returns true if this QCborValue is not of any valid type.
QCborValue(bool b_)
Creates a QCborValue with boolean value b.
bool isInteger() const
Returns true if this QCborValue is of the integer type.
Type type() const
Returns the type of this QCborValue.
double toDouble(double defaultValue=0) const
Returns the floating point value stored in this QCborValue, if it is of the Double type.
QCborSimpleType toSimpleType(QCborSimpleType defaultValue=QCborSimpleType::Undefined) const
Returns the simple type this QCborValue is of, if it is a simple type.
bool isTag() const
Returns true if this QCborValue is of the tag type.
bool isArray() const
Returns true if this QCborValue is of the array type.
QCborValue(qint64 i)
Creates a QCborValue with integer value i.
bool isUuid() const
Returns true if this QCborValue contains a UUID.
QCborValue(std::nullptr_t)
Creates a QCborValue of the \l {Type}{Null} type.
QCborValue(const void *)=delete
bool isTrue() const
Returns true if this QCborValue is a boolean with true value.
bool isFalse() const
Returns true if this QCborValue is a boolean with false value.
bool isSimpleType(QCborSimpleType st) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QT_ASCII_CAST_WARN QCborValue(const char *s)
bool isMap() const
Returns true if this QCborValue is of the map type.
DiagnosticNotationOption
This enum is used in the option argument to toDiagnosticNotation(), to modify the output format.
QCborValue taggedValue(const QCborValue &defaultValue=QCborValue()) const
Returns the tagged value of this extended QCborValue object, if it is of the tag type,...
bool toBool(bool defaultValue=false) const
Returns the boolean value stored in this QCborValue, if it is of a boolean type.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore \reentrant
QSharedData & operator=(const QSharedData &)=delete
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
void toByteArray(QByteArray &)
QT_WARNING_PUSH class QT6_ONLY(Q_CORE_EXPORT) QCborValueRef QT_WARNING_POP Q_CORE_EXPORT size_t qHash(const QCborValue &value, size_t seed=0)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborValue &v)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QCborValue &)
#define Q_DECL_PURE_FUNCTION
#define QT_WARNING_DISABLE_MSVC(number)
constexpr bool operator!=(const timespec &t1, const timespec &t2)
AudioChannelLayoutTag tag
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
QT_BEGIN_NAMESPACE class QT6_ONLY(Q_CORE_EXPORT) QReadWriteLock
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
#define QT_ASCII_CAST_WARN
static int compare(quint64 a, quint64 b)
QList< QPair< QString, QString > > Map
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, bool createJSValueForObjectsAndSymbols, V4ObjectSet *visitedObjects)
static double toDouble(Value v)
QUrl url("example.com")
[constructor-url-reference]
value toMap().value(key)
[3]
value isSimpleType(QCborSimpleType(12))
[1]
char * toString(const MyType &t)
[31]
\inmodule QtCore \inheaderfile QtCborCommon \reentrant
QString toString() const
Returns a text string that matches the error code in this QCborError object.
\inmodule QtCore\reentrant
QString errorString() const
\variable QCborParserError::offset
QT_BEGIN_NAMESPACE bool toBool(const QString &str)