5#include <QtCore/qmetaobject.h>
6#include "private/qiodevice_p.h"
50 memcpy(
data,
buf->constData() +
pos, readBytes);
57 if (
pos == 0 && maxSize >=
buf->size())
116 d->buf = &
d->defaultBuf;
122 d->buf =
buf ?
buf : &
d->defaultBuf;
123 d->defaultBuf.clear();
137 d->buf = &
d->defaultBuf;
161 d->buf = byteArray ? byteArray : &
d->defaultBuf;
162 d->defaultBuf.clear();
200 qWarning(
"QBuffer::setBuffer: Buffer is open");
206 d->buf = &
d->defaultBuf;
208 d->defaultBuf.clear();
263 qWarning(
"QBuffer::setData: Buffer is open");
282 qWarning(
"QBuffer::setData: Buffer is open");
303 qWarning(
"QBuffer::open: Buffer access not specified");
344 const auto oldBufSize =
d->buf->size();
345 constexpr qint64 MaxSeekPos = (std::numeric_limits<
decltype(oldBufSize)>::max)();
346 if (pos <= MaxSeekPos && pos > oldBufSize &&
isWritable()) {
349 }
QT_CATCH(
const std::bad_alloc &) {}
350 if (
d->buf->size() !=
pos) {
351 qWarning(
"QBuffer::seek: Unable to fill gap");
355 if (
pos >
d->buf->size() ||
pos < 0) {
402 if (required >
quint64(
d->buf->size())) {
404 Q_ASSUME(required <=
quint64((std::numeric_limits<qsizetype>::max)()));
406 if (
quint64(
d->buf->size()) != required) {
407 qWarning(
"QBuffer::writeData: Memory allocation error");
415 d->writtenSinceLastEmit +=
len;
417 d->signalsEmitted =
true;
428 static const struct {
432 return signal == sigs.readyReadSignal ||
signal == sigs.bytesWrittenSignal;
441 d_func()->signalConnectionCount++;
452 d_func()->signalConnectionCount--;
454 d_func()->signalConnectionCount = 0;
462# include "moc_qbuffer.cpp"
int signalConnectionCount
qint64 writtenSinceLastEmit
qint64 peek(char *data, qint64 maxSize) override
\inmodule QtCore \reentrant
qint64 writeData(const char *data, qint64 len) override
\reimp
void disconnectNotify(const QMetaMethod &) override
\reimp
~QBuffer()
Destroys the buffer.
bool open(OpenMode openMode) override
\reimp
void connectNotify(const QMetaMethod &) override
\reimp
qint64 pos() const override
\reimp
void setBuffer(QByteArray *a)
Makes QBuffer use the QByteArray pointed to by byteArray as its internal buffer.
const QByteArray & data() const
Returns the data contained in the buffer.
QBuffer(QObject *parent=nullptr)
Constructs an empty buffer with the given parent.
void setData(const QByteArray &data)
Sets the contents of the internal buffer to be data.
bool atEnd() const override
\reimp
void close() override
\reimp
qint64 readData(char *data, qint64 maxlen) override
\reimp
qint64 size() const override
\reimp
bool canReadLine() const override
\reimp
bool seek(qint64 off) override
\reimp
QByteArray & buffer()
Returns a reference to the QBuffer's internal buffer.
\inmodule QtCore \reentrant
virtual bool open(QIODeviceBase::OpenMode mode)
Opens the device and sets its OpenMode to mode.
void readyRead()
This signal is emitted once every time new data is available for reading from the device's current re...
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from.
bool isOpen() const
Returns true if the device is open; otherwise returns false.
void bytesWritten(qint64 bytes)
This signal is emitted every time a payload of data has been written to the device's current write ch...
bool isWritable() const
Returns true if data can be written to the device; otherwise returns false.
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.
bool signalsBlocked() const noexcept
Returns true if signals are blocked; otherwise returns false.
Combined button and popup list for selecting options.
static bool is_tracked_signal(const QMetaMethod &signal)
constexpr const T & qMin(const T &a, const T &b)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
unsigned long long quint64
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent