File indexing completed on 2025-01-18 10:07:17
0001
0002
0003
0004 #ifndef QBUFFER_H
0005 #define QBUFFER_H
0006
0007 #include <QtCore/qiodevice.h>
0008 #include <QtCore/qbytearray.h>
0009
0010 QT_BEGIN_NAMESPACE
0011
0012 class QObject;
0013 class QBufferPrivate;
0014
0015 class Q_CORE_EXPORT QBuffer : public QIODevice
0016 {
0017 #ifndef QT_NO_QOBJECT
0018 Q_OBJECT
0019 #endif
0020
0021 public:
0022 #ifndef QT_NO_QOBJECT
0023 explicit QBuffer(QObject *parent = nullptr);
0024 QBuffer(QByteArray *buf, QObject *parent = nullptr);
0025 #else
0026 QBuffer();
0027 explicit QBuffer(QByteArray *buf);
0028 #endif
0029 ~QBuffer();
0030
0031 QByteArray &buffer();
0032 const QByteArray &buffer() const;
0033 void setBuffer(QByteArray *a);
0034
0035 void setData(const QByteArray &data);
0036 #if QT_CORE_REMOVED_SINCE(6, 5) && QT_POINTER_SIZE != 4
0037 void setData(const char *data, int len) { setData(data, qsizetype(len)); }
0038 #endif
0039 void setData(const char *data, qsizetype len);
0040 const QByteArray &data() const;
0041
0042 bool open(OpenMode openMode) override;
0043
0044 void close() override;
0045 qint64 size() const override;
0046 qint64 pos() const override;
0047 bool seek(qint64 off) override;
0048 bool atEnd() const override;
0049 bool canReadLine() const override;
0050
0051 protected:
0052 #ifndef QT_NO_QOBJECT
0053 void connectNotify(const QMetaMethod &) override;
0054 void disconnectNotify(const QMetaMethod &) override;
0055 #endif
0056 qint64 readData(char *data, qint64 maxlen) override;
0057 qint64 writeData(const char *data, qint64 len) override;
0058
0059 private:
0060 Q_DECLARE_PRIVATE(QBuffer)
0061 Q_DISABLE_COPY(QBuffer)
0062
0063 Q_PRIVATE_SLOT(d_func(), void _q_emitSignals())
0064 };
0065
0066 QT_END_NAMESPACE
0067
0068 #endif