180 arrayImpl->setParent(
this);
232 if (maximumLength != -1)
285 if (maximumLength != -1)
286 len =
qMin(len, maximumLength);
319 currentReadBuffer(0), currentReadBufferSize(16*1024),
320 currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0),
344 if (maximumLength == -1)
394 currentReadBufferAmount = 0;
480 memcpy(data, readPointer, len);
520 if (
QBuffer* buffer = qobject_cast<QBuffer*>(device)) {
~QNonContiguousByteDeviceByteArrayImpl()
virtual bool reset()=0
Moves the internal read pointer back to the beginning.
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
qint64 size()
Returns the size of the complete device or -1 if unknown.
void readyRead()
Emitted when there is data available.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
char * data()
Returns a pointer to the data stored in the byte array.
virtual bool reset()
Seeks to the start of input for random-access devices.
virtual ~QNonContiguousByteDevice()
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
bool advanceReadPointer(qint64 amount)
The old readPointer is invalid after this call.
QSharedPointer< QRingBuffer > ringBuffer
bool reset()
Moves the internal read pointer back to the beginning.
The QByteArray class provides an array of bytes.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
QNonContiguousByteDevice * byteDevice
bool getChar(char *c)
Reads one character from the device and stores it in c.
qint64 pos() const
Reimplemented Function
qint64 size() const
Reimplemented Function
The QBuffer class provides a QIODevice interface for a QByteArray.
qint64 currentReadBufferSize
~QByteDeviceWrappingIoDevice()
The QObject class is the base class of all Qt objects.
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd)
QNonContiguousByteDevice()
virtual const char * readPointer(qint64 maximumLength, qint64 &len)=0
Return a byte pointer for at most maximumLength bytes of that device.
qint64 size()
Returns the size of the complete device or -1 if unknown.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
bool atEnd()
Returns true if everything has been read and the read pointer cannot be advanced anymore.
void disableReset()
Disable the reset() call, e.
~QNonContiguousByteDeviceBufferImpl()
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool reset()
Moves the internal read pointer back to the beginning.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
QByteArray & buffer()
Returns a reference to the QBuffer's internal buffer.
static QByteArray fromRawData(const char *, int size)
Constructs a QByteArray that uses the first size bytes of the data array.
QByteArray * currentReadBuffer
bool advanceReadPointer(qint64 amount)
The old readPointer is invalid after this call.
static const char * data(const QByteArray &arr)
bool atEnd()
Returns true if everything has been read and the read pointer cannot be advanced anymore.
const char * readPointer(qint64 maximumLength, qint64 &len)
Return a byte pointer for at most maximumLength bytes of that device.
QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba)
QNonContiguousByteDeviceBufferImpl(QBuffer *b)
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
qint64 size()
Returns the size of the complete device or -1 if unknown.
void readProgress(qint64 current, qint64 total)
Emitted when data has been "read" by advancing the read pointer.
const char * constData() const
Returns a pointer to the data stored in the byte array.
const char * readPointer(qint64 maximumLength, qint64 &len)
Return a byte pointer for at most maximumLength bytes of that device.
bool reset()
Moves the internal read pointer back to the beginning.
const char * readPointer(qint64 maximumLength, qint64 &len)
Return a byte pointer for at most maximumLength bytes of that device.
bool advanceReadPointer(qint64 amount)
The old readPointer is invalid after this call.
QNonContiguousByteDeviceByteArrayImpl * arrayImpl
virtual bool advanceReadPointer(qint64 amount)=0
The old readPointer is invalid after this call.
const char * readPointerAtPosition(qint64 pos, qint64 &length) const
bool atEnd()
Returns true if everything has been read and the read pointer cannot be advanced anymore.
~QNonContiguousByteDeviceRingBufferImpl()
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
virtual bool reset()
Seeks to the start of input for random-access devices.
virtual qint64 readData(char *data, qint64 maxSize)
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d)
static QIODevice * wrap(QNonContiguousByteDevice *byteDevice)
Wrap the byteDevice (possibly again) into a QIODevice.
int size() const
Returns the number of bytes in this byte array.
static QNonContiguousByteDevice * create(QIODevice *device)
Create a QNonContiguousByteDevice out of a QIODevice.
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
bool atEnd()
Returns true if everything has been read and the read pointer cannot be advanced anymore.
A QNonContiguousByteDevice is a representation of a file, array or buffer that allows access with a r...
bool reset()
Moves the internal read pointer back to the beginning.
QNonContiguousByteDeviceRingBufferImpl(QSharedPointer< QRingBuffer > rb)
qint64 currentReadBufferAmount
~QNonContiguousByteDeviceIoDeviceImpl()
virtual bool atEnd()=0
Returns true if everything has been read and the read pointer cannot be advanced anymore.
virtual qint64 size()=0
Returns the size of the complete device or -1 if unknown.
void readyRead()
This signal is emitted once every time new data is available for reading from the device...
The QIODevice class is the base interface class of all I/O devices in Qt.
virtual qint64 writeData(const char *data, qint64 maxSize)
Writes up to maxSize bytes from data to the device.
const char * readPointer(qint64 maximumLength, qint64 &len)
Return a byte pointer for at most maximumLength bytes of that device.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...
qint64 size()
Returns the size of the complete device or -1 if unknown.
qint64 currentReadBufferPosition
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
bool advanceReadPointer(qint64 amount)
The old readPointer is invalid after this call.