Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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{
65public:
66 enum Code : int {
67 UnknownError = 1,
68 AdvancePastEnd = 3,
69 InputOutputError = 4,
70 GarbageAtEnd = 256,
77
78 InvalidUtf8String = 516,
79
80 DataTooLarge = 1024,
83
84 NoError = 0
85 };
86 Q_ENUM(Code)
87
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
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:46
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &ds, QCborSimpleType &st)
QCborKnownTags
Definition qcborcommon.h:31
bool operator!=(QCborTag t, QCborKnownTags kt)
Definition qcborcommon.h:59
QCborTag
Definition qcborcommon.h:30
size_t qHash(QCborSimpleType tag, size_t seed=0)
Q_CORE_EXPORT QDebug operator<<(QDebug, QCborSimpleType st)
bool operator==(QCborTag t, QCborKnownTags kt)
Definition qcborcommon.h:57
QCborSimpleType
Definition qcborcommon.h:23
QCborNegativeInteger
AudioChannelLayoutTag tag
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1388
const GLubyte * c
GLdouble GLdouble t
Definition qopenglext.h:243
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
@ NoError
Definition main.cpp:34
#define Q_ENUM(x)
#define Q_GADGET
unsigned long long quint64
Definition qtypes.h:61
unsigned char quint8
Definition qtypes.h:46
char * toString(const MyType &t)
[31]
\inmodule QtCore \inheaderfile QtCborCommon \reentrant
Definition qcborcommon.h:63
Code
This enum contains the possible error condition codes.
Definition qcborcommon.h:66
@ IllegalSimpleType
Definition qcborcommon.h:76