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
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
4#ifndef QCBORSTREAMWRITER_H
5#define QCBORSTREAMWRITER_H
6
7#include <QtCore/qbytearray.h>
8#include <QtCore/qcborcommon.h>
9#include <QtCore/qscopedpointer.h>
10#include <QtCore/qstring.h>
11#include <QtCore/qstringview.h>
12#ifndef QT_BOOTSTRAPPED
13#include <QtCore/qfloat16.h>
14#endif
15
16QT_REQUIRE_CONFIG(cborstreamwriter);
17
18/* X11 headers use these values too, but as defines */
19#if defined(False) && defined(True)
20# undef True
21# undef False
22#endif
23
25
26class QIODevice;
27
29class Q_CORE_EXPORT QCborStreamWriter
30{
31public:
35 Q_DISABLE_COPY(QCborStreamWriter)
36
37 void setDevice(QIODevice *device);
38 QIODevice *device() const;
39
40 void append(quint64 u);
41 void append(qint64 i);
43 void append(const QByteArray &ba) { appendByteString(ba.constData(), ba.size()); }
46 void append(QCborTag tag);
48 void append(QCborSimpleType st);
49 void append(std::nullptr_t) { append(QCborSimpleType::Null); }
50#ifndef QT_BOOTSTRAPPED
51 void append(qfloat16 f);
52#endif
53 void append(float f);
54 void append(double d);
55
56 void appendByteString(const char *data, qsizetype len);
57 void appendTextString(const char *utf8, qsizetype len);
58
59 // convenience
63
64#ifndef Q_QDOC
65 // overloads to make normal code not complain
66 void append(int i) { append(qint64(i)); }
67 void append(uint u) { append(quint64(u)); }
68#endif
69#ifndef QT_NO_CAST_FROM_ASCII
70 void append(const char *str, qsizetype size = -1)
71 { appendTextString(str, (str && size == -1) ? int(strlen(str)) : size); }
72#endif
73
74 void startArray();
76 bool endArray();
77 void startMap();
79 bool endMap();
80
81 // no API for encoding chunked strings
82
83private:
84 QScopedPointer<QCborStreamWriterPrivate> d;
85};
86
88
89#if defined(QT_X11_DEFINES_FOUND)
90# define True 1
91# define False 0
92#endif
93
94#endif // QCBORSTREAMWRITER_H
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
Definition qbytearray.h:494
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:124
\inmodule QtCore\reentrant
void append(std::nullptr_t)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void append(const char *str, qsizetype size=-1)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void appendUndefined()
Appends a CBOR Undefined value to the stream.
void append(bool b)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void append(const QByteArray &ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void append(QCborKnownTags tag)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void appendNull()
Appends a CBOR Null value to the stream.
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtCore
Definition qstringview.h:78
\keyword 16-bit Floating Point Support\inmodule QtCore \inheaderfile QFloat16
Definition qfloat16.h:47
QString str
[2]
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
QCborKnownTags
Definition qcborcommon.h:31
QCborTag
Definition qcborcommon.h:30
QCborSimpleType
Definition qcborcommon.h:23
QCborNegativeInteger
AudioChannelLayoutTag tag
GLboolean GLboolean GLboolean b
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLfloat n
GLenum GLsizei len
#define QT_REQUIRE_CONFIG(feature)
unsigned long long quint64
Definition qtypes.h:61
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34
long long qint64
Definition qtypes.h:60
QByteArray ba
[0]
settings endArray()
writer startArray(1)
writer startMap(4)
[0]
writer endMap()