Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcborcommon.h
Go to the documentation of this file.
1// Copyright (C) 2018 Intel Corporation.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCBORCOMMON_H
5#define QCBORCOMMON_H
6
7#include <QtCore/qobjectdefs.h>
8#include <QtCore/qmetatype.h>
9#include <QtCore/qdebug.h>
10
11#if 0
12#pragma qt_class(QtCborCommon)
13#endif
14
15/* X11 headers use these values too, but as defines */
16#if defined(False) && defined(True)
17# undef True
18# undef False
19#endif
20
22
23enum class QCborSimpleType : quint8 {
24 False = 20,
25 True = 21,
26 Null = 22,
27 Undefined = 23
28};
29
30enum class QCborTag : quint64 {};
31enum class QCborKnownTags {
33 UnixTime_t = 1,
36 Decimal = 4,
37 Bigfloat = 5,
38 COSE_Encrypt0 = 16,
39 COSE_Mac0 = 17,
40 COSE_Sign1 = 18,
42 ExpectedBase64 = 22,
43 ExpectedBase16 = 23,
44 EncodedCbor = 24,
45 Url = 32,
46 Base64url = 33,
47 Base64 = 34,
49 MimeMessage = 36,
50 Uuid = 37,
51 COSE_Encrypt = 96,
52 COSE_Mac = 97,
53 COSE_Sign = 98,
54 Signature = 55799
55};
56
57inline bool operator==(QCborTag t, QCborKnownTags kt) { return quint64(t) == quint64(kt); }
58inline bool operator==(QCborKnownTags kt, QCborTag t) { return quint64(t) == quint64(kt); }
59inline bool operator!=(QCborTag t, QCborKnownTags kt) { return quint64(t) != quint64(kt); }
60inline bool operator!=(QCborKnownTags kt, QCborTag t) { return quint64(t) != quint64(kt); }
61
62struct Q_CORE_EXPORT QCborError
63{
64 Q_GADGET
65public:
66 enum Code : int {
67 UnknownError = 1,
68 AdvancePastEnd = 3,
69 InputOutputError = 4,
70 GarbageAtEnd = 256,
71 EndOfFile,
72 UnexpectedBreak,
73 UnknownType,
74 IllegalType,
75 IllegalNumber,
76 IllegalSimpleType,
77
78 InvalidUtf8String = 516,
79
80 DataTooLarge = 1024,
81 NestingTooDeep,
82 UnsupportedType,
83
84 NoError = 0
85 };
86 Q_ENUM(Code)
87
88 Code c;
89 operator Code() const { return c; }
90 QString toString() const;
91};
92
93#if !defined(QT_NO_DEBUG_STREAM)
94Q_CORE_EXPORT QDebug operator<<(QDebug, QCborSimpleType st);
95Q_CORE_EXPORT QDebug operator<<(QDebug, QCborKnownTags tg);
96Q_CORE_EXPORT QDebug operator<<(QDebug, QCborTag tg);
97#endif
98
99#if !defined(QT_NO_DATASTREAM)
100Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, QCborSimpleType st);
101Q_CORE_EXPORT QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st);
102#endif
103
104inline size_t qHash(QCborSimpleType tag, size_t seed = 0)
105{
106 return qHash(quint8(tag), seed);
107}
108
109inline size_t qHash(QCborTag tag, size_t seed = 0)
110{
111 return qHash(quint64(tag), seed);
112}
113
115
116QT_END_NAMESPACE
117
118QT_DECL_METATYPE_EXTERN(QCborTag, Q_CORE_EXPORT)
119
120// To avoid changing namespace we need to reinstate defines, even though our .cpp
121// will then have to remove them again.
122#if defined(QT_X11_DEFINES_FOUND)
123# define True 1
124# define False 0
125#endif
126
127#endif // QCBORSTREAM_H
\inmodule QtCore\reentrant
Definition qdatastream.h:47
\inmodule QtCore
Definition qmetatype.h:338
QDataStream & operator>>(QDataStream &s, QVariant &p)
\keyword 16-bit Floating Point Support\inmodule QtCore \inheaderfile QFloat16
Definition qfloat16.h:48
Combined button and popup list for selecting options.
bool isDestructible(const QtPrivate::QMetaTypeInterface *iface) noexcept
bool isMoveConstructible(const QtPrivate::QMetaTypeInterface *iface) noexcept
bool isDefaultConstructible(const QtPrivate::QMetaTypeInterface *iface) noexcept
bool isCopyConstructible(const QtPrivate::QMetaTypeInterface *iface) noexcept
void copyConstruct(const QtPrivate::QMetaTypeInterface *iface, void *where, const void *copy)
void destruct(const QtPrivate::QMetaTypeInterface *iface, void *where)
\macro QT_NO_KEYWORDS >
Definition qcompare.h:24
size_t qHash(QCborTag tag, size_t seed=0)
QCborKnownTags
Definition qcborcommon.h:31
bool operator!=(QCborTag t, QCborKnownTags kt)
Definition qcborcommon.h:59
bool operator!=(QCborKnownTags kt, QCborTag t)
Definition qcborcommon.h:60
QCborTag
Definition qcborcommon.h:30
size_t qHash(QCborSimpleType tag, size_t seed=0)
bool operator==(QCborKnownTags kt, QCborTag t)
Definition qcborcommon.h:58
bool operator==(QCborTag t, QCborKnownTags kt)
Definition qcborcommon.h:57
QCborSimpleType
Definition qcborcommon.h:23
QCborNegativeInteger
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2439
constexpr int Qt6ToQt5GuiTypeDelta
static QPartialOrdering spaceShip(Numeric lhs, Numeric rhs)
static bool qIsFloatingPoint(uint tp)
static QPartialOrdering numericCompare(const QVariant::Private *d1, const QVariant::Private *d2)
constexpr int Qt5QQuaternion
static bool qIsNumericType(uint tp)
static bool canBeNumericallyCompared(const QtPrivate::QMetaTypeInterface *iface1, const QtPrivate::QMetaTypeInterface *iface2)
constexpr int Qt5KeySequence
static QPartialOrdering integralCompare(uint promotedType, const QVariant::Private *d1, const QVariant::Private *d2)
@ MapFromThreeCount
static const ushort mapIdFromQt3ToCurrent[MapFromThreeCount]
constexpr int Qt5LastCoreType
T qNumVariantToHelper(const QVariant::Private &d, bool *ok)
constexpr int Qt5FirstGuiType
static bool qvCanConvertMetaObject(QMetaType fromType, QMetaType toType)
constexpr int Qt5RegExp
constexpr int Qt5LastGuiType
static int numericTypePromotion(const QtPrivate::QMetaTypeInterface *iface1, const QtPrivate::QMetaTypeInterface *iface2)
constexpr int Qt5SizePolicy
constexpr int Qt5UserType
static QPartialOrdering pointerCompare(const QVariant::Private *d1, const QVariant::Private *d2)
QT_BEGIN_NAMESPACE auto customConstructSharedImpl(size_t size, size_t align)
Definition qvariant_p.h:22
static QVariant::PrivateShared * customConstructShared(size_t size, size_t align, F &&construct)
Definition qvariant_p.h:36
\inmodule QtCore \inheaderfile QtCborCommon \reentrant
Definition qcborcommon.h:63