ChannelText.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(__INCLUDE_ChannelTexth_INCLUDE__)
00022 #define __INCLUDE_ChannelTexth_INCLUDE__
00023 
00024 #include <string>
00025 #include <vector>
00026 #include <net/NetBuffer.h>
00027 
00028 class ChannelDefinition
00029 {
00030 public:
00031         enum ChannelDefinitionTypes
00032         {
00033                 eReadOnlyChannel = 1,
00034                 eWhisperChannel = 2
00035         };
00036 
00037         ChannelDefinition(const char *channel = "", 
00038                 unsigned int type = 0);
00039 
00040         const char *getChannel() { return channel_.c_str(); }
00041         void setChannel(const char *c) { channel_ = c; }
00042 
00043         unsigned int getType() { return type_; }
00044         void setType(unsigned int t) { type_ = t; }
00045 
00046 protected:
00047         std::string channel_;
00048         unsigned int type_;
00049 };
00050 
00051 class ChannelText
00052 {
00053 public:
00054         enum Flags
00055         {
00056                 eNoLog = 1,
00057                 eNoSound = 2
00058         };
00059 
00060         ChannelText();
00061         ChannelText(
00062                 const std::string &channel, 
00063                 const LangString &message);
00064         ChannelText(
00065                 const std::string &channel, 
00066                 const std::string &key,
00067                 const std::string &value);
00068         ChannelText(
00069                 const std::string &channel, 
00070                 const std::string &key,
00071                 const std::string &value,
00072                 const LangStringConverter &param1);
00073         ChannelText(
00074                 const std::string &channel, 
00075                 const std::string &key,
00076                 const std::string &value,
00077                 const LangStringConverter &param1,
00078                 const LangStringConverter &param2);
00079         ChannelText(
00080                 const std::string &channel, 
00081                 const std::string &key,
00082                 const std::string &value,
00083                 const LangStringConverter &param1,
00084                 const LangStringConverter &param2,
00085                 const LangStringConverter &param3);
00086         ChannelText(
00087                 const std::string &channel, 
00088                 const std::string &key,
00089                 const std::string &value,
00090                 const LangStringConverter &param1,
00091                 const LangStringConverter &param2,
00092                 const LangStringConverter &param3,
00093                 const LangStringConverter &param4);
00094 
00095         void setChannel(const std::string &channel) { channel_ = channel; }
00096         void setMessage(const LangString &message) { message_ = message; }
00097         void setMessageKey(const std::string &key) { messageKey_ = key; }
00098         void setMessageValue(const std::string &value) { messageValue_ = value; }
00099         void setSrcPlayerId(unsigned int srcPlayerId) { srcPlayerId_ = srcPlayerId; }
00100         void setDestPlayerId(unsigned int destPlayerId) { destPlayerId_ = destPlayerId; }
00101         void setFlags(unsigned int flags) { flags_ = flags; }
00102         void setAdminPlayer(const std::string &admin) { admin_ = admin; }
00103 
00104         const std::string &getChannel() { return channel_; }
00105         const LangString &getMessage();
00106         const std::string &getAdminPlayer() { return admin_; }
00107         const std::string &getMessageKey() { return messageKey_; }
00108         const std::string &getMessageValue() { return messageValue_; }
00109         const std::vector<LangString> &getMessageParams() { return messageParams_; }
00110     unsigned int getSrcPlayerId() { return srcPlayerId_; }
00111         unsigned int getDestPlayerId() { return destPlayerId_; }
00112         unsigned int getFlags() { return flags_; }
00113 
00114     virtual bool writeMessage(NetBuffer &buffer);
00115     virtual bool readMessage(NetBufferReader &reader);
00116 
00117 protected:
00118         unsigned int srcPlayerId_;
00119         unsigned int destPlayerId_;
00120         unsigned int flags_;
00121         std::string messageKey_;
00122         std::vector<LangString> messageParams_;
00123         std::string messageValue_;
00124         std::string channel_;
00125         LangString message_;
00126         std::string admin_;
00127 };
00128 
00129 #endif // __INCLUDE_ChannelTexth_INCLUDE__

Generated on Mon Feb 16 15:14:48 2009 for Scorched3D by  doxygen 1.5.3