NuriaProject Framework
0.1
The NuriaProject Framework
|
Operates on a part of another QIODevice. More...
#include <referencedevice.hpp>
Public Member Functions | |
ReferenceDevice (QIODevice *referencedDevice, QObject *parent=0) | |
~ReferenceDevice () override | |
bool | atEnd () const override |
qint64 | bytesAvailable () const override |
void | close () override |
void | extendRange (qint64 bytes) |
bool | isSequential () const override |
bool | open (OpenMode mode) override |
qint64 | pos () const override |
qint64 | rangeBegin () const |
qint64 | rangeEnd () const |
QIODevice * | referencedDevice () const |
bool | reset () override |
bool | seek (qint64 pos) override |
void | setRange (qint64 begin, qint64 end=-1) |
qint64 | size () const override |
Protected Member Functions | |
qint64 | readData (char *data, qint64 maxlen) |
qint64 | writeData (const char *data, qint64 len) |
Operates on a part of another QIODevice.
ReferenceDevice references a given part of a random-access QIODevice. This device does not store any data itself. This means, that the referenced QIODevice must be kept alive as long a ReferenceDevice is operating on it.
|
explicit |
Constructs a ReferenceDevice referencing referencedDevice.
|
override |
Destructor.
void Nuria::ReferenceDevice::extendRange | ( | qint64 | bytes | ) |
Extends the current range by bytes. The same range extension mechanism like in setRange() takes place. Signals are emitted accordingly.
qint64 Nuria::ReferenceDevice::rangeBegin | ( | ) | const |
Returns the begin of the referenced range.
qint64 Nuria::ReferenceDevice::rangeEnd | ( | ) | const |
Returns the end of the referenced range.
QIODevice* Nuria::ReferenceDevice::referencedDevice | ( | ) | const |
Returns the device the ReferenceDevice is operating on.
void Nuria::ReferenceDevice::setRange | ( | qint64 | begin, |
qint64 | end = -1 |
||
) |
Sets the operated range to be from begin till end (exclusive). If end is longer than the current size() of the referencedDevice(), then the range will be extended automatically when data has been written to the referenced device, until it matches the given one.
If begin is not currently outside the referenced device and the range is greater than 0
, then readyRead() will be emitted.
If end is -1
, then the range will span from begin till the current size() of the referenced device.
0
.