![]() |
XII Release 0.1.0
|
A reader which can access a memory stream. More...
#include <MemoryStream.h>
Public Member Functions | |
xiiMemoryStreamReader (const xiiMemoryStreamStorageInterface *pStreamStorage=nullptr) | |
Pass the memory storage object from which to read from. Pass nullptr if you are going to set the storage stream later via SetStorage(). | |
void | SetStorage (const xiiMemoryStreamStorageInterface *pStreamStorage) |
Sets the storage object upon which to operate. Resets the read position to zero. Pass nullptr if you want to detach from any previous storage stream, for example to ensure its reference count gets properly reduced. | |
virtual xiiUInt64 | ReadBytes (void *pReadBuffer, xiiUInt64 uiBytesToRead) override |
Reads either uiBytesToRead or the amount of remaining bytes in the stream into pReadBuffer. | |
virtual xiiUInt64 | SkipBytes (xiiUInt64 uiBytesToSkip) override |
Skips bytes in the stream (e.g. for skipping objects which can't be serialized due to missing information etc.) | |
void | SetReadPosition (xiiUInt64 uiReadPosition) |
Sets the read position to be used. | |
xiiUInt64 | GetReadPosition () const |
Returns the current read position. | |
xiiUInt32 | GetByteCount32 () const |
Returns the total available bytes in the memory stream. | |
xiiUInt64 | GetByteCount64 () const |
void | SetDebugSourceInformation (xiiStringView sDebugSourceInformation) |
Allows to set a string as the source of information in the memory stream for debug purposes. | |
![]() | |
xiiStreamReader () | |
Constructor. | |
virtual | ~xiiStreamReader () |
Virtual destructor to ensure correct cleanup. | |
template<typename T> | |
xiiResult | ReadWordValue (T *pWordValue) |
Helper method to read a word value correctly (copes with potentially different endianess). | |
template<typename T> | |
xiiResult | ReadDWordValue (T *pDWordValue) |
Helper method to read a dword value correctly (copes with potentially different endianess). | |
template<typename T> | |
xiiResult | ReadQWordValue (T *pQWordValue) |
Helper method to read a qword value correctly (copes with potentially different endianess). | |
template<typename ArrayType, typename ValueType> | |
xiiResult | ReadArray (xiiArrayBase< ValueType, ArrayType > &ref_array) |
Reads an array of elements from the stream. | |
template<typename ValueType, xiiUInt16 uiSize, typename AllocatorWrapper> | |
xiiResult | ReadArray (xiiSmallArray< ValueType, uiSize, AllocatorWrapper > &ref_array) |
Reads a small array of elements from the stream. | |
template<typename ValueType, xiiUInt32 uiSize> | |
xiiResult | ReadArray (ValueType(&array)[uiSize]) |
Writes a C style fixed array. | |
template<typename KeyType, typename Comparer> | |
xiiResult | ReadSet (xiiSetBase< KeyType, Comparer > &ref_set) |
Reads a set. | |
template<typename KeyType, typename ValueType, typename Comparer> | |
xiiResult | ReadMap (xiiMapBase< KeyType, ValueType, Comparer > &ref_map) |
Reads a map. | |
template<typename KeyType, typename ValueType, typename Hasher> | |
xiiResult | ReadHashTable (xiiHashTableBase< KeyType, ValueType, Hasher > &ref_hashTable) |
Read a hash table (note that the entry order is not stable). | |
xiiResult | ReadString (xiiStringBuilder &ref_sBuilder) |
Reads a string into a xiiStringBuilder. | |
xiiResult | ReadString (xiiString &ref_sString) |
Reads a string into a xiiString. | |
XII_ALWAYS_INLINE xiiTypeVersion | ReadVersion (xiiTypeVersion expectedMaxVersion) |
A reader which can access a memory stream.
Please note that the functions exposed by this object are not thread safe! If access to the same xiiMemoryStreamStorage object from multiple threads is desired please create one instance of xiiMemoryStreamReader per thread.
|
overridevirtual |
Reads either uiBytesToRead or the amount of remaining bytes in the stream into pReadBuffer.
It is valid to pass nullptr for pReadBuffer, in this case the memory stream position is only advanced by the given number of bytes.
Implements xiiStreamReader.
|
overridevirtual |
Skips bytes in the stream (e.g. for skipping objects which can't be serialized due to missing information etc.)
Reimplemented from xiiStreamReader.