ThunderEgg  1.0.0
ThunderEgg::BufferWriter Class Reference

Class that is used to help serialize objects into a buffer. More...

#include <BufferWriter.h>

Public Member Functions

 BufferWriter ()=default
 Create a new BufferWriter with the buffer set to nullptr. This is helpful for determining the size needed for the buffer.
 
 BufferWriter (char *buffer)
 Create a new BufferWriter with given buffer. More...
 
int getPos ()
 get the current position in the buffer More...
 
BufferWriteroperator<< (const Serializable &obj)
 Add object to the buffer. More...
 
template<typename T >
std::enable_if<!isSerializable< T >), BufferWriter >::type & operator<< (const T &obj)
 Add an object to the buffer. More...
 

Detailed Description

Class that is used to help serialize objects into a buffer.

Constructor & Destructor Documentation

◆ BufferWriter()

ThunderEgg::BufferWriter::BufferWriter ( char *  buffer)
inline

Create a new BufferWriter with given buffer.

Parameters
bufferthe pointer to the beginning of the buffer.

Member Function Documentation

◆ getPos()

int ThunderEgg::BufferWriter::getPos ( )
inline

get the current position in the buffer

Returns
the current position

◆ operator<<() [1/2]

BufferWriter& ThunderEgg::BufferWriter::operator<< ( const Serializable obj)
inline

Add object to the buffer.

Parameters
objthe Serializable object.
Returns
this BufferWriter

◆ operator<<() [2/2]

template<typename T >
std::enable_if<!isSerializable<T>), BufferWriter>::type& ThunderEgg::BufferWriter::operator<< ( const T &  obj)
inline

Add an object to the buffer.

Template Parameters
Tthe type of the object.
Parameters
objthe object. This object must be in serialized form.
Returns
this BufferWriter

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