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

Reader for the chunk format that xiiChunkStreamWriter writes. More...

#include <ChunkStream.h>

Inheritance diagram for xiiChunkStreamReader:
[legend]

Classes

struct  ChunkInfo
 Describes the state of the current chunk. More...
 

Public Types

enum class  EndChunkFileMode { SkipToEnd , JustClose }
 

Public Member Functions

 xiiChunkStreamReader (xiiStreamReader &ref_stream)
 Pass the underlying stream writer to the constructor.
 
virtual xiiUInt64 ReadBytes (void *pReadBuffer, xiiUInt64 uiBytesToRead) override
 Reads bytes directly from the stream. Only allowed while a valid chunk is available. Returns 0 bytes when the end of a chunk is reached, even if there are more chunks to come.
 
void SetEndChunkFileMode (EndChunkFileMode mode)
 
virtual xiiUInt16 BeginStream ()
 Starts reading from the chunk file. Returns the version number that was passed to xiiChunkStreamWriter::BeginStream().
 
virtual void EndStream ()
 Stops reading from the chunk file. Optionally skips the remaining bytes, so that the underlying streams read position is after the chunk file content.
 
const ChunkInfoGetCurrentChunk () const
 Returns information about the current chunk.
 
void NextChunk ()
 Skips the rest of the current chunk and starts reading the next chunk.
 
- 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.
 
virtual xiiUInt64 SkipBytes (xiiUInt64 uiBytesToSkip)
 Helper method to skip a number of bytes (implementations of the stream reader may implement this more efficiently for example).
 
XII_ALWAYS_INLINE xiiTypeVersion ReadVersion (xiiTypeVersion expectedMaxVersion)
 

Detailed Description

Reader for the chunk format that xiiChunkStreamWriter writes.

Member Enumeration Documentation

◆ EndChunkFileMode

Enumerator
SkipToEnd 

Makes sure all data is properly read, so that the stream read position is after the chunk file data. Useful if the chunk file is embedded in another file stream.

JustClose 

Just stops, leaving the stream at the last read position. This should be used if definitely nothing more needs to be read from all underlying streams.

Member Function Documentation

◆ ReadBytes()

xiiUInt64 xiiChunkStreamReader::ReadBytes ( void * pReadBuffer,
xiiUInt64 uiBytesToRead )
overridevirtual

Reads bytes directly from the stream. Only allowed while a valid chunk is available. Returns 0 bytes when the end of a chunk is reached, even if there are more chunks to come.

Implements xiiStreamReader.


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