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
cbor.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\group cbor
6
\title CBOR Support in Qt
7
\ingroup qt-basic-concepts
8
\brief An overview of CBOR support in Qt.
9
\ingroup explanations-dataprocessingandio
10
11
\ingroup frameworks-technologies
12
13
\keyword CBOR
14
15
Qt provides support for dealing with CBOR data. CBOR is a binary format to
16
store data that has a superset of the types available in JSON, but is more
17
compact.
18
19
The CBOR support in Qt provides an easy to use C++ API to parse,
20
modify and save CBOR data.
21
22
More details about the CBOR data format can be found in \l {RFC 7049}.
23
24
\section1 Overview
25
26
CBOR is a format to store structured data. It has three groups of built-in types:
27
28
\list
29
\li Basic types: integers, floating point, boolean, null, etc.
30
\li String-like types: strings and byte arrays
31
\li Containers: arrays and maps
32
\endlist
33
34
In addition, CBOR can add a "tag" to extend the meaning of the type. The
35
container types can contain basic types, string-like types and containers.
36
37
\sa {Parsing and displaying CBOR data}, {Serialization Converter}, {Saving and Loading a Game}
38
39
\section1 The CBOR Classes
40
41
\section2 The QCborValue Class
42
43
The QCborValue class represents any CBOR type. It also has a simple API for
44
reading and writing to QCborStreamReader and QCborStreamWriter objects, as
45
well as manipulating such objects in memory, with the help of QCborArray
46
and QCborMap. The CborValue API is simplified from the full CBOR data type
47
and always represents all integers as \l qint64 and all floating-point as
48
\c double. This means QCborValue is unable to represent CBOR integer values
49
outside of the range of \l qint64 (-2^63 to 2^63-1). When creating a CBOR
50
stream, QCborValue::toCbor() can be configured to attempt to write the
51
shorter single- and half-precision floating-point representations.
52
53
\section2 The QCborArray Class
54
55
The QCborArray class is used to hold an array of QCborValue objects. A
56
QCborValue object can contain a QCborArray object. It has functions for
57
converting to and from QVariantList, QStringList, QJsonArray.
58
59
\section2 The QCborMap Class
60
61
The QCborMap class is used to hold an map of QCborValue objects. A
62
QCborValue object can contain a QCborMap object. It has functions for
63
converting to and from QVariantMap, QVariantHash, and QJsonObject, but it
64
can have keys of any type, not just QString.
65
66
\section2 The QCborStreamReader Class
67
68
The QCborStreamReader class is a low level API for reading CBOR data from a
69
QIODevice, a QByteArray, or a pointer to memory. It has an API similar to
70
the QXmlStreamReader class.
71
72
\section2 The QCborStreamWriter Class
73
74
The QCborStreamWriter class is a low level API for writing CBOR data to a
75
QIODevice or a QByteArray. It has an API similar to the QXmlStreamWriter
76
class.
77
*/
qtbase
src
corelib
doc
src
cbor.qdoc
Generated on
for Qt by
1.14.0