Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qcborstreamwriter.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
QCBORSTREAMWRITER_H
6
#
define
QCBORSTREAMWRITER_H
7
8
#
include
<
QtCore
/
qbytearray
.
h
>
9
#
include
<
QtCore
/
qcborcommon
.
h
>
10
#
include
<
QtCore
/
qscopedpointer
.
h
>
11
#
include
<
QtCore
/
qstring
.
h
>
12
#
include
<
QtCore
/
qstringview
.
h
>
13
#
ifndef
QT_BOOTSTRAPPED
14
#
include
<
QtCore
/
qfloat16
.
h
>
15
#
endif
16
17
#
include
<
memory
>
18
19
QT_REQUIRE_CONFIG
(
cborstreamwriter
);
20
21
/* X11 headers use these values too, but as defines */
22
#
if
defined
(
False
)
&&
defined
(
True
)
23
#
undef
True
24
#
undef
False
25
#
endif
26
27
QT_BEGIN_NAMESPACE
28
29
class
QIODevice;
30
31
class
QCborStreamWriterPrivate
;
32
class
Q_CORE_EXPORT
QCborStreamWriter
33
{
34
public
:
35
explicit
QCborStreamWriter(QIODevice *device);
36
explicit
QCborStreamWriter(QByteArray *data);
37
~QCborStreamWriter();
38
Q_DISABLE_COPY(QCborStreamWriter)
39
40
void
setDevice(QIODevice *device);
41
QIODevice *device()
const
;
42
43
void
append(quint64 u);
44
void
append(qint64 i);
45
void
append(QCborNegativeInteger n);
46
#
if
!
QT_CORE_REMOVED_SINCE
(
6
,
10
)
// wasn't a template until 6.10
47
Q_WEAK_OVERLOAD
48
#
endif
49
void
append(
const
QByteArray &ba) { appendByteString(ba.constData(), ba.size()); }
50
void
append(QByteArrayView ba) { appendByteString(ba.data(), ba.size()); }
51
void
append(QLatin1StringView str);
52
void
append(QStringView str);
53
void
append(QUtf8StringView str) { appendTextString(str.data(), str.size()); }
54
void
append(QCborTag tag);
55
void
append(QCborKnownTags tag) { append(QCborTag(tag)); }
56
void
append(QCborSimpleType st);
57
void
append(std::nullptr_t) { append(QCborSimpleType::Null); }
58
#
ifndef
QT_BOOTSTRAPPED
59
void
append(qfloat16 f);
60
#
endif
61
void
append(
float
f);
62
void
append(
double
d);
63
64
void
appendByteString(
const
char
*data, qsizetype len);
65
void
appendTextString(
const
char
*utf8, qsizetype len);
66
67
// convenience
68
void
append(
bool
b) { append(b ? QCborSimpleType::True : QCborSimpleType::False); }
69
void
appendNull() { append(QCborSimpleType::Null); }
70
void
appendUndefined() { append(QCborSimpleType::Undefined); }
71
72
#
ifndef
Q_QDOC
73
// overloads to make normal code not complain
74
void
append(
int
i) { append(qint64(i)); }
75
void
append(uint u) { append(quint64(u)); }
76
#
endif
77
#
ifndef
QT_NO_CAST_FROM_ASCII
78
void
append(
const
char
*str, qsizetype size = -1)
79
{ appendTextString(str, (str && size == -1) ?
int
(strlen(str)) : size); }
80
#
endif
81
82
void
startArray();
83
void
startArray(quint64 count);
84
bool
endArray();
85
void
startMap();
86
void
startMap(quint64 count);
87
bool
endMap();
88
89
// no API for encoding chunked strings
90
91
private
:
92
std::unique_ptr<QCborStreamWriterPrivate> d;
93
};
94
95
QT_END_NAMESPACE
96
97
#
endif
// QCBORSTREAMWRITER_H
QCborStreamWriterPrivate
Definition
qcborstreamwriter.cpp:175
QCborStreamWriterPrivate::IndefiniteLength
static constexpr quint64 IndefiniteLength
Definition
qcborstreamwriter.cpp:177
QCborStreamWriterPrivate::encoder
CborEncoder encoder
Definition
qcborstreamwriter.cpp:180
QCborStreamWriterPrivate::~QCborStreamWriterPrivate
~QCborStreamWriterPrivate()
Definition
qcborstreamwriter.cpp:190
QCborStreamWriterPrivate::containerStack
QStack< CborEncoder > containerStack
Definition
qcborstreamwriter.cpp:181
QCborStreamWriterPrivate::executeAppend
void executeAppend(CborError(*f)(CborEncoder *, Args...), Args... args)
Definition
qcborstreamwriter.cpp:196
QCborStreamWriterPrivate::QCborStreamWriterPrivate
QCborStreamWriterPrivate(QIODevice *device)
Definition
qcborstreamwriter.cpp:184
QCborStreamWriterPrivate::closeContainer
bool closeContainer()
Definition
qcborstreamwriter.cpp:217
QCborStreamWriterPrivate::createContainer
void createContainer(CborError(*f)(CborEncoder *, CborEncoder *, size_t), quint64 len=IndefiniteLength)
Definition
qcborstreamwriter.cpp:201
QCborStreamWriterPrivate::deleteDevice
bool deleteDevice
Definition
qcborstreamwriter.cpp:182
QCborStreamWriterPrivate::device
QIODevice * device
Definition
qcborstreamwriter.cpp:179
QCborStreamWriter
\inmodule QtCore\reentrant
Definition
qcborstreamwriter.h:33
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qt_cbor_encoder_write_callback
static QT_BEGIN_NAMESPACE CborError qt_cbor_encoder_write_callback(void *token, const void *data, size_t len, CborEncoderAppendType)
Definition
qcborstreamwriter.cpp:240
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(cborstreamwriter)
qtbase
src
corelib
serialization
qcborstreamwriter.h
Generated on
for Qt by
1.18.0