QtBase  v6.3.1
qcborvalue.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 Intel Corporation.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QCBORVALUE_H
41 #define QCBORVALUE_H
42 
43 #include <QtCore/qbytearray.h>
44 #include <QtCore/qdatetime.h>
45 #include <QtCore/qcborcommon.h>
46 #if QT_CONFIG(regularexpression)
47 # include <QtCore/qregularexpression.h>
48 #endif
49 #include <QtCore/qstring.h>
50 #include <QtCore/qstringview.h>
51 #include <QtCore/qurl.h>
52 #include <QtCore/quuid.h>
53 #include <QtCore/qvariant.h>
54 
55 /* X11 headers use these values too, but as defines */
56 #if defined(False) && defined(True)
57 # undef True
58 # undef False
59 #endif
60 
61 #if 0 && __has_include(<compare>)
62 # include <compare>
63 #endif
64 
66 
67 class QCborArray;
68 class QCborMap;
69 class QCborStreamReader;
70 class QCborStreamWriter;
71 class QDataStream;
72 
73 namespace QJsonPrivate { class Value; }
74 
76 {
79 
80  QString errorString() const { return error.toString(); }
81 };
82 
83 class QCborValueRef;
85 class Q_CORE_EXPORT QCborValue
86 {
87  Q_GADGET
88 public:
90  SortKeysInMaps = 0x01,
91  UseFloat = 0x02,
92 #ifndef QT_BOOTSTRAPPED
93  UseFloat16 = UseFloat | 0x04,
94 #endif
95  UseIntegers = 0x08,
96 
98  };
99  Q_DECLARE_FLAGS(EncodingOptions, EncodingOption)
100 
102  Compact = 0x00,
103  LineWrapped = 0x01,
104  ExtendedFormat = 0x02
105  };
106  Q_DECLARE_FLAGS(DiagnosticNotationOptions, DiagnosticNotationOption)
107 
108  // different from QCborStreamReader::Type because we have more types
109  enum Type : int {
110  Integer = 0x00,
111  ByteArray = 0x40,
112  String = 0x60,
113  Array = 0x80,
114  Map = 0xa0,
115  Tag = 0xc0,
116 
117  // range 0x100 - 0x1ff for Simple Types
118  SimpleType = 0x100,
123 
124  Double = 0x202,
125 
126  // extended (tagged) types
127  DateTime = 0x10000,
128  Url = 0x10020,
129  RegularExpression = 0x10023,
130  Uuid = 0x10025,
131 
132  Invalid = -1
133  };
134  Q_ENUM(Type)
135 
137  QCborValue(Type t_) : t(t_) {}
138  QCborValue(std::nullptr_t) : t(Null) {}
139  QCborValue(bool b_) : t(b_ ? True : False) {}
140 #ifndef Q_QDOC
142  QCborValue(unsigned u) : QCborValue(qint64(u)) {}
143 #endif
144  QCborValue(qint64 i) : n(i), t(Integer) {}
145  QCborValue(double v) : t(Double) { memcpy(&n, &v, sizeof(n)); }
146  QCborValue(QCborSimpleType st) : t(type_helper(st)) {}
147 
148  QCborValue(const QByteArray &ba);
149 #if QT_STRINGVIEW_LEVEL < 2
150  QCborValue(const QString &s);
151 #endif
154 #ifndef QT_NO_CAST_FROM_ASCII
155  QT_ASCII_CAST_WARN QCborValue(const char *s) : QCborValue(QString::fromUtf8(s)) {}
156 #endif
157  QCborValue(const QCborArray &a);
159  QCborValue(const QCborMap &m);
160  QCborValue(QCborMap &&m);
161  QCborValue(QCborTag tag, const QCborValue &taggedValue = QCborValue());
163  : QCborValue(QCborTag(t_), tv)
164  {}
165 
166  explicit QCborValue(const QDateTime &dt);
167 #ifndef QT_BOOTSTRAPPED
168  explicit QCborValue(const QUrl &url);
169 #endif
170 #if QT_CONFIG(regularexpression)
171  explicit QCborValue(const QRegularExpression &rx);
172 #endif
173  explicit QCborValue(const QUuid &uuid);
174 
175  ~QCborValue() { if (container) dispose(); }
176 
177  // make sure const char* doesn't go call the bool constructor
178  QCborValue(const void *) = delete;
179 
180  QCborValue(const QCborValue &other);
182  : n(other.n), container(qExchange(other.container, nullptr)), t(qExchange(other.t, Undefined))
183  {
184  }
185  QCborValue &operator=(const QCborValue &other);
187 
189  {
190  std::swap(n, other.n);
191  qt_ptr_swap(container, other.container);
192  std::swap(t, other.t);
193  }
194 
195  Type type() const { return t; }
196  bool isInteger() const { return type() == Integer; }
197  bool isByteArray() const { return type() == ByteArray; }
198  bool isString() const { return type() == String; }
199  bool isArray() const { return type() == Array; }
200  bool isMap() const { return type() == Map; }
201  bool isTag() const { return isTag_helper(type()); }
202  bool isFalse() const { return type() == False; }
203  bool isTrue() const { return type() == True; }
204  bool isBool() const { return isFalse() || isTrue(); }
205  bool isNull() const { return type() == Null; }
206  bool isUndefined() const { return type() == Undefined; }
207  bool isDouble() const { return type() == Double; }
208  bool isDateTime() const { return type() == DateTime; }
209  bool isUrl() const { return type() == Url; }
210  bool isRegularExpression() const { return type() == RegularExpression; }
211  bool isUuid() const { return type() == Uuid; }
212  bool isInvalid() const { return type() == Invalid; }
213  bool isContainer() const { return isMap() || isArray(); }
214 
215  bool isSimpleType() const
216  {
217  return int(type()) >> 8 == int(SimpleType) >> 8;
218  }
220  {
221  return type() == type_helper(st);
222  }
224  {
225  return isSimpleType() ? QCborSimpleType(type() & 0xff) : defaultValue;
226  }
227 
228  qint64 toInteger(qint64 defaultValue = 0) const
229  { return isInteger() ? value_helper() : isDouble() ? qint64(fp_helper()) : defaultValue; }
230  bool toBool(bool defaultValue = false) const
231  { return isBool() ? isTrue() : defaultValue; }
232  double toDouble(double defaultValue = 0) const
233  { return isDouble() ? fp_helper() : isInteger() ? double(value_helper()) : defaultValue; }
234 
235  QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const;
236  QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const;
237 
238  QByteArray toByteArray(const QByteArray &defaultValue = {}) const;
239  QString toString(const QString &defaultValue = {}) const;
240  QDateTime toDateTime(const QDateTime &defaultValue = {}) const;
241  QUrl toUrl(const QUrl &defaultValue = {}) const;
242 #if QT_CONFIG(regularexpression)
243  QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const;
244 #endif
245  QUuid toUuid(const QUuid &defaultValue = {}) const;
246 
247  // only forward-declared, need split functions
248  QCborArray toArray() const;
249  QCborArray toArray(const QCborArray &defaultValue) const;
250  QCborMap toMap() const;
251  QCborMap toMap(const QCborMap &defaultValue) const;
252 
253  const QCborValue operator[](const QString &key) const;
254  const QCborValue operator[](QLatin1String key) const;
255  const QCborValue operator[](qint64 key) const;
256  QCborValueRef operator[](qint64 key);
257  QCborValueRef operator[](QLatin1String key);
258  QCborValueRef operator[](const QString & key);
259 
260  int compare(const QCborValue &other) const;
261 #if 0 && __has_include(<compare>)
262  std::strong_ordering operator<=>(const QCborValue &other) const
263  {
264  int c = compare(other);
265  if (c > 0) return std::partial_ordering::greater;
266  if (c == 0) return std::partial_ordering::equivalent;
267  return std::partial_ordering::less;
268  }
269 #else
270  bool operator==(const QCborValue &other) const noexcept
271  { return compare(other) == 0; }
272  bool operator!=(const QCborValue &other) const noexcept
273  { return !(*this == other); }
274  bool operator<(const QCborValue &other) const
275  { return compare(other) < 0; }
276 #endif
277 
278  static QCborValue fromVariant(const QVariant &variant);
279  QVariant toVariant() const;
280  static QCborValue fromJsonValue(const QJsonValue &v);
281  QJsonValue toJsonValue() const;
282 
283 #if QT_CONFIG(cborstreamreader)
284  static QCborValue fromCbor(QCborStreamReader &reader);
285  static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr);
286  static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr)
287  { return fromCbor(QByteArray(data, int(len)), error); }
288  static QCborValue fromCbor(const quint8 *data, qsizetype len, QCborParserError *error = nullptr)
289  { return fromCbor(QByteArray(reinterpret_cast<const char *>(data), int(len)), error); }
290 #endif // QT_CONFIG(cborstreamreader)
291 #if QT_CONFIG(cborstreamwriter)
292  QByteArray toCbor(EncodingOptions opt = NoTransformation) const;
293  void toCbor(QCborStreamWriter &writer, EncodingOptions opt = NoTransformation) const;
294 #endif
295 
296  QString toDiagnosticNotation(DiagnosticNotationOptions opts = Compact) const;
297 
298 private:
299  friend class QCborValueRef;
300  friend class QCborContainerPrivate;
301  friend class QJsonPrivate::Value;
302 
303  qint64 n = 0;
304  QCborContainerPrivate *container = nullptr;
305  Type t = Undefined;
306 
307  void dispose();
308  qint64 value_helper() const
309  {
310  return n;
311  }
312 
313  double fp_helper() const
314  {
315  static_assert(sizeof(double) == sizeof(n));
316  double d;
317  memcpy(&d, &n, sizeof(d));
318  return d;
319  }
320 
321  constexpr static Type type_helper(QCborSimpleType st)
322  {
323  return Type(quint8(st) | SimpleType);
324  }
325 
326  constexpr static bool isTag_helper(Type tt)
327  {
328  return tt == Tag || tt >= 0x10000;
329  }
330 };
332 
333 class Q_CORE_EXPORT QCborValueRef
334 {
335 public:
336  operator QCborValue() const { return concrete(); }
337 
338  QCborValueRef(const QCborValueRef &) noexcept = default;
341  { assign(*this, other); return *this; }
343  { assign(*this, std::move(other)); other.container = nullptr; return *this; }
345  { assign(*this, other); return *this; }
346 
347  QCborValue::Type type() const { return concreteType(); }
348  bool isInteger() const { return type() == QCborValue::Integer; }
349  bool isByteArray() const { return type() == QCborValue::ByteArray; }
350  bool isString() const { return type() == QCborValue::String; }
351  bool isArray() const { return type() == QCborValue::Array; }
352  bool isMap() const { return type() == QCborValue::Map; }
353  bool isTag() const { return QCborValue::isTag_helper(type()); }
354  bool isFalse() const { return type() == QCborValue::False; }
355  bool isTrue() const { return type() == QCborValue::True; }
356  bool isBool() const { return isFalse() || isTrue(); }
357  bool isNull() const { return type() == QCborValue::Null; }
358  bool isUndefined() const { return type() == QCborValue::Undefined; }
359  bool isDouble() const { return type() == QCborValue::Double; }
360  bool isDateTime() const { return type() == QCborValue::DateTime; }
361  bool isUrl() const { return type() == QCborValue::Url; }
363  bool isUuid() const { return type() == QCborValue::Uuid; }
364  bool isInvalid() const { return type() == QCborValue::Invalid; }
365  bool isContainer() const { return isMap() || isArray(); }
366  bool isSimpleType() const
367  {
368  return type() >= QCborValue::SimpleType && type() < QCborValue::SimpleType + 0x100;
369  }
371  {
372  return type() == QCborValue::type_helper(st);
373  }
374 
375  QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const
376  { return concrete().tag(defaultValue); }
377  QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const
378  { return concrete().taggedValue(defaultValue); }
379 
380  qint64 toInteger(qint64 defaultValue = 0) const
381  { return concrete().toInteger(defaultValue); }
382  bool toBool(bool defaultValue = false) const
383  { return concrete().toBool(defaultValue); }
384  double toDouble(double defaultValue = 0) const
385  { return concrete().toDouble(defaultValue); }
386 
387  QByteArray toByteArray(const QByteArray &defaultValue = {}) const
388  { return concrete().toByteArray(defaultValue); }
389  QString toString(const QString &defaultValue = {}) const
390  { return concrete().toString(defaultValue); }
391  QDateTime toDateTime(const QDateTime &defaultValue = {}) const
392  { return concrete().toDateTime(defaultValue); }
393 #ifndef QT_BOOTSTRAPPED
394  QUrl toUrl(const QUrl &defaultValue = {}) const
395  { return concrete().toUrl(defaultValue); }
396 #endif
397 #if QT_CONFIG(regularexpression)
398  QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const
399  { return concrete().toRegularExpression(defaultValue); }
400 #endif
401  QUuid toUuid(const QUuid &defaultValue = {}) const
402  { return concrete().toUuid(defaultValue); }
403 
404  // only forward-declared, need split functions. Implemented in qcbor{array,map}.h
405  QCborArray toArray() const;
406  QCborArray toArray(const QCborArray &a) const;
407  QCborMap toMap() const;
408  QCborMap toMap(const QCborMap &m) const;
409 
410  const QCborValue operator[](const QString &key) const;
411  const QCborValue operator[](QLatin1String key) const;
412  const QCborValue operator[](qint64 key) const;
413  QCborValueRef operator[](qint64 key);
414  QCborValueRef operator[](QLatin1String key);
415  QCborValueRef operator[](const QString & key);
416 
417  int compare(const QCborValue &other) const
418  { return concrete().compare(other); }
419 #if 0 && __has_include(<compare>)
420  std::strong_ordering operator<=>(const QCborValue &other) const
421  {
422  int c = compare(other);
423  if (c > 0) return std::strong_ordering::greater;
424  if (c == 0) return std::strong_ordering::equivalent;
425  return std::strong_ordering::less;
426  }
427 #else
428  bool operator==(const QCborValue &other) const
429  { return compare(other) == 0; }
430  bool operator!=(const QCborValue &other) const
431  { return !(*this == other); }
432  bool operator<(const QCborValue &other) const
433  { return compare(other) < 0; }
434 #endif
435 
436  QVariant toVariant() const { return concrete().toVariant(); }
437  QJsonValue toJsonValue() const;
438 
439 #if QT_CONFIG(cborstreamwriter)
440  QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation)
441  { return concrete().toCbor(opt); }
442  void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
443 #endif
444 
445  QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact)
446  { return concrete().toDiagnosticNotation(opt); }
447 
448 private:
449  friend class QCborValue;
450  friend class QCborArray;
451  friend class QCborMap;
452  friend class QCborContainerPrivate;
453  friend class QCborValueRefPtr;
454 
455  // static so we can pass this by value
456  static void assign(QCborValueRef that, const QCborValue &other);
457  static void assign(QCborValueRef that, QCborValue &&other);
458  static void assign(QCborValueRef that, const QCborValueRef other);
459  static QCborValue concrete(QCborValueRef that) noexcept;
460  QCborValue concrete() const noexcept { return concrete(*this); }
461 
462  static QCborValue::Type concreteType(QCborValueRef self) noexcept Q_DECL_PURE_FUNCTION;
463  QCborValue::Type concreteType() const noexcept { return concreteType(*this); }
464 
465  // this will actually be invalid...
466  constexpr QCborValueRef() : d(nullptr), i(0) {}
467 
469  : d(dd), i(ii)
470  {}
472  qsizetype i;
473 };
474 
475 Q_CORE_EXPORT size_t qHash(const QCborValue &value, size_t seed = 0);
476 
477 #if !defined(QT_NO_DEBUG_STREAM)
478 Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborValue &v);
479 #endif
480 
481 #ifndef QT_NO_DATASTREAM
482 #if QT_CONFIG(cborstreamwriter)
483 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QCborValue &);
484 #endif
485 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QCborValue &);
486 #endif
487 
489 
490 #if defined(QT_X11_DEFINES_FOUND)
491 # define True 1
492 # define False 0
493 #endif
494 
495 #endif // QCBORVALUE_H
small capitals from c petite p scientific f u
Definition: afcover.h:88
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
@ Double
FT_Error error
Definition: cffdrivr.c:657
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
The QCborArray class is used to hold an array of CBOR elements.
Definition: qcborarray.h:56
The QCborMap class is used to hold an associative container representable in CBOR.
Definition: qcbormap.h:57
The QCborStreamReader class is a simple CBOR stream decoder, operating on either a QByteArray or QIOD...
The QCborStreamWriter class is a simple CBOR encoder operating on a one-way stream.
The QCborValue class encapsulates a value in CBOR.
Definition: qcborvalue.h:86
bool isUndefined() const
Definition: qcborvalue.h:206
bool isSimpleType() const
Definition: qcborvalue.h:215
bool isDateTime() const
Definition: qcborvalue.h:208
bool isString() const
Definition: qcborvalue.h:198
bool operator==(const QCborValue &other) const noexcept
Definition: qcborvalue.h:270
@ NoTransformation
Definition: qcborvalue.h:97
bool isNull() const
Definition: qcborvalue.h:205
bool operator!=(const QCborValue &other) const noexcept
Definition: qcborvalue.h:272
QCborValue(QCborSimpleType st)
Definition: qcborvalue.h:146
QCborValue(QCborKnownTags t_, const QCborValue &tv=QCborValue())
Definition: qcborvalue.h:162
QCborValue(double v)
Definition: qcborvalue.h:145
QCborValue(QCborValue &&other) noexcept
Definition: qcborvalue.h:181
QCborValue(Type t_)
Definition: qcborvalue.h:137
bool isUrl() const
Definition: qcborvalue.h:209
bool isByteArray() const
Definition: qcborvalue.h:197
qint64 toInteger(qint64 defaultValue=0) const
Definition: qcborvalue.h:228
@ RegularExpression
Definition: qcborvalue.h:129
bool operator<(const QCborValue &other) const
Definition: qcborvalue.h:274
bool isBool() const
Definition: qcborvalue.h:204
bool isRegularExpression() const
Definition: qcborvalue.h:210
bool isDouble() const
Definition: qcborvalue.h:207
bool isContainer() const
Definition: qcborvalue.h:213
QCborValue(int i)
Definition: qcborvalue.h:141
bool isInvalid() const
Definition: qcborvalue.h:212
QCborValue(bool b_)
Definition: qcborvalue.h:139
bool isInteger() const
Definition: qcborvalue.h:196
Type type() const
Definition: qcborvalue.h:195
double toDouble(double defaultValue=0) const
Definition: qcborvalue.h:232
QCborSimpleType toSimpleType(QCborSimpleType defaultValue=QCborSimpleType::Undefined) const
Definition: qcborvalue.h:223
bool isTag() const
Definition: qcborvalue.h:201
bool isArray() const
Definition: qcborvalue.h:199
QCborValue(qint64 i)
Definition: qcborvalue.h:144
bool isUuid() const
Definition: qcborvalue.h:211
QCborValue(std::nullptr_t)
Definition: qcborvalue.h:138
QCborValue(const void *)=delete
bool isTrue() const
Definition: qcborvalue.h:203
bool isFalse() const
Definition: qcborvalue.h:202
bool isSimpleType(QCborSimpleType st) const
Definition: qcborvalue.h:219
QT_ASCII_CAST_WARN QCborValue(const char *s)
Definition: qcborvalue.h:155
bool isMap() const
Definition: qcborvalue.h:200
DiagnosticNotationOption
Definition: qcborvalue.h:101
QCborValue taggedValue(const QCborValue &defaultValue=QCborValue()) const
QCborValue(unsigned u)
Definition: qcborvalue.h:142
bool toBool(bool defaultValue=false) const
Definition: qcborvalue.h:230
QCborValueRef & operator=(const QCborValueRef &other)
Definition: qcborvalue.h:344
QUuid toUuid(const QUuid &defaultValue={}) const
Definition: qcborvalue.h:401
bool isMap() const
Definition: qcborvalue.h:352
bool isDouble() const
Definition: qcborvalue.h:359
QCborValue::Type type() const
Definition: qcborvalue.h:347
bool isUrl() const
Definition: qcborvalue.h:361
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt=QCborValue::Compact)
Definition: qcborvalue.h:445
bool isContainer() const
Definition: qcborvalue.h:365
bool isUndefined() const
Definition: qcborvalue.h:358
bool isByteArray() const
Definition: qcborvalue.h:349
QCborValueRef & operator=(QCborValue &&other)
Definition: qcborvalue.h:342
bool isSimpleType() const
Definition: qcborvalue.h:366
bool isString() const
Definition: qcborvalue.h:350
bool isInteger() const
Definition: qcborvalue.h:348
qint64 toInteger(qint64 defaultValue=0) const
Definition: qcborvalue.h:380
bool isTag() const
Definition: qcborvalue.h:353
bool operator<(const QCborValue &other) const
Definition: qcborvalue.h:432
QString toString(const QString &defaultValue={}) const
Definition: qcborvalue.h:389
bool isInvalid() const
Definition: qcborvalue.h:364
QByteArray toByteArray(const QByteArray &defaultValue={}) const
Definition: qcborvalue.h:387
bool isArray() const
Definition: qcborvalue.h:351
double toDouble(double defaultValue=0) const
Definition: qcborvalue.h:384
bool isNull() const
Definition: qcborvalue.h:357
QCborValueRef(const QCborValueRef &) noexcept=default
bool isRegularExpression() const
Definition: qcborvalue.h:362
QCborValue taggedValue(const QCborValue &defaultValue=QCborValue()) const
Definition: qcborvalue.h:377
bool operator==(const QCborValue &other) const
Definition: qcborvalue.h:428
QCborValueRef(QCborValueRef &&) noexcept=default
bool isFalse() const
Definition: qcborvalue.h:354
bool isBool() const
Definition: qcborvalue.h:356
bool isUuid() const
Definition: qcborvalue.h:363
bool operator!=(const QCborValue &other) const
Definition: qcborvalue.h:430
QDateTime toDateTime(const QDateTime &defaultValue={}) const
Definition: qcborvalue.h:391
bool isSimpleType(QCborSimpleType st) const
Definition: qcborvalue.h:370
int compare(const QCborValue &other) const
Definition: qcborvalue.h:417
QUrl toUrl(const QUrl &defaultValue={}) const
Definition: qcborvalue.h:394
bool isTrue() const
Definition: qcborvalue.h:355
QCborTag tag(QCborTag defaultValue=QCborTag(-1)) const
Definition: qcborvalue.h:375
bool isDateTime() const
Definition: qcborvalue.h:360
QVariant toVariant() const
Definition: qcborvalue.h:436
bool toBool(bool defaultValue=false) const
Definition: qcborvalue.h:382
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:66
operator>>(QDataStream &ds, qfloat16 &f)
Definition: qfloat16.cpp:344
operator<<(QDataStream &ds, qfloat16 f)
Definition: qfloat16.cpp:327
The QDateTime class provides date and time functions.
Definition: qdatetime.h:238
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:65
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
static QCborContainerPrivate * container(const QCborValue &v)
Definition: qjson_p.h:206
The QJsonValue class encapsulates a value in JSON.
Definition: qjsonvalue.h:60
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
Definition: qstring.h:84
The QRegularExpression class provides pattern matching using regular expressions.
The QString class provides a Unicode character string.
Definition: qstring.h:388
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
Definition: qstringview.h:122
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:130
The QUuid class stores a Universally Unique Identifier (UUID).
Definition: quuid.h:67
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
VariantOrderedMap Map
Definition: converter.h:70
float rx
QStyleOptionButton opt
auto it unsigned count const
Definition: hb-iter.hh:848
void toString(QString &appendTo, IPv4Address address)
Definition: qipaddress.cpp:131
qsizetype fromUtf8(uchar b, OutputPtr &dst, InputPtr &src, InputPtr end)
default
Definition: devices.py:76
QImageReader reader("image.png")
[1]
void swap(SimpleVector< T > &v1, SimpleVector< T > &v2)
Definition: simplevector.h:331
void
Definition: png.h:1080
QCborKnownTags
Definition: qcborcommon.h:67
QCborTag
Definition: qcborcommon.h:66
QCborSimpleType
Definition: qcborcommon.h:59
#define Q_DECL_PURE_FUNCTION
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition: qflags.h:210
ptrdiff_t qsizetype
Definition: qglobal.h:308
long long qint64
Definition: qglobal.h:298
unsigned char quint8
Definition: qglobal.h:284
#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(Class)
Definition: qglobal.h:556
@ Invalid
Definition: qmetaobject_p.h:68
GLenum type
Definition: qopengl.h:270
GLsizei const GLfloat * v
[13]
const GLfloat * m
GLuint64 key
GLboolean GLboolean GLboolean GLboolean a
[7]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLfloat n
const GLubyte * c
Definition: qopenglext.h:12701
GLenum GLsizei len
Definition: qopenglext.h:3292
GLdouble GLdouble t
[9]
Definition: qopenglext.h:243
GLdouble s
[6]
Definition: qopenglext.h:235
#define Q_ENUM(x)
Definition: qtmetamacros.h:104
#define Q_GADGET
Definition: qtmetamacros.h:193
#define Q_DECLARE_SHARED(TYPE)
Definition: qtypeinfo.h:197
struct DateTime DateTime
Definition: sqlite3.c:22754
QByteArray ba
[0]
QUrl url("http://www.example.com/List of holidays.xml")
[0]
QObject::connect nullptr
QVariant variant
[1]
QCborValue(QCborTag(2), QByteArray("\x01\0\0\0\0\0\0\0\0", 9))
[0]
value toMap().value(key)
[3]
value isSimpleType(QCborSimpleType(12))
[1]
QSharedPointer< T > other(t)
[5]
this swap(other)
QDBusVariant Type
Definition: hb-null.hh:93
The QCborError class holds the error condition found while parsing or validating a CBOR stream.
Definition: qcborcommon.h:99
QString toString() const
The QCborParserError is used by QCborValue to report a parsing error.
Definition: qcborvalue.h:76
QString errorString() const
Definition: qcborvalue.h:80
QCborError error
Definition: qcborvalue.h:78
Definition: data.cpp:95
Definition: moc.h:48
@ NoTransformation
Definition: renderarea.h:64
void compare(Input input, FnUnderTest fn_under_test, const QByteArray &output)
XmlOutput::xml_output tag(const QString &name)
Definition: xmloutput.h:154