ManaPlus
Public Member Functions
EAthena::MessageIn Class Reference

#include <messagein.h>

Inheritance diagram for EAthena::MessageIn:
Net::MessageIn

Public Member Functions

 MessageIn (const char *const data, const unsigned int length)
 
void postInit (const char *const str, const unsigned int version)
 
- Public Member Functions inherited from Net::MessageIn
virtual ~MessageIn ()
 
uint16_t readId () const
 
int getId () const
 
unsigned int getLength () const
 
unsigned int getUnreadLength () const
 
unsigned char readUInt8 (const char *const str)
 
signed char readInt8 (const char *const str)
 
int16_t readInt16 (const char *const str)
 
uint16_t readUInt16 (const char *const str)
 
int32_t readInt32 (const char *const str)
 
uint32_t readUInt32 (const char *const str)
 
int readItemId (const char *const str)
 
int64_t readInt64 (const char *const str)
 
BeingId readBeingId (const char *const str)
 
float readFloat (const char *const str)
 
void readCoordinates (uint16_t &x, uint16_t &y, uint8_t &direction, const char *const str)
 
void readCoordinatePair (uint16_t &srcX, uint16_t &srcY, uint16_t &dstX, uint16_t &dstY, const char *const str)
 
void skip (const unsigned int length, const char *const str)
 
void skipToEnd (const char *const str)
 
std::string readString (int length, const char *const dstr)
 
std::string readRawString (int length, const char *const dstr)
 
unsigned char * readBytes (int length, const char *const dstr)
 
int getVersion () const
 
int getVersionMain () const
 
int getVersionRe () const
 
int getVersionZero () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Net::MessageIn
static uint8_t fromServerDirection (const uint8_t serverDir)
 
- Protected Member Functions inherited from Net::MessageIn
 MessageIn (const char *const data, const unsigned int length)
 
- Protected Attributes inherited from Net::MessageIn
const char * mData
 
unsigned int mLength
 
unsigned int mPos
 
int mVersion
 
uint16_t mId
 
bool mIgnore
 

Detailed Description

Used for parsing an incoming message.

Definition at line 39 of file messagein.h.

Constructor & Destructor Documentation

◆ MessageIn()

EAthena::MessageIn::MessageIn ( const char *const  data,
const unsigned int  length 
)

Constructor.

Definition at line 37 of file messagein.cpp.

38  :
39  Net::MessageIn(data, length)
40 {
41 }
uint32_t data

Member Function Documentation

◆ postInit()

void EAthena::MessageIn::postInit ( const char *const  str,
const unsigned int  version 
)

Definition at line 43 of file messagein.cpp.

45 {
46  // Read the message ID
47  mId = readId();
48  mVersion = version;
50  DEBUGLOG2("Receive packet", 0, "MessageIn");
51 #ifdef ENABLEDEBUGLOG
52  if (mVersion > 0)
53  {
54  const std::string verStr = toString(mVersion);
55  DEBUGLOG2("Version", 0, verStr.c_str());
56  }
57 #endif // ENABLEDEBUGLOG
58 
59  readInt16(str);
60 }
uint16_t mId
Definition: messagein.h:161
int16_t readInt16(const char *const str)
Definition: messagein.cpp:131
uint16_t readId() const
Definition: messagein.cpp:87
#define IGNOREDEBUGLOG
Definition: logger.h:48
#define DEBUGLOG2(str, pos, comment)
Definition: logger.h:42
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774

References DEBUGLOG2, IGNOREDEBUGLOG, Net::MessageIn::mId, Net::MessageIn::mVersion, Net::MessageIn::readId(), Net::MessageIn::readInt16(), and Catch::toString().


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