Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qbuffer.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
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 QBUFFER_H
5#define QBUFFER_H
6
7#include <QtCore/qiodevice.h>
8#include <QtCore/qbytearray.h>
9
11
12class QObject;
13class QBufferPrivate;
14
15class Q_CORE_EXPORT QBuffer : public QIODevice
16{
17#ifndef QT_NO_QOBJECT
19#endif
20
21public:
22#ifndef QT_NO_QOBJECT
23 explicit QBuffer(QObject *parent = nullptr);
24 QBuffer(QByteArray *buf, QObject *parent = nullptr);
25#else
26 QBuffer();
27 explicit QBuffer(QByteArray *buf);
28#endif
29 ~QBuffer();
30
32 const QByteArray &buffer() const;
33 void setBuffer(QByteArray *a);
34
35 void setData(const QByteArray &data);
36#if QT_CORE_REMOVED_SINCE(6, 5) && QT_POINTER_SIZE != 4
37 void setData(const char *data, int len) { setData(data, qsizetype(len)); }
38#endif
39 void setData(const char *data, qsizetype len);
40 const QByteArray &data() const;
41
42 bool open(OpenMode openMode) override;
43
44 void close() override;
45 qint64 size() const override;
46 qint64 pos() const override;
47 bool seek(qint64 off) override;
48 bool atEnd() const override;
49 bool canReadLine() const override;
50
51protected:
52#ifndef QT_NO_QOBJECT
53 void connectNotify(const QMetaMethod &) override;
54 void disconnectNotify(const QMetaMethod &) override;
55#endif
56 qint64 readData(char *data, qint64 maxlen) override;
57 qint64 writeData(const char *data, qint64 len) override;
58
59private:
60 Q_DECLARE_PRIVATE(QBuffer)
61 Q_DISABLE_COPY(QBuffer)
62
63 Q_PRIVATE_SLOT(d_func(), void _q_emitSignals())
64};
65
67
68#endif // QBUFFER_H
\inmodule QtCore \reentrant
Definition qbuffer.h:16
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore \reentrant
Definition qiodevice.h:34
virtual bool open(QIODeviceBase::OpenMode mode)
Opens the device and sets its OpenMode to mode.
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from.
virtual qint64 writeData(const char *data, qint64 len)=0
Writes up to maxSize bytes from data to the device.
virtual void close()
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success,...
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i....
virtual bool canReadLine() const
Returns true if a complete line of data can be read from the device; otherwise returns false.
\inmodule QtCore
Definition qmetaobject.h:18
\inmodule QtCore
Definition qobject.h:90
virtual void connectNotify(const QMetaMethod &signal)
Definition qobject.cpp:3347
virtual void disconnectNotify(const QMetaMethod &signal)
Definition qobject.cpp:3382
Combined button and popup list for selecting options.
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint buffer
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLsizei len
#define Q_OBJECT
#define Q_PRIVATE_SLOT(d, signature)
ptrdiff_t qsizetype
Definition qtypes.h:70
long long qint64
Definition qtypes.h:55
mimeData setData("text/csv", csvData)
QByteArray readData()
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent