A read-only file device with sequential access on a list of data slices. More...
Public Member Functions | |
QtlFileSlices (const QString &fileName, const QtlRangeList &slices=QtlRangeList(), QObject *parent=0) | |
Constructor. More... | |
virtual bool | atEnd () const Q_DECL_OVERRIDE |
Returns true if the current read position is at the end of the device. More... | |
virtual void | close () Q_DECL_OVERRIDE |
Close the device. More... | |
QString | fileName () const |
Get the file name. More... | |
virtual bool | isSequential () const Q_DECL_OVERRIDE |
Returns true if this device is sequential; otherwise returns false. More... | |
virtual bool | open (OpenMode mode=ReadOnly) Q_DECL_OVERRIDE |
Open the device. More... | |
virtual qint64 | pos () const Q_DECL_OVERRIDE |
Get the position that data is read from. More... | |
virtual qint64 | size () const Q_DECL_OVERRIDE |
Get the size of the device, meaning the number of bytes to read. More... | |
Protected Member Functions | |
virtual qint64 | readData (char *data, qint64 maxSize) Q_DECL_OVERRIDE |
Reads up to maxSize bytes from the device into data. More... | |
virtual qint64 | writeData (const char *data, qint64 maxSize) Q_DECL_OVERRIDE |
Writes up to maxSize bytes from data to the device. More... | |
Private Member Functions | |
QtlFileSlices () Q_DECL_EQ_DELETE | |
Private Attributes | |
QtlRangeList::ConstIterator | _currentSlice |
Current pointer in _slices. More... | |
QFile | _file |
Actual device to read. More... | |
int | _nextByte |
Next byte in _currentSlice, -1 means at beginning. More... | |
qint64 | _readSize |
Number of bytes already read in the file. More... | |
qint64 | _size |
Number of bytes to read in the file. More... | |
QtlRangeList | _slices |
Slices of file to read. More... | |
A read-only file device with sequential access on a list of data slices.
When reading the file, only specific portions of the physical files are read.
|
explicit |
Constructor.
[in] | fileName | Name of the file. |
[in] | slices | Slices of data to read in the files. If empty, the whole file is read. |
[in] | parent | Optional parent object. |
|
private |
|
inline |
Get the file name.
|
virtual |
Open the device.
Reimplemented from QIODevice.
[in] | mode | Open mode. The only allowed mode is ReadOnly, with optional flag Text. All other modes are forbidden. |
|
virtual |
Close the device.
Reimplemented from QIODevice.
|
inlinevirtual |
Get the size of the device, meaning the number of bytes to read.
Reimplemented from QIODevice.
|
inlinevirtual |
Get the position that data is read from.
Reimplemented from QIODevice.
|
inlinevirtual |
Returns true if the current read position is at the end of the device.
Reimplemented from QIODevice.
|
inlinevirtual |
Returns true if this device is sequential; otherwise returns false.
Reimplemented from QIODevice.
|
protectedvirtual |
Reads up to maxSize bytes from the device into data.
Implemented from QIODevice requirement.
[out] | data | Buffer for returned data. |
[in] | maxSize | Maximum number of bytes to read. |
|
inlineprotectedvirtual |
Writes up to maxSize bytes from data to the device.
Implemented from QIODevice requirement.
[in] | data | Buffer for data to write. |
[in] | maxSize | Maximum number of bytes to write. |
|
private |
Slices of file to read.
|
private |
Number of bytes to read in the file.
|
private |
Number of bytes already read in the file.
|
private |
Actual device to read.
|
private |
Next byte in _currentSlice, -1 means at beginning.
|
private |
Current pointer in _slices.