Warning, file /include/QtCore/qcborvalue.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QCBORVALUE_H
0005 #define QCBORVALUE_H
0006
0007 #include <QtCore/qbytearray.h>
0008 #include <QtCore/qdatetime.h>
0009 #include <QtCore/qcborcommon.h>
0010 #if QT_CONFIG(regularexpression)
0011 # include <QtCore/qregularexpression.h>
0012 #endif
0013 #include <QtCore/qstring.h>
0014 #include <QtCore/qstringview.h>
0015 #include <QtCore/qurl.h>
0016 #include <QtCore/quuid.h>
0017 #include <QtCore/qvariant.h>
0018
0019
0020 #if defined(False) && defined(True)
0021 # undef True
0022 # undef False
0023 #endif
0024
0025 #if 0 && __has_include(<compare>)
0026 # include <compare>
0027 #endif
0028
0029 QT_BEGIN_NAMESPACE
0030
0031 class QCborArray;
0032 class QCborMap;
0033 class QCborStreamReader;
0034 class QCborStreamWriter;
0035 class QDataStream;
0036
0037 namespace QJsonPrivate { class Value; }
0038
0039 struct QCborParserError
0040 {
0041 qint64 offset = 0;
0042 QCborError error = { QCborError::NoError };
0043
0044 QString errorString() const { return error.toString(); }
0045 };
0046
0047 class QCborValueRef;
0048 class QCborContainerPrivate;
0049 class Q_CORE_EXPORT QCborValue
0050 {
0051 Q_GADGET
0052 public:
0053 enum EncodingOption {
0054 SortKeysInMaps = 0x01,
0055 UseFloat = 0x02,
0056 #ifndef QT_BOOTSTRAPPED
0057 UseFloat16 = UseFloat | 0x04,
0058 #endif
0059 UseIntegers = 0x08,
0060
0061 NoTransformation = 0
0062 };
0063 Q_DECLARE_FLAGS(EncodingOptions, EncodingOption)
0064
0065 enum DiagnosticNotationOption {
0066 Compact = 0x00,
0067 LineWrapped = 0x01,
0068 ExtendedFormat = 0x02
0069 };
0070 Q_DECLARE_FLAGS(DiagnosticNotationOptions, DiagnosticNotationOption)
0071
0072
0073 enum Type : int {
0074 Integer = 0x00,
0075 ByteArray = 0x40,
0076 String = 0x60,
0077 Array = 0x80,
0078 Map = 0xa0,
0079 Tag = 0xc0,
0080
0081
0082 SimpleType = 0x100,
0083 False = SimpleType + int(QCborSimpleType::False),
0084 True = SimpleType + int(QCborSimpleType::True),
0085 Null = SimpleType + int(QCborSimpleType::Null),
0086 Undefined = SimpleType + int(QCborSimpleType::Undefined),
0087
0088 Double = 0x202,
0089
0090
0091 DateTime = 0x10000,
0092 Url = 0x10020,
0093 RegularExpression = 0x10023,
0094 Uuid = 0x10025,
0095
0096 Invalid = -1
0097 };
0098 Q_ENUM(Type)
0099
0100 QCborValue() {}
0101 QCborValue(Type t_) : t(t_) {}
0102 QCborValue(std::nullptr_t) : t(Null) {}
0103 QCborValue(bool b_) : t(b_ ? True : False) {}
0104 #ifndef Q_QDOC
0105 QCborValue(int i) : QCborValue(qint64(i)) {}
0106 QCborValue(unsigned u) : QCborValue(qint64(u)) {}
0107 #endif
0108 QCborValue(qint64 i) : n(i), t(Integer) {}
0109 QCborValue(double v) : t(Double) { memcpy(&n, &v, sizeof(n)); }
0110 QCborValue(QCborSimpleType st) : t(type_helper(st)) {}
0111
0112 QCborValue(const QByteArray &ba);
0113 QCborValue(const QString &s);
0114 QCborValue(QStringView s);
0115 QCborValue(QLatin1StringView s);
0116 #ifndef QT_NO_CAST_FROM_ASCII
0117 QT_ASCII_CAST_WARN QCborValue(const char *s) : QCborValue(QString::fromUtf8(s)) {}
0118 #endif
0119 QCborValue(const QCborArray &a);
0120 QCborValue(QCborArray &&a);
0121 QCborValue(const QCborMap &m);
0122 QCborValue(QCborMap &&m);
0123 QCborValue(QCborTag tag, const QCborValue &taggedValue = QCborValue());
0124 QCborValue(QCborKnownTags t_, const QCborValue &tv = QCborValue())
0125 : QCborValue(QCborTag(t_), tv)
0126 {}
0127
0128 explicit QCborValue(const QDateTime &dt);
0129 #ifndef QT_BOOTSTRAPPED
0130 explicit QCborValue(const QUrl &url);
0131 # if QT_CONFIG(regularexpression)
0132 explicit QCborValue(const QRegularExpression &rx);
0133 # endif
0134 explicit QCborValue(const QUuid &uuid);
0135 #endif
0136
0137 ~QCborValue() { if (container) dispose(); }
0138
0139
0140 QCborValue(const void *) = delete;
0141
0142 QCborValue(const QCborValue &other) noexcept;
0143 QCborValue(QCborValue &&other) noexcept
0144 : n(other.n), container(std::exchange(other.container, nullptr)), t(std::exchange(other.t, Undefined))
0145 {
0146 }
0147 QCborValue &operator=(const QCborValue &other) noexcept;
0148 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCborValue)
0149
0150 void swap(QCborValue &other) noexcept
0151 {
0152 std::swap(n, other.n);
0153 qt_ptr_swap(container, other.container);
0154 std::swap(t, other.t);
0155 }
0156
0157 Type type() const { return t; }
0158 bool isInteger() const { return type() == Integer; }
0159 bool isByteArray() const { return type() == ByteArray; }
0160 bool isString() const { return type() == String; }
0161 bool isArray() const { return type() == Array; }
0162 bool isMap() const { return type() == Map; }
0163 bool isTag() const { return isTag_helper(type()); }
0164 bool isFalse() const { return type() == False; }
0165 bool isTrue() const { return type() == True; }
0166 bool isBool() const { return isFalse() || isTrue(); }
0167 bool isNull() const { return type() == Null; }
0168 bool isUndefined() const { return type() == Undefined; }
0169 bool isDouble() const { return type() == Double; }
0170 bool isDateTime() const { return type() == DateTime; }
0171 bool isUrl() const { return type() == Url; }
0172 bool isRegularExpression() const { return type() == RegularExpression; }
0173 bool isUuid() const { return type() == Uuid; }
0174 bool isInvalid() const { return type() == Invalid; }
0175 bool isContainer() const { return isMap() || isArray(); }
0176
0177 bool isSimpleType() const
0178 {
0179 return int(type()) >> 8 == int(SimpleType) >> 8;
0180 }
0181 bool isSimpleType(QCborSimpleType st) const
0182 {
0183 return type() == type_helper(st);
0184 }
0185 QCborSimpleType toSimpleType(QCborSimpleType defaultValue = QCborSimpleType::Undefined) const
0186 {
0187 return isSimpleType() ? QCborSimpleType(type() & 0xff) : defaultValue;
0188 }
0189
0190 qint64 toInteger(qint64 defaultValue = 0) const
0191 { return isInteger() ? value_helper() : isDouble() ? qint64(fp_helper()) : defaultValue; }
0192 bool toBool(bool defaultValue = false) const
0193 { return isBool() ? isTrue() : defaultValue; }
0194 double toDouble(double defaultValue = 0) const
0195 { return isDouble() ? fp_helper() : isInteger() ? double(value_helper()) : defaultValue; }
0196
0197 QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const;
0198 QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const;
0199
0200 QByteArray toByteArray(const QByteArray &defaultValue = {}) const;
0201 QString toString(const QString &defaultValue = {}) const;
0202 QDateTime toDateTime(const QDateTime &defaultValue = {}) const;
0203 #ifndef QT_BOOTSTRAPPED
0204 QUrl toUrl(const QUrl &defaultValue = {}) const;
0205 # if QT_CONFIG(regularexpression)
0206 QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const;
0207 # endif
0208 QUuid toUuid(const QUuid &defaultValue = {}) const;
0209 #endif
0210
0211
0212 QCborArray toArray() const;
0213 QCborArray toArray(const QCborArray &defaultValue) const;
0214 QCborMap toMap() const;
0215 QCborMap toMap(const QCborMap &defaultValue) const;
0216
0217 const QCborValue operator[](const QString &key) const;
0218 const QCborValue operator[](QLatin1StringView key) const;
0219 const QCborValue operator[](qint64 key) const;
0220 QCborValueRef operator[](qint64 key);
0221 QCborValueRef operator[](QLatin1StringView key);
0222 QCborValueRef operator[](const QString & key);
0223
0224 int compare(const QCborValue &other) const;
0225 #if 0 && __has_include(<compare>)
0226 std::strong_ordering operator<=>(const QCborValue &other) const
0227 {
0228 int c = compare(other);
0229 if (c > 0) return std::partial_ordering::greater;
0230 if (c == 0) return std::partial_ordering::equivalent;
0231 return std::partial_ordering::less;
0232 }
0233 #else
0234 bool operator==(const QCborValue &other) const noexcept
0235 { return compare(other) == 0; }
0236 bool operator!=(const QCborValue &other) const noexcept
0237 { return !(*this == other); }
0238 bool operator<(const QCborValue &other) const
0239 { return compare(other) < 0; }
0240 #endif
0241
0242 static QCborValue fromVariant(const QVariant &variant);
0243 QVariant toVariant() const;
0244 static QCborValue fromJsonValue(const QJsonValue &v);
0245 QJsonValue toJsonValue() const;
0246
0247 #if QT_CONFIG(cborstreamreader)
0248 static QCborValue fromCbor(QCborStreamReader &reader);
0249 static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr);
0250 static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr)
0251 { return fromCbor(QByteArray(data, int(len)), error); }
0252 static QCborValue fromCbor(const quint8 *data, qsizetype len, QCborParserError *error = nullptr)
0253 { return fromCbor(QByteArray(reinterpret_cast<const char *>(data), int(len)), error); }
0254 #endif
0255 #if QT_CONFIG(cborstreamwriter)
0256 QByteArray toCbor(EncodingOptions opt = NoTransformation) const;
0257 void toCbor(QCborStreamWriter &writer, EncodingOptions opt = NoTransformation) const;
0258 #endif
0259
0260 QString toDiagnosticNotation(DiagnosticNotationOptions opts = Compact) const;
0261
0262 private:
0263 friend class QCborValueRef;
0264 friend class QCborContainerPrivate;
0265 friend class QJsonPrivate::Value;
0266
0267 qint64 n = 0;
0268 QCborContainerPrivate *container = nullptr;
0269 Type t = Undefined;
0270
0271 void dispose();
0272 qint64 value_helper() const
0273 {
0274 return n;
0275 }
0276
0277 double fp_helper() const
0278 {
0279 static_assert(sizeof(double) == sizeof(n));
0280 double d;
0281 memcpy(&d, &n, sizeof(d));
0282 return d;
0283 }
0284
0285 constexpr static Type type_helper(QCborSimpleType st)
0286 {
0287 return Type(quint8(st) | SimpleType);
0288 }
0289
0290 constexpr static bool isTag_helper(Type tt)
0291 {
0292 return tt == Tag || tt >= 0x10000;
0293 }
0294 };
0295 Q_DECLARE_SHARED(QCborValue)
0296
0297 class QCborValueConstRef
0298 {
0299 public:
0300 QCborValueConstRef(const QCborValueConstRef &) = default;
0301 QCborValueConstRef &operator=(const QCborValueConstRef &) = delete;
0302 operator QCborValue() const { return concrete(); }
0303
0304 QCborValue::Type type() const { return concreteType(*this); }
0305 bool isInteger() const { return type() == QCborValue::Integer; }
0306 bool isByteArray() const { return type() == QCborValue::ByteArray; }
0307 bool isString() const { return type() == QCborValue::String; }
0308 bool isArray() const { return type() == QCborValue::Array; }
0309 bool isMap() const { return type() == QCborValue::Map; }
0310 bool isTag() const { return concrete().isTag(); }
0311 bool isFalse() const { return type() == QCborValue::False; }
0312 bool isTrue() const { return type() == QCborValue::True; }
0313 bool isBool() const { return isFalse() || isTrue(); }
0314 bool isNull() const { return type() == QCborValue::Null; }
0315 bool isUndefined() const { return type() == QCborValue::Undefined; }
0316 bool isDouble() const { return type() == QCborValue::Double; }
0317 bool isDateTime() const { return type() == QCborValue::DateTime; }
0318 bool isUrl() const { return type() == QCborValue::Url; }
0319 bool isRegularExpression() const { return type() == QCborValue::RegularExpression; }
0320 bool isUuid() const { return type() == QCborValue::Uuid; }
0321 bool isInvalid() const { return type() == QCborValue::Invalid; }
0322 bool isContainer() const { return isMap() || isArray(); }
0323 bool isSimpleType() const { return concrete().isSimpleType(); }
0324 bool isSimpleType(QCborSimpleType st) const { return concrete().isSimpleType(st); }
0325
0326 QCborSimpleType toSimpleType(QCborSimpleType defaultValue = QCborSimpleType::Undefined) const
0327 {
0328 return concrete().toSimpleType(defaultValue);
0329 }
0330
0331 QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const
0332 { return concrete().tag(defaultValue); }
0333 QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const
0334 { return concrete().taggedValue(defaultValue); }
0335
0336 qint64 toInteger(qint64 defaultValue = 0) const
0337 { return concrete().toInteger(defaultValue); }
0338 bool toBool(bool defaultValue = false) const
0339 { return concrete().toBool(defaultValue); }
0340 double toDouble(double defaultValue = 0) const
0341 { return concrete().toDouble(defaultValue); }
0342
0343 QByteArray toByteArray(const QByteArray &defaultValue = {}) const
0344 { return concrete().toByteArray(defaultValue); }
0345 QString toString(const QString &defaultValue = {}) const
0346 { return concrete().toString(defaultValue); }
0347 QDateTime toDateTime(const QDateTime &defaultValue = {}) const
0348 { return concrete().toDateTime(defaultValue); }
0349 #ifndef QT_BOOTSTRAPPED
0350 QUrl toUrl(const QUrl &defaultValue = {}) const
0351 { return concrete().toUrl(defaultValue); }
0352 # if QT_CONFIG(regularexpression)
0353 QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const
0354 { return concrete().toRegularExpression(defaultValue); }
0355 # endif
0356 QUuid toUuid(const QUuid &defaultValue = {}) const
0357 { return concrete().toUuid(defaultValue); }
0358 #endif
0359
0360
0361 inline QCborArray toArray() const;
0362 inline QCborArray toArray(const QCborArray &a) const;
0363 inline QCborMap toMap() const;
0364 inline QCborMap toMap(const QCborMap &m) const;
0365
0366 Q_CORE_EXPORT const QCborValue operator[](const QString &key) const;
0367 Q_CORE_EXPORT const QCborValue operator[](QLatin1StringView key) const;
0368 Q_CORE_EXPORT const QCborValue operator[](qint64 key) const;
0369
0370 int compare(const QCborValue &other) const
0371 { return concrete().compare(other); }
0372 #if 0 && __has_include(<compare>)
0373 std::strong_ordering operator<=>(const QCborValue &other) const
0374 {
0375 int c = compare(other);
0376 if (c > 0) return std::strong_ordering::greater;
0377 if (c == 0) return std::strong_ordering::equivalent;
0378 return std::strong_ordering::less;
0379 }
0380 #else
0381 bool operator==(const QCborValue &other) const
0382 { return compare(other) == 0; }
0383 bool operator!=(const QCborValue &other) const
0384 { return !(*this == other); }
0385 bool operator<(const QCborValue &other) const
0386 { return compare(other) < 0; }
0387 #endif
0388
0389 QVariant toVariant() const { return concrete().toVariant(); }
0390 inline QJsonValue toJsonValue() const;
0391
0392 #if QT_CONFIG(cborstreamwriter)
0393 QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation) const
0394 { return concrete().toCbor(opt); }
0395 void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation) const
0396 { return concrete().toCbor(writer, opt); }
0397 #endif
0398
0399 QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact) const
0400 { return concrete().toDiagnosticNotation(opt); }
0401
0402 protected:
0403 friend class QCborValue;
0404 friend class QCborArray;
0405 friend class QCborMap;
0406 friend class QCborContainerPrivate;
0407
0408 QCborValue concrete() const noexcept { return concrete(*this); }
0409
0410 static Q_CORE_EXPORT QCborValue concrete(QCborValueConstRef that) noexcept;
0411 static Q_CORE_EXPORT QCborValue::Type concreteType(QCborValueConstRef that) noexcept Q_DECL_PURE_FUNCTION;
0412 static Q_CORE_EXPORT bool
0413 concreteBoolean(QCborValueConstRef that, bool defaultValue) noexcept Q_DECL_PURE_FUNCTION;
0414 static Q_CORE_EXPORT double
0415 concreteDouble(QCborValueConstRef that, double defaultValue) noexcept Q_DECL_PURE_FUNCTION;
0416 static Q_CORE_EXPORT qint64
0417 concreteIntegral(QCborValueConstRef that, qint64 defaultValue) noexcept Q_DECL_PURE_FUNCTION;
0418 static Q_CORE_EXPORT QByteArray
0419 concreteByteArray(QCborValueConstRef that, const QByteArray &defaultValue);
0420 static Q_CORE_EXPORT QString
0421 concreteString(QCborValueConstRef that, const QString &defaultValue);
0422
0423 constexpr QCborValueConstRef() : d(nullptr), i(0) {}
0424 constexpr QCborValueConstRef(QCborContainerPrivate *dd, qsizetype ii)
0425 : d(dd), i(ii)
0426 {}
0427 QCborContainerPrivate *d;
0428 qsizetype i;
0429 };
0430
0431 QT_WARNING_PUSH
0432 QT6_ONLY(QT_WARNING_DISABLE_MSVC(4275))
0433 class QT6_ONLY(Q_CORE_EXPORT) QCborValueRef : public QCborValueConstRef
0434 {
0435 public:
0436 QCborValueRef(const QCborValueRef &) noexcept = default;
0437 QCborValueRef(QCborValueRef &&) noexcept = default;
0438 QCborValueRef &operator=(const QCborValue &other)
0439 { assign(*this, other); return *this; }
0440 QCborValueRef &operator=(QCborValue &&other)
0441 { assign(*this, std::move(other)); other.container = nullptr; return *this; }
0442 QCborValueRef &operator=(const QCborValueRef &other)
0443 { assign(*this, other); return *this; }
0444
0445 QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](qint64 key);
0446 QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](QLatin1StringView key);
0447 QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](const QString & key);
0448
0449 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
0450
0451
0452
0453 operator QCborValue() const { return concrete(); }
0454 QCborValue::Type type() const { return concreteType(); }
0455 bool isInteger() const { return type() == QCborValue::Integer; }
0456 bool isByteArray() const { return type() == QCborValue::ByteArray; }
0457 bool isString() const { return type() == QCborValue::String; }
0458 bool isArray() const { return type() == QCborValue::Array; }
0459 bool isMap() const { return type() == QCborValue::Map; }
0460 bool isTag() const { return QCborValue::isTag_helper(type()); }
0461 bool isFalse() const { return type() == QCborValue::False; }
0462 bool isTrue() const { return type() == QCborValue::True; }
0463 bool isBool() const { return isFalse() || isTrue(); }
0464 bool isNull() const { return type() == QCborValue::Null; }
0465 bool isUndefined() const { return type() == QCborValue::Undefined; }
0466 bool isDouble() const { return type() == QCborValue::Double; }
0467 bool isDateTime() const { return type() == QCborValue::DateTime; }
0468 bool isUrl() const { return type() == QCborValue::Url; }
0469 bool isRegularExpression() const { return type() == QCborValue::RegularExpression; }
0470 bool isUuid() const { return type() == QCborValue::Uuid; }
0471 bool isInvalid() const { return type() == QCborValue::Invalid; }
0472 bool isContainer() const { return isMap() || isArray(); }
0473 bool isSimpleType() const
0474 {
0475 return type() >= QCborValue::SimpleType && type() < QCborValue::SimpleType + 0x100;
0476 }
0477 bool isSimpleType(QCborSimpleType st) const
0478 {
0479 return type() == QCborValue::type_helper(st);
0480 }
0481 QCborSimpleType toSimpleType(QCborSimpleType defaultValue = QCborSimpleType::Undefined) const
0482 {
0483 return isSimpleType() ? QCborSimpleType(type() & 0xff) : defaultValue;
0484 }
0485
0486 QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const
0487 { return concrete().tag(defaultValue); }
0488 QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const
0489 { return concrete().taggedValue(defaultValue); }
0490
0491 qint64 toInteger(qint64 defaultValue = 0) const
0492 { return concreteIntegral(*this, defaultValue); }
0493 bool toBool(bool defaultValue = false) const
0494 { return concreteBoolean(*this, defaultValue); }
0495 double toDouble(double defaultValue = 0) const
0496 { return concreteDouble(*this, defaultValue); }
0497
0498 QByteArray toByteArray(const QByteArray &defaultValue = {}) const
0499 { return concreteByteArray(*this, defaultValue); }
0500 QString toString(const QString &defaultValue = {}) const
0501 { return concreteString(*this, defaultValue); }
0502 QDateTime toDateTime(const QDateTime &defaultValue = {}) const
0503 { return concrete().toDateTime(defaultValue); }
0504 #ifndef QT_BOOTSTRAPPED
0505 QUrl toUrl(const QUrl &defaultValue = {}) const
0506 { return concrete().toUrl(defaultValue); }
0507 # if QT_CONFIG(regularexpression)
0508 QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const
0509 { return concrete().toRegularExpression(defaultValue); }
0510 # endif
0511 QUuid toUuid(const QUuid &defaultValue = {}) const
0512 { return concrete().toUuid(defaultValue); }
0513 #endif
0514
0515
0516 QCborArray toArray() const;
0517 QCborArray toArray(const QCborArray &a) const;
0518 QCborMap toMap() const;
0519 QCborMap toMap(const QCborMap &m) const;
0520
0521 const QCborValue operator[](const QString &key) const;
0522 const QCborValue operator[](QLatin1StringView key) const;
0523 const QCborValue operator[](qint64 key) const;
0524
0525 int compare(const QCborValue &other) const
0526 { return concrete().compare(other); }
0527 #if 0 && __has_include(<compare>)
0528 std::strong_ordering operator<=>(const QCborValue &other) const
0529 {
0530 int c = compare(other);
0531 if (c > 0) return std::strong_ordering::greater;
0532 if (c == 0) return std::strong_ordering::equivalent;
0533 return std::strong_ordering::less;
0534 }
0535 #else
0536 bool operator==(const QCborValue &other) const
0537 { return compare(other) == 0; }
0538 bool operator!=(const QCborValue &other) const
0539 { return !(*this == other); }
0540 bool operator<(const QCborValue &other) const
0541 { return compare(other) < 0; }
0542 #endif
0543
0544 QVariant toVariant() const { return concrete().toVariant(); }
0545 QJsonValue toJsonValue() const;
0546
0547 #if QT_CONFIG(cborstreamwriter)
0548 using QCborValueConstRef::toCbor;
0549 QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation)
0550 { return std::as_const(*this).toCbor(opt); }
0551 void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
0552 #endif
0553
0554 using QCborValueConstRef::toDiagnosticNotation;
0555 QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact)
0556 { return std::as_const(*this).toDiagnosticNotation(opt); }
0557
0558 private:
0559 static QCborValue concrete(QCborValueRef that) noexcept;
0560 QCborValue concrete() const noexcept { return concrete(*this); }
0561
0562 static QCborValue::Type concreteType(QCborValueRef self) noexcept Q_DECL_PURE_FUNCTION;
0563 QCborValue::Type concreteType() const noexcept { return concreteType(*this); }
0564
0565
0566 constexpr QCborValueRef() : QCborValueConstRef(nullptr, 0) {}
0567
0568 QCborValueRef(QCborContainerPrivate *dd, qsizetype ii)
0569 : QCborValueConstRef(dd, ii)
0570 {}
0571 #else
0572 private:
0573 using QCborValueConstRef::QCborValueConstRef;
0574 #endif
0575
0576 friend class QCborValue;
0577 friend class QCborArray;
0578 friend class QCborMap;
0579 friend class QCborContainerPrivate;
0580 friend class QCborValueConstRef;
0581
0582
0583 QT7_ONLY(Q_CORE_EXPORT) static void assign(QCborValueRef that, const QCborValue &other);
0584 QT7_ONLY(Q_CORE_EXPORT) static void assign(QCborValueRef that, QCborValue &&other);
0585 QT7_ONLY(Q_CORE_EXPORT) static void assign(QCborValueRef that, const QCborValueRef other);
0586 };
0587 QT_WARNING_POP
0588 Q_DECLARE_OPERATORS_FOR_FLAGS(QCborValue::EncodingOptions)
0589 Q_DECLARE_OPERATORS_FOR_FLAGS(QCborValue::DiagnosticNotationOptions)
0590
0591 Q_CORE_EXPORT size_t qHash(const QCborValue &value, size_t seed = 0);
0592
0593 #if !defined(QT_NO_DEBUG_STREAM)
0594 Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborValue &v);
0595 #endif
0596
0597 #ifndef QT_NO_DATASTREAM
0598 #if QT_CONFIG(cborstreamwriter)
0599 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QCborValue &);
0600 #endif
0601 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QCborValue &);
0602 #endif
0603
0604 QT_END_NAMESPACE
0605
0606 #if defined(QT_X11_DEFINES_FOUND)
0607 # define True 1
0608 # define False 0
0609 #endif
0610
0611 #endif