Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QBUFFER_H
6#define QBUFFER_H
7
8#include <QtCore/qiodevice.h>
9#include <QtCore/qbytearray.h>
10
11QT_BEGIN_NAMESPACE
12
13class QObject;
14class QBufferPrivate;
15
16class Q_CORE_EXPORT QBuffer : public QIODevice
17{
18#ifndef QT_NO_QOBJECT
19 Q_OBJECT
20#endif
21
22public:
23#ifndef QT_NO_QOBJECT
24 explicit QBuffer(QObject *parent = nullptr);
25 QBuffer(QByteArray *buf, QObject *parent = nullptr);
26#else
27 QBuffer();
28 explicit QBuffer(QByteArray *buf);
29#endif
30 ~QBuffer();
31
32 QByteArray &buffer();
33 const QByteArray &buffer() const;
34 void setBuffer(QByteArray *a);
35
36 void setData(const QByteArray &data);
37#if QT_CORE_REMOVED_SINCE(6, 5) && QT_POINTER_SIZE != 4
38 void setData(const char *data, int len) { setData(data, qsizetype(len)); }
39#endif
40 void setData(const char *data, qsizetype len);
41 const QByteArray &data() const;
42
43 bool open(OpenMode openMode) override;
44
45 void close() override;
46 qint64 size() const override;
47 qint64 pos() const override;
48 bool seek(qint64 off) override;
49 bool atEnd() const override;
50 bool canReadLine() const override;
51
52protected:
53#ifndef QT_NO_QOBJECT
54 void connectNotify(const QMetaMethod &) override;
55 void disconnectNotify(const QMetaMethod &) override;
56#endif
57 qint64 readData(char *data, qint64 maxlen) override;
58 qint64 writeData(const char *data, qint64 len) override;
59
60private:
61 Q_DECLARE_PRIVATE(QBuffer)
62 Q_DISABLE_COPY(QBuffer)
63};
64
65QT_END_NAMESPACE
66
67#endif // QBUFFER_H
\inmodule QtCore \reentrant
Definition qbuffer.h:17
static bool is_tracked_signal(const QMetaMethod &signal)
Definition qbuffer.cpp:422