ScummVM API documentation
Common::ReadStream Class Referenceabstract

#include <stream.h>

Inheritance diagram for Common::ReadStream:
Common::Stream Common::PackBitsReadStream Common::ReadStreamEndian Common::SeekableReadStream Common::SubReadStream Groovie::LzssReadStream Networking::NetworkReadStream Twp::GGBnutReader ZVision::LzssReadStream

Public Member Functions

virtual bool eos () const =0
 
virtual uint32 read (void *dataPtr, uint32 dataSize)=0
 
Functions for reading data

The following methods all have default implementations. Subclasses in general should not overload them.

byte readByte ()
 
FORCEINLINE int8 readSByte ()
 
uint16 readUint16LE ()
 
uint32 readUint32LE ()
 
uint64 readUint64LE ()
 
uint16 readUint16BE ()
 
uint32 readUint32BE ()
 
uint64 readUint64BE ()
 
FORCEINLINE int16 readSint16LE ()
 
FORCEINLINE int32 readSint32LE ()
 
FORCEINLINE int64 readSint64LE ()
 
FORCEINLINE int16 readSint16BE ()
 
FORCEINLINE int32 readSint32BE ()
 
FORCEINLINE int64 readSint64BE ()
 
FORCEINLINE float readFloatLE ()
 
FORCEINLINE float readFloatBE ()
 
FORCEINLINE double readDoubleLE ()
 
FORCEINLINE double readDoubleBE ()
 
template<class TDataFormat , class... T>
bool readMultiple (const TDataFormat &dataFormat, T &...values)
 
template<class... T>
bool readMultipleEndian (bool isLittle, T &...values)
 
template<class... T>
bool readMultipleLE (T &...values)
 
template<class... T>
bool readMultipleBE (T &...values)
 
SeekableReadStreamreadStream (uint32 dataSize)
 
String readString (char terminator=0, size_t len=String::npos)
 
Common::String readPascalString (bool transformCR=true)
 
- Public Member Functions inherited from Common::Stream
virtual bool err () const
 
virtual void clearErr ()
 

Detailed Description

Generic interface for a readable data stream.

Member Function Documentation

◆ eos()

virtual bool Common::ReadStream::eos ( ) const
pure virtual

◆ read()

virtual uint32 Common::ReadStream::read ( void *  dataPtr,
uint32  dataSize 
)
pure virtual

◆ readByte()

byte Common::ReadStream::readByte ( )
inline

Read an unsigned byte from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readSByte()

FORCEINLINE int8 Common::ReadStream::readSByte ( )
inline

Read a signed byte from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readUint16LE()

uint16 Common::ReadStream::readUint16LE ( )
inline

Read an unsigned 16-bit word stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readUint32LE()

uint32 Common::ReadStream::readUint32LE ( )
inline

Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readUint64LE()

uint64 Common::ReadStream::readUint64LE ( )
inline

Read an unsigned 64-bit word stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readUint16BE()

uint16 Common::ReadStream::readUint16BE ( )
inline

Read an unsigned 16-bit word stored in big endian (MSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readUint32BE()

uint32 Common::ReadStream::readUint32BE ( )
inline

Read an unsigned 32-bit word stored in big endian (MSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readUint64BE()

uint64 Common::ReadStream::readUint64BE ( )
inline

Read an unsigned 64-bit word stored in big endian (MSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readSint16LE()

FORCEINLINE int16 Common::ReadStream::readSint16LE ( )
inline

Read a signed 16-bit word stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readSint32LE()

FORCEINLINE int32 Common::ReadStream::readSint32LE ( )
inline

Read a signed 32-bit word stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readSint64LE()

FORCEINLINE int64 Common::ReadStream::readSint64LE ( )
inline

Read a signed 64-bit word stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readSint16BE()

FORCEINLINE int16 Common::ReadStream::readSint16BE ( )
inline

Read a signed 16-bit word stored in big endian (MSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readSint32BE()

FORCEINLINE int32 Common::ReadStream::readSint32BE ( )
inline

Read a signed 32-bit word stored in big endian (MSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readSint64BE()

FORCEINLINE int64 Common::ReadStream::readSint64BE ( )
inline

Read a signed 64-bit word stored in big endian (MSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readFloatLE()

FORCEINLINE float Common::ReadStream::readFloatLE ( )
inline

Read a 32-bit floating point value stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readFloatBE()

FORCEINLINE float Common::ReadStream::readFloatBE ( )
inline

Read a 32-bit floating point value stored in big endian order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readDoubleLE()

FORCEINLINE double Common::ReadStream::readDoubleLE ( )
inline

Read a 64-bit floating point value stored in little endian (LSB first) order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readDoubleBE()

FORCEINLINE double Common::ReadStream::readDoubleBE ( )
inline

Read a 64-bit floating point value stored in big endian order from the stream and return it.

Performs no error checking. The return value is undefined if a read error occurred (for which the client code can check by calling err() and eos() ).

◆ readMultiple()

template<class TDataFormat , class... T>
bool Common::ReadStream::readMultiple ( const TDataFormat &  dataFormat,
T &...  values 
)
inline

Read multiple values from the stream using a specified data format, return true on success and false on failure.

◆ readMultipleEndian()

template<class... T>
bool Common::ReadStream::readMultipleEndian ( bool  isLittle,
T &...  values 
)
inline

Read multiple values from the stream using a specified endianness, return true on success and false on failure.

◆ readMultipleLE()

template<class... T>
bool Common::ReadStream::readMultipleLE ( T &...  values)
inline

Read multiple values from the stream in little endian format, return true on success and false on failure.

◆ readMultipleBE()

template<class... T>
bool Common::ReadStream::readMultipleBE ( T &...  values)
inline

Read multiple values from the stream in big endian format, return true on success and false on failure.

◆ readStream()

SeekableReadStream* Common::ReadStream::readStream ( uint32  dataSize)

Read the specified amount of data into a malloc'ed buffer which is then wrapped into a MemoryReadStream.

The returned stream might contain less data than requested if reading more data failed. This is because of an I/O error or because the end of the stream was reached. It can be determined by calling err() and eos().

◆ readString()

String Common::ReadStream::readString ( char  terminator = 0,
size_t  len = String::npos 
)

Reads in a terminated string. Upon successful completion, return a string with the content of the line, without the terminating character.

Parameters
terminatorThe terminating character to use.
lenThe maximum length to read (includes terminator).

◆ readPascalString()

Common::String Common::ReadStream::readPascalString ( bool  transformCR = true)

Read a string in Pascal format, that is, one byte is string length, followed by string data.

Parameters
transformCRIf set (default), then transform \r into \n.

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