00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _TMWSERV_MESSAGEIN_H_
00023 #define _TMWSERV_MESSAGEIN_H_
00024
00025 #include <iosfwd>
00026
00027 class Packet;
00028
00032 class MessageIn
00033 {
00034 public:
00038 MessageIn(const char *data, int length);
00039
00043 int
00044 getId() const { return mId; }
00045
00049 int
00050 getLength() const { return mLength; }
00051
00052 int readByte();
00053 int readShort();
00054 int readLong();
00061 std::string
00062 readString(int length = -1);
00063
00067 int
00068 getUnreadLength() const { return mLength - mPos; }
00069
00074 private:
00075 const char *mData;
00076 unsigned short mLength;
00077 unsigned short mId;
00083 unsigned short mPos;
00084
00088 friend std::ostream& operator <<(std::ostream &os,
00089 const MessageIn &msg);
00090 };
00091
00092 #endif