ezEngine  Milestone 7
ezMemoryStreamWriter Class Reference

A writer which can access a memory stream. More...

#include <MemoryStream.h>

Inheritance diagram for ezMemoryStreamWriter:

Public Member Functions

 ezMemoryStreamWriter (ezMemoryStreamStorage *pStreamStorage=nullptr)
 Pass the memory storage object to which to write to.
 
void SetStorage (ezMemoryStreamStorage *pStreamStorage)
 Sets the storage object upon which to operate. Resets the write position to the end of the storage stream. Pass nullptr if you want to detach from any previous storage stream, for example to ensure its reference count gets properly reduced.
 
virtual ezResult WriteBytes (const void *pWriteBuffer, ezUInt64 uiBytesToWrite) override
 Copies uiBytesToWrite from pWriteBuffer into the memory stream. More...
 
void SetWritePosition (ezUInt32 uiReadPosition)
 Sets the write position to be used.
 
ezUInt32 GetByteCount () const
 Returns the total stored bytes in the memory stream.
 
- Public Member Functions inherited from ezStreamWriterBase
 ezStreamWriterBase ()
 Constructor.
 
virtual ~ezStreamWriterBase ()
 Virtual destructor to ensure correct cleanup.
 
virtual ezResult 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 >
ezResult WriteWordValue (const T *pWordValue)
 Helper method to write a word value correctly (copes with potentially different endianess)
 
template<typename T >
ezResult WriteDWordValue (const T *pDWordValue)
 Helper method to write a dword value correctly (copes with potentially different endianess)
 
template<typename T >
ezResult WriteQWordValue (const T *pQWordValue)
 Helper method to write a qword value correctly (copes with potentially different endianess)
 

Private Attributes

ezScopedRefPointer
< ezMemoryStreamStorage
m_pStreamStorage
 
ezUInt32 m_uiWritePosition
 

Detailed Description

A writer which can access a memory stream.

Please note that the functions exposed by this object are not thread safe!

Member Function Documentation

ezResult ezMemoryStreamWriter::WriteBytes ( const void *  pWriteBuffer,
ezUInt64  uiBytesToWrite 
)
overridevirtual

Copies uiBytesToWrite from pWriteBuffer into the memory stream.

pWriteBuffer must be a valid buffer and must hold that much data.

Implements ezStreamWriterBase.


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