Mana
|
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. | |
Used for building an outgoing message to manaserv.
Definition at line 36 of file messageout.h.
ManaServ::MessageOut::MessageOut | ( | uint16_t | id | ) |
Definition at line 30 of file messageout.cpp.
ManaServ::MessageOut::~MessageOut | ( | ) |
Definition at line 44 of file messageout.cpp.
|
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.
|
inline |
Returns the content of the message.
Definition at line 67 of file messageout.h.
|
inline |
Returns the length of the data.
Definition at line 72 of file messageout.h.
void ManaServ::MessageOut::writeInt16 | ( | uint16_t | value | ) |
Writes an unsigned 16-bit integer to the message.
Definition at line 65 of file messageout.cpp.
void ManaServ::MessageOut::writeInt32 | ( | uint32_t | value | ) |
Writes an unsigned 32-bit integer to the message.
Definition at line 76 of file messageout.cpp.
void ManaServ::MessageOut::writeInt8 | ( | uint8_t | value | ) |
Writes an unsigned 8-bit integer to the message.
Definition at line 55 of file messageout.cpp.
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.
|
private |
Definition at line 120 of file messageout.cpp.
|
private |
Data building up.
Definition at line 86 of file messageout.h.
|
private |
Size of data.
Definition at line 88 of file messageout.h.
|
private |
Include debugging information.
Definition at line 89 of file messageout.h.
|
private |
Position in the data.
Definition at line 87 of file messageout.h.