50 #ifndef COMMON_MEMREADSTREAM_H 51 #define COMMON_MEMREADSTREAM_H 55 #include <boost/noncopyable.hpp> 80 _size(strlen(str) + (useTerminator ? 1 : 0)),
_pos(0),
_eos(false) {
94 size_t read(
void *dataPtr,
size_t dataSize);
126 bool disposeMemory =
false);
164 #endif // COMMON_MEMREADSTREAM_H
FORCEINLINE int64 readSint64LE()
Read a signed 64-bit word stored in little endian (LSB first) order 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...
MemoryReadStreamEndian(const byte *dataPtr, size_t dataSize, bool bigEndian=false, bool disposeMemory=false)
uint32 readUint32LE()
Read an unsigned 32-bit word stored in little endian (LSB 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 int32 readSint32BE()
Read a signed 32-bit word stored in big endian (MSB first) order from the stream and return it...
~MemoryReadStreamEndian()
FORCEINLINE double readIEEEDoubleBE()
Read a 64-bit IEEE double stored in big endian (MSB first) order from the stream and return it...
DisposableArray< const byte > _ptrOrig
FORCEINLINE int32 readSint32LE()
Read a signed 32-bit word stored in little endian (LSB first) order from the stream and return it...
size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)
Sets the stream position indicator for the stream.
Origin
The position a seeking offset takes as a base.
const byte * getData() const
MemoryReadStream(const byte *dataPtr, size_t dataSize, bool disposeMemory=false)
This constructor takes a pointer to a memory buffer and a length, and wraps it.
uint16 readUint16BE()
Read an unsigned 16-bit word stored in big endian (MSB first) order from the stream and return it...
This is a wrapper around MemoryReadStream, but it adds non-endian read methods whose endianness is se...
bool eos() const
Returns true if a read failed because the stream has been reached.
Simple memory based 'stream', which implements the ReadStream interface for a plain memory block...
Low-level type definitions to handle fixed width types portably.
FORCEINLINE int16 readSint16LE()
Read a signed 16-bit word stored in little endian (LSB first) order from the stream and return it...
Basic reading stream interfaces.
uint64 readUint64LE()
Read an unsigned 64-bit word stored in little endian (LSB 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...
FORCEINLINE float readIEEEFloatLE()
Read a 32-bit IEEE float 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...
A smart pointer with a deletion flag.
FORCEINLINE int64 readSint64BE()
Read a signed 64-bit word stored in big endian (MSB first) order from the stream and return it...
FORCEINLINE double readIEEEDoubleLE()
Read a 64-bit IEEE double stored in little endian (LSB first) order from the stream and return it...
size_t size() const
Obtains the total size of the stream, measured in bytes.
Seek from the begin of the stream.
Interface for a seekable & readable data stream.
size_t pos() const
Obtains the current value of the stream position indicator of the stream.
MemoryReadStream(const byte(&array)[N])
Template constructor to create a MemoryReadStream around a static array buffer.
size_t read(void *dataPtr, size_t dataSize)
Read data from the stream.
MemoryReadStream(const char *str, bool useTerminator=false)
Create a MemoryReadStream around a static string buffer, optionally including the terminating \0...
FORCEINLINE float readIEEEFloatBE()
Read a 32-bit IEEE float stored in big endian (MSB first) order from the stream and return it...