MessageOut Class Reference

#include <messageout.hpp>

List of all members.


Detailed Description

Used for building an outgoing message.

Definition at line 32 of file messageout.hpp.

Public Member Functions

 MessageOut ()
 Constructor.
 MessageOut (short id)
 Constructor that takes a message ID.
 ~MessageOut ()
 Destructor.
void writeByte (char value)
 Writes a byte.
void writeShort (short value)
 Writes a short.
void writeLong (long value)
 Writes a long.
void writeCoordinates (int x, int y)
 Writes a 3-byte block containing tile-based coordinates.
void writeString (const std::string &string, int length=-1)
 Writes a string.
char * getData () const
 Returns the content of the message.
unsigned int getLength () const
 Returns the length of the data.

Private Member Functions

void expand (size_t size)
 Ensures the capacity of the data buffer is large enough to hold the given amount of bytes.

Private Attributes

char * mData
 Data building up.
unsigned int mPos
 Position in the data.
unsigned int mDataSize
 Allocated datasize.


Constructor & Destructor Documentation

MessageOut::MessageOut  ) 
 

Constructor.

Definition at line 37 of file messageout.cpp.

MessageOut::MessageOut short  id  ) 
 

Constructor that takes a message ID.

Definition at line 44 of file messageout.cpp.

MessageOut::~MessageOut  ) 
 

Destructor.

Definition at line 53 of file messageout.cpp.


Member Function Documentation

void MessageOut::expand size_t  size  )  [private]
 

Ensures the capacity of the data buffer is large enough to hold the given amount of bytes.

Definition at line 59 of file messageout.cpp.

char* MessageOut::getData  )  const [inline]
 

Returns the content of the message.

Definition at line 75 of file messageout.hpp.

unsigned int MessageOut::getLength  )  const [inline]
 

Returns the length of the data.

Definition at line 81 of file messageout.hpp.

void MessageOut::writeByte char  value  ) 
 

Writes a byte.

Definition at line 74 of file messageout.cpp.

void MessageOut::writeCoordinates int  x,
int  y
 

Writes a 3-byte block containing tile-based coordinates.

Definition at line 99 of file messageout.cpp.

void MessageOut::writeLong long  value  ) 
 

Writes a long.

Definition at line 91 of file messageout.cpp.

void MessageOut::writeShort short  value  ) 
 

Writes a short.

Definition at line 82 of file messageout.cpp.

void 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 110 of file messageout.cpp.


Member Data Documentation

char* MessageOut::mData [private]
 

Data building up.

Definition at line 91 of file messageout.hpp.

unsigned int MessageOut::mDataSize [private]
 

Allocated datasize.

Definition at line 93 of file messageout.hpp.

unsigned int MessageOut::mPos [private]
 

Position in the data.

Definition at line 92 of file messageout.hpp.


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 15:39:18 2007 for TMW Server by  doxygen 1.3.9.1