DataStreamOperatorWrapper Class Reference

Wraps around QDataStream stream operators to provide cleaner reading interface. More...

#include <datastreamoperatorwrapper.h>

List of all members.

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.

Detailed Description

Wraps around QDataStream stream operators to provide cleaner reading interface.


Member Function Documentation

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.

Parameters:
length Amount of bytes to read.
Returns:
QByteArray of read bytes.
QByteArray DataStreamOperatorWrapper::readRawAll (  ) 

Reads all remaining raw bytes.

This calls QIODevice::readAll() directly.

Returns:
QByteArray of read bytes.
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.

Returns:
Number of bytes actually skipped or -1 on error.

The documentation for this class was generated from the following files: