Wraps around QDataStream stream operators to provide cleaner reading interface. More...
#include <datastreamoperatorwrapper.h>
Public Member Functions | |
DataStreamOperatorWrapper (QDataStream *stream) | |
QDataStream * | dataStream () |
Gets underlying QDataStream. | |
const QDataStream * | dataStream () const |
Gets underlying QDataStream. | |
bool | hasRemaining () const |
Returns true if there is any data remaining in the stream. | |
qint8 | readQInt8 () |
bool | readBool () |
quint8 | readQUInt8 () |
quint16 | readQUInt16 () |
qint16 | readQInt16 () |
quint32 | readQUInt32 () |
qint32 | readQInt32 () |
quint64 | readQUInt64 () |
qint64 | readQInt64 () |
float | readFloat () |
double | readDouble () |
QByteArray | readRaw (qint64 length) |
Reads specified amount of raw bytes. | |
QByteArray | readRawAll () |
Reads all remaining raw bytes. | |
QByteArray | readRawUntilByte (char stopByte) |
This method calls Strings::readUntilByte() . | |
qint64 | remaining () const |
Returns a remaining amount of bytes from the underlying QIODevice. | |
int | skipRawData (int len) |
Reads and discards specified amount of data. |
Wraps around QDataStream stream operators to provide cleaner reading interface.
bool DataStreamOperatorWrapper::hasRemaining | ( | ) | const [inline] |
Returns true if there is any data remaining in the stream.
The check is performed through 'remaining() > 0' instruction.
QByteArray DataStreamOperatorWrapper::readRaw | ( | qint64 | length | ) |
Reads specified amount of raw bytes.
length | Amount of bytes to read. |
QByteArray DataStreamOperatorWrapper::readRawAll | ( | ) |
Reads all remaining raw bytes.
This calls QIODevice::readAll() directly.
qint64 DataStreamOperatorWrapper::remaining | ( | ) | const |
Returns a remaining amount of bytes from the underlying QIODevice.
This is done by performing `QIODevicesize() - QIODevice::pos()`. It is assumed that the QIODevice can return both values, ie. is not sequential.
int DataStreamOperatorWrapper::skipRawData | ( | int | len | ) |
Reads and discards specified amount of data.
Calls QIODevice::skipRawData() directly.