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

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <ChunkStream.h>

Inheritance diagram for xiiChunkStreamWriter:
[legend]

Public Member Functions

 xiiChunkStreamWriter (xiiStreamWriter &ref_stream)
 Pass the underlying stream writer to the constructor.
virtual xiiResult WriteBytes (const void *pWriteBuffer, xiiUInt64 uiBytesToWrite) override
 Writes bytes directly to the stream. Only allowed when a chunk is open (between BeginChunk / EndChunk).
virtual void BeginStream (xiiUInt16 uiVersion)
virtual void EndStream ()
 Stops writing to the chunk file. Has to be the last thing that is called.
virtual void BeginChunk (xiiStringView sName, xiiUInt32 uiVersion)
 Opens the next chunk for writing. Chunks cannot be nested (except by using multiple chunk format writers).
virtual void EndChunk ()
 Closes the current chunk.
Public Member Functions inherited from xiiStreamWriter
 xiiStreamWriter ()
 Constructor.
virtual ~xiiStreamWriter ()
 Virtual destructor to ensure correct cleanup.
virtual xiiResult Flush ()
template<typename T>
xiiResult WriteWordValue (const T *pWordValue)
 Helper method to write a word value correctly (copes with potentially different endianess).
template<typename T>
xiiResult WriteDWordValue (const T *pDWordValue)
 Helper method to write a dword value correctly (copes with potentially different endianess).
template<typename T>
xiiResult WriteQWordValue (const T *pQWordValue)
 Helper method to write a qword value correctly (copes with potentially different endianess).
XII_ALWAYS_INLINE void WriteVersion (xiiTypeVersion version)
 Writes a type version to the stream.
template<typename ArrayType, typename ValueType>
xiiResult WriteArray (const xiiArrayBase< ValueType, ArrayType > &array)
 Writes an array of elements to the stream.
template<typename ValueType, xiiUInt16 uiSize>
xiiResult WriteArray (const xiiSmallArrayBase< ValueType, uiSize > &array)
 Writes a small array of elements to the stream.
template<typename ValueType, xiiUInt32 uiSize>
xiiResult WriteArray (const ValueType(&array)[uiSize])
 Writes a C style fixed array.
template<typename KeyType, typename Comparer>
xiiResult WriteSet (const xiiSetBase< KeyType, Comparer > &set)
 Writes a set.
template<typename KeyType, typename ValueType, typename Comparer>
xiiResult WriteMap (const xiiMapBase< KeyType, ValueType, Comparer > &map)
 Writes a map.
template<typename KeyType, typename ValueType, typename Hasher>
xiiResult WriteHashTable (const xiiHashTableBase< KeyType, ValueType, Hasher > &hashTable)
 Writes a hash table (note that the entry order might change on read).
xiiResult WriteString (const xiiStringView sStringView)
 Writes a string.

Detailed Description

Copyright (c) Theophilus Eriata. All Rights Reserved.

A stream writer that separates data into 'chunks', which act like sub-streams.

This stream writer allows to subdivide a stream into chunks, where each chunk stores a chunk name, version and size in bytes.

Constructor & Destructor Documentation

◆ xiiChunkStreamWriter()

xiiChunkStreamWriter::xiiChunkStreamWriter ( xiiStreamWriter & ref_stream)

Pass the underlying stream writer to the constructor.

Copyright (c) Theophilus Eriata. All Rights Reserved.

Member Function Documentation

◆ BeginStream()

void xiiChunkStreamWriter::BeginStream ( xiiUInt16 uiVersion)
virtual

Starts writing to the chunk file. Has to be the first thing that is called. The version number is written to the stream and is returned by xiiChunkStreamReader::BeginStream()

◆ EndChunk()

void xiiChunkStreamWriter::EndChunk ( )
virtual

Closes the current chunk.

Todo
Write Chunk CRC

◆ WriteBytes()

xiiResult xiiChunkStreamWriter::WriteBytes ( const void * pWriteBuffer,
xiiUInt64 uiBytesToWrite )
overridevirtual

Writes bytes directly to the stream. Only allowed when a chunk is open (between BeginChunk / EndChunk).

Implements xiiStreamWriter.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/IO/ChunkStream.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/IO/Implementation/ChunkStream.cpp