8#include <QtCore/qglobal.h>
9#include <QtCore/qiodevicebase.h>
11#include <QtCore/qobject.h>
13#include <QtCore/qobjectdefs.h>
14#include <QtCore/qscopedpointer.h>
16#include <QtCore/qspan.h>
17#include <QtCore/qstring.h>
20#error qiodevice.h must be included before any header file that defines open
29class QIODevicePrivate;
45 explicit QIODevice(QObject *parent);
49 QIODeviceBase::OpenMode openMode()
const;
51 void setTextModeEnabled(
bool enabled);
52 bool isTextModeEnabled()
const;
55 bool isReadable()
const;
56 bool isWritable()
const;
57 virtual bool isSequential()
const;
59 int readChannelCount()
const;
60 int writeChannelCount()
const;
61 int currentReadChannel()
const;
62 void setCurrentReadChannel(
int channel);
63 int currentWriteChannel()
const;
64 void setCurrentWriteChannel(
int channel);
66 virtual bool open(QIODeviceBase::OpenMode mode);
71 virtual qint64 pos()
const;
72 virtual qint64 size()
const;
73 virtual bool seek(qint64 pos);
74 virtual bool atEnd()
const;
77 virtual qint64 bytesAvailable()
const;
78 virtual qint64 bytesToWrite()
const;
80 qint64 read(
char *data, qint64 maxlen);
81 QByteArray read(qint64 maxlen);
83 qint64 readLine(
char *data, qint64 maxlen);
84 QByteArray readLine(qint64 maxlen = 0);
85 bool readLineInto(QByteArray *result, qint64 maxlen = 0);
87 QByteArrayView readLineInto(QSpan<
char> buffer)
88 {
return readLineInto(as_writable_bytes(buffer)); }
89 QByteArrayView readLineInto(QSpan<uchar> buffer)
90 {
return readLineInto(as_writable_bytes(buffer)); }
91 QByteArrayView readLineInto(QSpan<std::byte> buffer);
93 virtual bool canReadLine()
const;
95 void startTransaction();
96 void commitTransaction();
97 void rollbackTransaction();
98 bool isTransactionStarted()
const;
100 qint64 write(
const char *data, qint64 len);
101 qint64 write(
const char *data);
102 qint64 write(
const QByteArray &data);
104 qint64 peek(
char *data, qint64 maxlen);
105 QByteArray peek(qint64 maxlen);
106 qint64 skip(qint64 maxSize);
108 virtual bool waitForReadyRead(
int msecs);
109 virtual bool waitForBytesWritten(
int msecs);
111 void ungetChar(
char c);
112 bool putChar(
char c);
113 bool getChar(
char *c);
115 QString errorString()
const;
120 void channelReadyRead(
int channel);
121 void bytesWritten(qint64 bytes);
122 void channelBytesWritten(
int channel, qint64 bytes);
124 void readChannelFinished();
129 QIODevice(QIODevicePrivate &dd);
131 QIODevice(QIODevicePrivate &dd, QObject *parent =
nullptr);
133 virtual qint64 readData(
char *data, qint64 maxlen) = 0;
134 virtual qint64 readLineData(
char *data, qint64 maxlen);
135 virtual qint64 skipData(qint64 maxSize);
136 virtual qint64 writeData(
const char *data, qint64 len) = 0;
138 void setOpenMode(QIODeviceBase::OpenMode openMode);
140 void setErrorString(
const QString &errorString);
143 std::unique_ptr<QIODevicePrivate> d_ptr;
147 Q_DECLARE_PRIVATE(QIODevice)
148 Q_DISABLE_COPY(QIODevice)
151Q_DECLARE_OPERATORS_FOR_FLAGS(QIODevice::OpenMode)
153#if !defined(QT_NO_DEBUG_STREAM)
155Q_CORE_EXPORT
QDebug operator<<(QDebug debug, QIODevice::OpenMode modes);
bool ensureStringIteration()
void handleError(CborError err) noexcept
QCborStreamReaderPrivate(QIODevice *device)
QByteArray::size_type bufferStart
qsizetype readStringChunk_byte(ReadStringChunk params, qsizetype len)
bool readFullString(ReadStringChunk params)
QStack< CborValue > containerStack
qsizetype readStringChunk_unicode(ReadStringChunk params, qsizetype utf8len)
~QCborStreamReaderPrivate()
qsizetype readStringChunk_utf8(ReadStringChunk params, qsizetype utf8len)
void setDevice(QIODevice *dev)
QCborStreamReaderPrivate(const QByteArray &data)
\inmodule QtCore \reentrant
static CborError qt_cbor_decoder_transfer_string(void *token, const void **userptr, size_t offset, size_t len)
QCborStreamReader::StringResultCode qt_cbor_append_string_chunk(QCborStreamReader &reader, QByteArray *data)
static QT_BEGIN_NAMESPACE bool qt_cbor_decoder_can_read(void *token, size_t len)
void qt_cbor_stream_set_error(QCborStreamReaderPrivate *d, QCborError error)
static void qt_cbor_decoder_advance(void *token, size_t len)
static void * qt_cbor_decoder_read(void *token, void *userptr, size_t offset, size_t len)
static CborError cbor_value_get_half_float_as_float(const CborValue *, float *)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
ReadStringChunk(char *ptr, qsizetype maxlen)
bool isPlainPointer() const
ReadStringChunk(QByteArray *array, Type type=ByteArray)
bool isUtf8String() const
ReadStringChunk(QString *str)