ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Common::ReadStream Class Reference

Generic interface for a readable data stream. More...

#include <stream.h>

Inheritance diagram for Common::ReadStream:
Collaboration diagram for Common::ReadStream:

List of all members.

Public Member Functions

virtual bool eos () const =0
 Returns true if a read failed because the stream end has been reached.
virtual uint32 read (void *dataPtr, uint32 dataSize)=0
 Read data from the stream.
byte readByte ()
 Read an unsigned byte from the stream and return it.
FORCEINLINE int8 readSByte ()
 Read a signed byte from the stream and return it.
uint16 readUint16LE ()
 Read an unsigned 16-bit word stored in little endian (LSB first) order from the stream and return it.
uint32 readUint32LE ()
 Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it.
uint64 readUint64LE ()
 Read an unsigned 64-bit word stored in little endian (LSB first) order from the stream and return it.
uint16 readUint16BE ()
 Read an unsigned 16-bit word stored in big endian (MSB first) order from the stream and return it.
uint32 readUint32BE ()
 Read an unsigned 32-bit word stored in big endian (MSB first) order from the stream and return it.
uint64 readUint64BE ()
 Read an unsigned 64-bit word stored in big endian (MSB first) order from the stream and return it.
FORCEINLINE int16 readSint16LE ()
 Read a signed 16-bit word stored in little endian (LSB first) order from the stream and return it.
FORCEINLINE int32 readSint32LE ()
 Read a signed 32-bit word stored in little endian (LSB first) order from the stream and return it.
FORCEINLINE int64 readSint64LE ()
 Read a signed 64-bit word stored in little endian (LSB first) order from the stream and return it.
FORCEINLINE int16 readSint16BE ()
 Read a signed 16-bit word stored in big endian (MSB first) order from the stream and return it.
FORCEINLINE int32 readSint32BE ()
 Read a signed 32-bit word stored in big endian (MSB first) order from the stream and return it.
FORCEINLINE int64 readSint64BE ()
 Read a signed 64-bit word stored in big endian (MSB first) order from the stream and return it.
FORCEINLINE float readFloatLE ()
 Read a 32-bit floating point value stored in little endian (LSB first) order from the stream and return it.
FORCEINLINE float readFloatBE ()
 Read a 32-bit floating point value stored in big endian order from the stream and return it.
FORCEINLINE double readDoubleLE ()
 Read a 64-bit floating point value stored in little endian (LSB first) order from the stream and return it.
FORCEINLINE double readDoubleBE ()
 Read a 64-bit floating point value stored in big endian order from the stream and return it.
SeekableReadStreamreadStream (uint32 dataSize)
 Read the specified amount of data into a malloc'ed buffer which then is wrapped into a MemoryReadStream.
Common::String readPascalString (bool transformCR=true)
 Read stream in Pascal format, that is, one byte is string length, followed by string data.

Detailed Description

Generic interface for a readable data stream.

Definition at line 272 of file stream.h.


Member Function Documentation

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

Returns true if a read failed because the stream end has been reached.

This flag is cleared by clearErr(). For a SeekableReadStream, it is also cleared by a successful seek.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C feof(). In particular, in a stream with N bytes, reading exactly N bytes from the start should *not* set eos; only reading *beyond* the available data should set it.

Implemented in Networking::NetworkReadStream, Common::IFFParser::IFFChunkNav, Common::PackBitsReadStream, Common::MemoryReadStream, Common::SubReadStream, Common::GZipReadStream, Grim::PatchedFile, and Grim::PackFile.

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

Read data from the stream.

Subclasses must implement this method; all other read methods are implemented using it.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C fread(), in particular where it concerns setting error and end of file/stream flags.
Parameters:
dataPtr pointer to a buffer into which the data is read
dataSize number of bytes to be read
Returns:
the number of bytes which were actually read.

Implemented in Networking::NetworkReadStream, Common::IFFParser::IFFChunkNav, Common::PackBitsReadStream, Common::MemoryReadStream, Common::SubReadStream, Common::SafeSeekableSubReadStream, Common::GZipReadStream, Grim::PatchedFile, and Grim::PackFile.

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 client code can check by calling err() and eos() ).

Definition at line 310 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 526 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 510 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 493 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 477 of file stream.h.

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

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

Parameters:
transformCR if set (default), then transform into

Definition at line 42 of file stream.cpp.

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 client code can check by calling err() and eos() ).

Definition at line 322 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 444 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 411 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 455 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 422 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 466 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 433 of file stream.h.

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

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

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

Definition at line 35 of file stream.cpp.

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 client code can check by calling err() and eos() ).

Definition at line 372 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 333 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 385 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 346 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 398 of file stream.h.

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 client code can check by calling err() and eos() ).

Definition at line 359 of file stream.h.


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


Generated on Sat Sep 14 2019 05:04:07 for ResidualVM by doxygen 1.7.1
curved edge   curved edge