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
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
\inmodule QtCore
Definition qmetaobject.h:19
\inmodule QtCore
Definition qobject.h:103
Combined button and popup list for selecting options.
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint buffer
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLsizei len
#define Q_OBJECT
#define Q_PRIVATE_SLOT(d, signature)
ptrdiff_t qsizetype
Definition qtypes.h:165
long long qint64
Definition qtypes.h:60
file open(QIODevice::ReadOnly)
mimeData setData("text/csv", csvData)
void writeData(const QByteArray &data)
QByteArray readData()