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// Qt-Security score:critical reason:data-parser
4
5#ifndef QCBORCOMMON_H
6#define QCBORCOMMON_H
7
8#include <QtCore/qobjectdefs.h>
9#include <QtCore/qmetatype.h>
10#include <QtCore/qshareddata.h>
11
12#if 0
13#pragma qt_class(QtCborCommon)
14#endif
15
16/* X11 headers use these values too, but as defines */
17#if defined(False) && defined(True)
18# undef True
19# undef False
20#endif
21
23
24class QDebug;
25
27QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QCborContainerPrivate) // defined in qcborvalue.cpp
28
29enum class QCborSimpleType : quint8 {
30 False = 20,
31 True = 21,
32 Null = 22,
34};
35
36enum class QCborTag : quint64 {};
62
63inline bool operator==(QCborTag t, QCborKnownTags kt) { return quint64(t) == quint64(kt); }
64inline bool operator==(QCborKnownTags kt, QCborTag t) { return quint64(t) == quint64(kt); }
65inline bool operator!=(QCborTag t, QCborKnownTags kt) { return quint64(t) != quint64(kt); }
66inline bool operator!=(QCborKnownTags kt, QCborTag t) { return quint64(t) != quint64(kt); }
67
68struct Q_CORE_EXPORT QCborError
69{
70 Q_GADGET
71public:
72 enum Code : int {
73 UnknownError = 1,
74 AdvancePastEnd = 3,
75 InputOutputError = 4,
76 GarbageAtEnd = 256,
77 EndOfFile,
78 UnexpectedBreak,
79 UnknownType,
80 IllegalType,
81 IllegalNumber,
82 IllegalSimpleType,
83
84 InvalidUtf8String = 516,
85
86 DataTooLarge = 1024,
87 NestingTooDeep,
88 UnsupportedType,
89
90 NoError = 0
91 };
92 Q_ENUM(Code)
93
94 Code c;
95 operator Code() const { return c; }
96 QString toString() const;
97};
98
99#if !defined(QT_NO_DEBUG_STREAM)
100Q_CORE_EXPORT QDebug operator<<(QDebug, QCborSimpleType st);
101Q_CORE_EXPORT QDebug operator<<(QDebug, QCborKnownTags tg);
102Q_CORE_EXPORT QDebug operator<<(QDebug, QCborTag tg);
103#endif
104
105#if !defined(QT_NO_DATASTREAM)
106Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, QCborSimpleType st);
107Q_CORE_EXPORT QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st);
108#endif
109
110inline size_t qHash(QCborSimpleType tag, size_t seed = 0)
111{
112 return qHash(quint8(tag), seed);
113}
114
115inline size_t qHash(QCborTag tag, size_t seed = 0)
116{
117 return qHash(quint64(tag), seed);
118}
119
121
123
124QT_DECL_METATYPE_EXTERN(QCborTag, Q_CORE_EXPORT)
125
126#endif // QCBORSTREAM_H
\inmodule QtCore\reentrant
Definition qdatastream.h:50
\inmodule QtCore
Definition qmetatype.h:339
QDataStream & operator>>(QDataStream &s, QVariant &p)
\keyword 16-bit Floating Point Support\inmodule QtCore \inheaderfile QFloat16
Definition qfloat16.h:48
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)
size_t qHash(QCborTag tag, size_t seed=0)
QCborKnownTags
Definition qcborcommon.h:37
bool operator!=(QCborTag t, QCborKnownTags kt)
Definition qcborcommon.h:65
bool operator!=(QCborKnownTags kt, QCborTag t)
Definition qcborcommon.h:66
QCborTag
Definition qcborcommon.h:36
size_t qHash(QCborSimpleType tag, size_t seed=0)
bool operator==(QCborKnownTags kt, QCborTag t)
Definition qcborcommon.h:64
bool operator==(QCborTag t, QCborKnownTags kt)
Definition qcborcommon.h:63
QCborSimpleType
Definition qcborcommon.h:29
QCborNegativeInteger
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1370
constexpr int Qt6ToQt5GuiTypeDelta
static bool qIsFloatingPoint(uint tp)
static QPartialOrdering numericCompare(const QVariant::Private *d1, const QVariant::Private *d2)
constexpr int Qt5QQuaternion
static bool qIsNumericType(uint tp)
@ MapFromThreeCount
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)
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:23
static QVariant::PrivateShared * customConstructShared(size_t size, size_t align, F &&construct)
Definition qvariant_p.h:37
\inmodule QtCore \inheaderfile QtCborCommon \reentrant
Definition qcborcommon.h:69