MessageIn Class Reference

Used for parsing an incoming message. More...

#include <messagein.hpp>

List of all members.

Public Member Functions

 MessageIn (const char *data, int length)
 Constructor.
int getId () const
 Returns the message ID.
int getLength () const
 Returns the total length of this message.
int readByte ()
 Reads a byte.
int readShort ()
 Reads a short.
int readLong ()
 Reads a long.
std::string readString (int length=-1)
 Reads a string.
int getUnreadLength () const
 Returns the length of unread data.

Friends

std::ostream & operator<< (std::ostream &os, const MessageIn &msg)
 Streams message ID and length to the given output stream.


Detailed Description

Used for parsing an incoming message.

Definition at line 32 of file messagein.hpp.


Member Function Documentation

int MessageIn::readByte (  ) 

Reads a byte.

Definition at line 39 of file messagein.cpp.

Referenced by GameHandler::processMessage().

int MessageIn::readShort (  ) 

int MessageIn::readLong (  ) 

std::string 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 76 of file messagein.cpp.

References readShort().

Referenced by Character::Character(), GameHandler::processMessage(), AccountConnection::processMessage(), ChatHandler::processMessage(), ServerHandler::processMessage(), and AccountConnection::sendPost().


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

Generated on Sun Apr 26 17:30:46 2009 for TMW Server Collection by  doxygen 1.5.5