Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ManaServ::MessageOut Class Reference

Used for building an outgoing message to manaserv. More...

#include <messageout.h>

Public Member Functions

 MessageOut (uint16_t id)
 
 ~MessageOut ()
 
void writeInt8 (uint8_t value)
 Writes an unsigned 8-bit integer to the message.
 
void writeInt16 (uint16_t value)
 Writes an unsigned 16-bit integer to the message.
 
void writeInt32 (uint32_t value)
 Writes an unsigned 32-bit integer to the message.
 
void writeString (const std::string &string, int length=-1)
 Writes a string.
 
char * getData () const
 Returns the content of the message.
 
unsigned int getDataSize () const
 Returns the length of the data.
 

Private Member Functions

void expand (size_t size)
 Expand the packet data to be able to hold more data.
 
void writeValueType (ManaServ::ValueType type)
 

Private Attributes

char * mData
 Data building up.
 
unsigned int mPos
 Position in the data.
 
unsigned int mDataSize
 Size of data.
 
bool mDebugMode
 Include debugging information.
 

Detailed Description

Used for building an outgoing message to manaserv.

Definition at line 36 of file messageout.h.

Constructor & Destructor Documentation

◆ MessageOut()

ManaServ::MessageOut::MessageOut ( uint16_t  id)

Definition at line 30 of file messageout.cpp.

◆ ~MessageOut()

ManaServ::MessageOut::~MessageOut ( )

Definition at line 44 of file messageout.cpp.

Member Function Documentation

◆ expand()

void ManaServ::MessageOut::expand ( size_t  size)
private

Expand the packet data to be able to hold more data.

NOTE: For performance enhancements this method could allocate extra memory in advance instead of expanding size every time more data is added.

Definition at line 49 of file messageout.cpp.

◆ getData()

char * ManaServ::MessageOut::getData ( ) const
inline

Returns the content of the message.

Definition at line 67 of file messageout.h.

◆ getDataSize()

unsigned int ManaServ::MessageOut::getDataSize ( ) const
inline

Returns the length of the data.

Definition at line 72 of file messageout.h.

◆ writeInt16()

void ManaServ::MessageOut::writeInt16 ( uint16_t  value)

Writes an unsigned 16-bit integer to the message.

Definition at line 65 of file messageout.cpp.

◆ writeInt32()

void ManaServ::MessageOut::writeInt32 ( uint32_t  value)

Writes an unsigned 32-bit integer to the message.

Definition at line 76 of file messageout.cpp.

◆ writeInt8()

void ManaServ::MessageOut::writeInt8 ( uint8_t  value)

Writes an unsigned 8-bit integer to the message.

Definition at line 55 of file messageout.cpp.

◆ writeString()

void ManaServ::MessageOut::writeString ( const std::string &  string,
int  length = -1 
)

Writes a string.

If a fixed length is not given (-1), it is stored as a short at the start of the string.

Definition at line 87 of file messageout.cpp.

◆ writeValueType()

void ManaServ::MessageOut::writeValueType ( ManaServ::ValueType  type)
private

Definition at line 120 of file messageout.cpp.

Member Data Documentation

◆ mData

char* ManaServ::MessageOut::mData
private

Data building up.

Definition at line 86 of file messageout.h.

◆ mDataSize

unsigned int ManaServ::MessageOut::mDataSize
private

Size of data.

Definition at line 88 of file messageout.h.

◆ mDebugMode

bool ManaServ::MessageOut::mDebugMode
private

Include debugging information.

Definition at line 89 of file messageout.h.

◆ mPos

unsigned int ManaServ::MessageOut::mPos
private

Position in the data.

Definition at line 87 of file messageout.h.


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