xoreos
0.0.5
|
SeekableSubReadStream provides access to a SeekableReadStream restricted to the range [begin, end). More...
#include <readstream.h>
Public Member Functions | |
SeekableSubReadStream (SeekableReadStream *parentStream, size_t begin, size_t end, bool disposeParentStream=false) | |
~SeekableSubReadStream () | |
size_t | pos () const |
Obtains the current value of the stream position indicator of the stream. More... | |
size_t | size () const |
Obtains the total size of the stream, measured in bytes. More... | |
size_t | seek (ptrdiff_t offset, Origin whence=kOriginBegin) |
Sets the stream position indicator for the stream. More... | |
Public Member Functions inherited from Common::SubReadStream | |
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... | |
Public Member Functions inherited from Common::SeekableReadStream | |
SeekableReadStream () | |
~SeekableReadStream () | |
virtual size_t | skip (ptrdiff_t offset) |
Skip the specified number of bytes, adding that offset to the current position in the stream. More... | |
Protected Attributes | |
SeekableReadStream * | _parentStream |
size_t | _begin |
Protected Attributes inherited from Common::SubReadStream | |
DisposablePtr< ReadStream > | _parentStream |
size_t | _pos |
size_t | _end |
bool | _eos |
Additional Inherited Members | |
Public Types inherited from Common::SeekableReadStream | |
enum | Origin { kOriginBegin = 0, kOriginCurrent = 1, kOriginEnd = 2, kOriginMAX } |
The position a seeking offset takes as a base. More... | |
Static Public Member Functions inherited from Common::SeekableReadStream | |
static size_t | evalSeek (ptrdiff_t offset, Origin whence, size_t pos, size_t begin, size_t size) |
Evaluate the seek offset relative to whence into a position from the beginning. More... | |
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 |
SeekableSubReadStream provides access to a SeekableReadStream restricted to the range [begin, end).
The same caveats apply to SeekableSubReadStream as do to SeekableReadStream.
Manipulating the parent stream directly /will/ mess up a substream.
Definition at line 359 of file readstream.h.
Common::SeekableSubReadStream::SeekableSubReadStream | ( | SeekableReadStream * | parentStream, |
size_t | begin, | ||
size_t | end, | ||
bool | disposeParentStream = false |
||
) |
Definition at line 127 of file readstream.cpp.
References _begin, Common::SubReadStream::_end, _parentStream, Common::SubReadStream::_pos, and Common::SeekableReadStream::seek().
Common::SeekableSubReadStream::~SeekableSubReadStream | ( | ) |
Definition at line 137 of file readstream.cpp.
|
virtual |
Obtains the current value of the stream position indicator of the stream.
Implements Common::SeekableReadStream.
Definition at line 140 of file readstream.cpp.
References _begin, and Common::SubReadStream::_pos.
Referenced by Aurora::GFF4Struct::getData(), Aurora::NSBTXFile::getPalette(), Aurora::GFF4Struct::getString(), Aurora::GFF4Struct::load(), Aurora::GFF4Struct::loadStructs(), Graphics::Aurora::Model_Sonic::readBoneCommands(), Graphics::Aurora::NFTRFont::readGlyphs(), and Graphics::Aurora::Model_Sonic::readModel().
|
virtual |
Sets the stream position indicator for the stream.
The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to kOriginBegin, kOriginCurrent, or kOriginEnd, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the seek() method clears the end-of-file indicator for the stream.
On error, or when trying to seek outside the stream, a kSeekError exception is thrown.
offset | the relative offset in bytes. |
whence | the seek reference: kOriginBegin, kOriginCurrent or kOriginEnd. |
Implements Common::SeekableReadStream.
Definition at line 148 of file readstream.cpp.
References _begin, Common::SubReadStream::_end, Common::SubReadStream::_eos, _parentStream, Common::SubReadStream::_pos, Common::SeekableReadStream::evalSeek(), Common::kSeekError, Common::SeekableReadStream::seek(), and size().
Referenced by Aurora::GFF4Struct::getListCount(), Aurora::NSBTXFile::getPalette(), Aurora::GFF4Struct::getString(), Aurora::NSBTXFile::getTexture(), Aurora::GFF4Struct::load(), Aurora::GFF4File::Header::read(), Graphics::Aurora::Model_Sonic::readBone(), Graphics::Aurora::Model_Sonic::readBoneCommands(), Graphics::Aurora::Model_Sonic::readBones(), Graphics::NCGR::readChar(), Graphics::Aurora::NFTRFont::readCharMaps(), Graphics::Aurora::NFTRFont::readGlyphs(), Aurora::NSBTXFile::readInfoHeader(), Graphics::Aurora::Model_Sonic::readMaterialDefinition(), Graphics::Aurora::Model_Sonic::readMaterialResource(), Graphics::Aurora::Model_Sonic::readMaterials(), Graphics::Aurora::Model_Sonic::readModel(), Graphics::Aurora::Model_Sonic::readModelHeader(), Graphics::NCLR::readPalette(), Aurora::NSBTXFile::readPalettes(), Graphics::Aurora::Model_Sonic::readPolygon(), Graphics::Aurora::Model_Sonic::readPolygons(), Aurora::TalkTable_GFF::readString05(), Aurora::NSBTXFile::readTextures(), and Graphics::Aurora::NFTRFont::readWidths().
|
virtual |
Obtains the total size of the stream, measured in bytes.
If this value is unknown or can not be computed, kSizeInvalid is returned.
Implements Common::SeekableReadStream.
Definition at line 144 of file readstream.cpp.
References _begin, and Common::SubReadStream::_end.
Referenced by Aurora::GFF4Struct::getData(), Aurora::NSBTXFile::getPalette(), Graphics::NCGR::readChar(), Graphics::Aurora::NFTRFont::readCharMaps(), Aurora::NSBTXFile::readFileHeader(), Graphics::NCLR::readHeader(), Graphics::NCGR::readHeader(), Graphics::Aurora::NFTRFont::readHeader(), Graphics::Aurora::Model_Sonic::readHeader(), Aurora::TalkTable_GFF::readString05(), and seek().
|
protected |
Definition at line 373 of file readstream.h.
Referenced by pos(), seek(), SeekableSubReadStream(), and size().
|
protected |
Definition at line 371 of file readstream.h.
Referenced by seek(), and SeekableSubReadStream().