XII Release 0.1.0
Loading...
Searching...
No Matches
xiiRawMemoryStreamReader Class Reference

Maps a raw chunk of memory to the xiiStreamReader interface. More...

#include <MemoryStream.h>

Inheritance diagram for xiiRawMemoryStreamReader:
[legend]

Public Member Functions

 xiiRawMemoryStreamReader (const void *pData, xiiUInt64 uiDataSize)
 Initialize the raw memory reader with the chunk of memory that is the data storage.
 
template<typename CONTAINER>
 xiiRawMemoryStreamReader (const CONTAINER &container)
 Initialize the raw memory reader with the chunk of memory from a standard XII container.
 
void Reset (const void *pData, xiiUInt64 uiDataSize)
 
template<typename CONTAINER>
void Reset (const CONTAINER &container)
 
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 in the raw memory block.
 
xiiUInt64 GetByteCount () const
 Returns the total available bytes in the memory stream.
 
void SetDebugSourceInformation (xiiStringView sDebugSourceInformation)
 Allows to set a string as the source of information in the memory stream for debug purposes.
 
- Public Member Functions inherited from xiiStreamReader
 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)
 

Detailed Description

Maps a raw chunk of memory to the xiiStreamReader interface.

Constructor & Destructor Documentation

◆ xiiRawMemoryStreamReader()

template<typename CONTAINER>
xiiRawMemoryStreamReader::xiiRawMemoryStreamReader ( const CONTAINER & container)
inline

Initialize the raw memory reader with the chunk of memory from a standard XII container.

Note
The container must store the data in a contiguous array.

Member Function Documentation

◆ ReadBytes()

xiiUInt64 xiiRawMemoryStreamReader::ReadBytes ( void * pReadBuffer,
xiiUInt64 uiBytesToRead )
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.

◆ SkipBytes()

xiiUInt64 xiiRawMemoryStreamReader::SkipBytes ( xiiUInt64 uiBytesToSkip)
overridevirtual

Skips bytes in the stream (e.g. for skipping objects which can't be serialized due to missing information etc.)

Reimplemented from xiiStreamReader.


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