Mana
|
Used for parsing an incoming message from manaserv. More...
#include <messagein.h>
Public Member Functions | |
MessageIn (const char *data, unsigned int length) | |
uint16_t | getId () const |
Returns the message ID. | |
unsigned int | getLength () const |
Returns the message length. | |
unsigned int | getUnreadLength () const |
Returns the length of unread data. | |
uint8_t | readInt8 () |
Reads an unsigned 8-bit integer from the message. | |
uint16_t | readInt16 () |
Reads an unsigned 16-bit integer from the message. | |
uint32_t | readInt32 () |
Reads an unsigned 32-bit integer from the message. | |
std::string | readString (int length=-1) |
Reads a string. | |
Private Member Functions | |
bool | readValueType (ManaServ::ValueType type) |
Private Attributes | |
const char * | mData |
The message data. | |
unsigned int | mLength |
The length of the data. | |
unsigned short | mId |
The message ID. | |
bool | mDebugMode |
Includes debugging information. | |
unsigned int | mPos |
Actual position in the packet. | |
Used for parsing an incoming message from manaserv.
Definition at line 36 of file messagein.h.
ManaServ::MessageIn::MessageIn | ( | const char * | data, |
unsigned int | length | ||
) |
Definition at line 29 of file messagein.cpp.
|
inline |
Returns the message ID.
Definition at line 44 of file messagein.h.
|
inline |
Returns the message length.
Definition at line 49 of file messagein.h.
|
inline |
Returns the length of unread data.
Definition at line 54 of file messagein.h.
uint16_t ManaServ::MessageIn::readInt16 | ( | ) |
Reads an unsigned 16-bit integer from the message.
Definition at line 58 of file messagein.cpp.
uint32_t ManaServ::MessageIn::readInt32 | ( | ) |
Reads an unsigned 32-bit integer from the message.
Definition at line 75 of file messagein.cpp.
uint8_t ManaServ::MessageIn::readInt8 | ( | ) |
Reads an unsigned 8-bit integer from the message.
Definition at line 43 of file messagein.cpp.
std::string ManaServ::MessageIn::readString | ( | int | length = -1 | ) |
Reads a string.
If a length is not given (-1), it is assumed that the length of the string is stored in a short at the start of the string.
Definition at line 92 of file messagein.cpp.
|
private |
Definition at line 131 of file messagein.cpp.
|
private |
The message data.
Definition at line 84 of file messagein.h.
|
private |
Includes debugging information.
Definition at line 87 of file messagein.h.
|
private |
The message ID.
Definition at line 86 of file messagein.h.
|
private |
The length of the data.
Definition at line 85 of file messagein.h.
|
private |
Actual position in the packet.
From 0 to packet->length. A value bigger than packet->length means EOP was reached when reading it.
Definition at line 93 of file messagein.h.