Plasma Engine  2.0
Loading...
Searching...
No Matches
plChunkStreamWriter Class Reference

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

#include <ChunkStream.h>

Inheritance diagram for plChunkStreamWriter:

Public Member Functions

 plChunkStreamWriter (plStreamWriter &inout_stream)
 Pass the underlying stream writer to the constructor.
 
virtual plResult WriteBytes (const void *pWriteBuffer, plUInt64 uiBytesToWrite) override
 Writes bytes directly to the stream. Only allowed when a chunk is open (between BeginChunk / EndChunk).
 
virtual void BeginStream (plUInt16 uiVersion)
 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 plChunkStreamReader::BeginStream()
 
virtual void EndStream ()
 Stops writing to the chunk file. Has to be the last thing that is called.
 
virtual void BeginChunk (plStringView sName, plUInt32 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 plStreamWriter
 plStreamWriter ()
 Constructor.
 
virtual ~plStreamWriter ()
 Virtual destructor to ensure correct cleanup.
 
virtual plResult Flush ()
 Flushes the stream, may be implemented (not necessary to implement the interface correctly) so that user code can ensure that content is written.
 
template<typename T >
plResult WriteWordValue (const T *pWordValue)
 Helper method to write a word value correctly (copes with potentially different endianess)
 
template<typename T >
plResult WriteDWordValue (const T *pDWordValue)
 Helper method to write a dword value correctly (copes with potentially different endianess)
 
template<typename T >
plResult WriteQWordValue (const T *pQWordValue)
 Helper method to write a qword value correctly (copes with potentially different endianess)
 
PL_ALWAYS_INLINE void WriteVersion (plTypeVersion version)
 Writes a type version to the stream.
 
template<typename ArrayType , typename ValueType >
plResult WriteArray (const plArrayBase< ValueType, ArrayType > &array)
 Writes an array of elements to the stream.
 
template<typename ValueType , plUInt16 uiSize>
plResult WriteArray (const plSmallArrayBase< ValueType, uiSize > &array)
 Writes a small array of elements to the stream.
 
template<typename ValueType , plUInt32 uiSize>
plResult WriteArray (const ValueType(&array)[uiSize])
 Writes a C style fixed array.
 
template<typename KeyType , typename Comparer >
plResult WriteSet (const plSetBase< KeyType, Comparer > &set)
 Writes a set.
 
template<typename KeyType , typename ValueType , typename Comparer >
plResult WriteMap (const plMapBase< KeyType, ValueType, Comparer > &map)
 Writes a map.
 
template<typename KeyType , typename ValueType , typename Hasher >
plResult WriteHashTable (const plHashTableBase< KeyType, ValueType, Hasher > &hashTable)
 Writes a hash table (note that the entry order might change on read)
 
plResult WriteString (const plStringView sStringView)
 Writes a string.
 

Detailed Description

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.

Member Function Documentation

◆ EndChunk()

void plChunkStreamWriter::EndChunk ( )
virtual

Closes the current chunk.

Todo
Write Chunk CRC

◆ WriteBytes()

plResult plChunkStreamWriter::WriteBytes ( const void * pWriteBuffer,
plUInt64 uiBytesToWrite )
overridevirtual

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

Implements plStreamWriter.


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