xoreos
0.0.5
|
SubReadStream provides access to a ReadStream restricted to the range [currentPosition, currentPosition+end). More...
#include <readstream.h>
Public Member Functions | |
SubReadStream (ReadStream *parentStream, size_t end, bool disposeParentStream=false) | |
~SubReadStream () | |
bool | eos () const |
Returns true if a read failed because the stream has been reached. More... | |
size_t | read (void *dataPtr, size_t dataSize) |
Read data from the stream. More... | |
Public Member Functions inherited from Common::ReadStream | |
ReadStream () | |
virtual | ~ReadStream () |
byte | readByte () |
Read an unsigned byte from the stream and return it. More... | |
FORCEINLINE int8 | readSByte () |
Read a signed byte from the stream and return it. More... | |
uint32 | readChar () |
Reads the next character from stream and returns it as an unsigned char cast to an uint32, or kEOF on end of file or error. More... | |
uint16 | readUint16LE () |
Read an unsigned 16-bit word stored in little endian (LSB first) order from the stream and return it. More... | |
uint32 | readUint32LE () |
Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it. More... | |
uint64 | readUint64LE () |
Read an unsigned 64-bit word stored in little endian (LSB first) order from the stream and return it. More... | |
uint16 | readUint16BE () |
Read an unsigned 16-bit word stored in big endian (MSB first) order from the stream and return it. More... | |
uint32 | readUint32BE () |
Read an unsigned 32-bit word stored in big endian (MSB first) order from the stream and return it. More... | |
uint64 | readUint64BE () |
Read an unsigned 64-bit word stored in big endian (MSB first) order from the stream and return it. More... | |
FORCEINLINE int16 | readSint16LE () |
Read a signed 16-bit word stored in little endian (LSB first) order from the stream and return it. More... | |
FORCEINLINE int32 | readSint32LE () |
Read a signed 32-bit word stored in little endian (LSB first) order from the stream and return it. More... | |
FORCEINLINE int64 | readSint64LE () |
Read a signed 64-bit word stored in little endian (LSB first) order from the stream and return it. More... | |
FORCEINLINE int16 | readSint16BE () |
Read a signed 16-bit word stored in big endian (MSB first) order from the stream and return it. More... | |
FORCEINLINE int32 | readSint32BE () |
Read a signed 32-bit word stored in big endian (MSB first) order from the stream and return it. More... | |
FORCEINLINE int64 | readSint64BE () |
Read a signed 64-bit word stored in big endian (MSB first) order from the stream and return it. More... | |
FORCEINLINE float | readIEEEFloatLE () |
Read a 32-bit IEEE float stored in little endian (LSB first) order from the stream and return it. More... | |
FORCEINLINE float | readIEEEFloatBE () |
Read a 32-bit IEEE float stored in big endian (MSB first) order from the stream and return it. More... | |
FORCEINLINE double | readIEEEDoubleLE () |
Read a 64-bit IEEE double stored in little endian (LSB first) order from the stream and return it. More... | |
FORCEINLINE double | readIEEEDoubleBE () |
Read a 64-bit IEEE double stored in big endian (MSB first) order from the stream and return it. More... | |
MemoryReadStream * | readStream (size_t dataSize) |
Read the specified amount of data into a new[]'ed buffer which then is wrapped into a MemoryReadStream. More... | |
Protected Attributes | |
DisposablePtr< ReadStream > | _parentStream |
size_t | _pos |
size_t | _end |
bool | _eos |
Additional Inherited Members | |
Static Public Attributes inherited from Common::ReadStream | |
static const uint32 | kEOF = 0xFFFFFFFF |
Return value for end-of-file. More... | |
static const size_t | kSizeInvalid = SIZE_MAX |
static const size_t | kPositionInvalid = SIZE_MAX |
SubReadStream provides access to a ReadStream restricted to the range [currentPosition, currentPosition+end).
Manipulating the parent stream directly /will/ mess up a substream. Likewise, manipulating two substreams of a parent stream will cause them to step on each others toes.
Definition at line 333 of file readstream.h.
Common::SubReadStream::SubReadStream | ( | ReadStream * | parentStream, |
size_t | end, | ||
bool | disposeParentStream = false |
||
) |
Definition at line 101 of file readstream.cpp.
Common::SubReadStream::~SubReadStream | ( | ) |
Definition at line 107 of file readstream.cpp.
|
virtual |
Returns true if a read failed because the stream has been reached.
For a SeekableReadStream, it is cleared by a successful seek.
Implements Common::ReadStream.
Definition at line 110 of file readstream.cpp.
References _eos, and _parentStream.
|
virtual |
Read data from the stream.
Subclasses must implement this method; all other read methods are implemented using it.
dataPtr | pointer to a buffer into which the data is read. |
dataSize | number of bytes to be read. |
Implements Common::ReadStream.
Definition at line 114 of file readstream.cpp.
References _end, _eos, _parentStream, and _pos.
Referenced by Graphics::Aurora::Model_Sonic::readPolygonCommands().
|
protected |
Definition at line 346 of file readstream.h.
Referenced by read(), Common::SeekableSubReadStream::seek(), Common::SeekableSubReadStream::SeekableSubReadStream(), and Common::SeekableSubReadStream::size().
|
protected |
Definition at line 348 of file readstream.h.
Referenced by eos(), read(), and Common::SeekableSubReadStream::seek().
|
protected |
Definition at line 343 of file readstream.h.
|
protected |
Definition at line 345 of file readstream.h.
Referenced by Common::SeekableSubReadStream::pos(), read(), Common::SeekableSubReadStream::seek(), and Common::SeekableSubReadStream::SeekableSubReadStream().