00001
00002
00003
00004 #ifndef __COMMAND_H__
00005 #define __COMMAND_H__
00006
00007 #include <string>
00008
00009 namespace ircpp {
00010
00027 class command
00028 {
00029
00030 public:
00031
00032 command();
00033 explicit command(const std::string& cmd);
00034 explicit command(const unsigned int cmd);
00035
00036
00037 command& operator= (const std::string& cmd);
00038 command& operator= (const unsigned int cmd);
00039
00040
00041 operator const int () const;
00042 const std::string& str() const;
00043 bool is_numeric() const;
00044
00045
00046 bool operator== (const command& cmd) const;
00047 bool operator== (const unsigned int& cmd) const;
00048 bool operator== (const int& cmd) const;
00049 bool operator== (const std::string& cmd) const;
00050
00051
00052 private:
00053 std::string num2string(unsigned int cmd) const;
00054 unsigned int string2num(const std::string& cmd) const;
00055
00056
00057 private:
00058 std::string cmdstring;
00059 unsigned int cmdint;
00060 static const unsigned int numcmds;
00061 };
00062
00063 #define TEXT_CMDS_BASE 1000
00064
00065 typedef enum {
00066 PASS = TEXT_CMDS_BASE,
00067 NICK,
00068 USER,
00069 SERVER,
00070 OPER,
00071 QUIT,
00072 SQUIT,
00073 JOIN,
00074 PART,
00075 MODE,
00076 TOPIC,
00077 NAMES,
00078 LIST,
00079 INVITE,
00080 KICK,
00081 VERSION,
00082 STATS,
00083 LINKS,
00084 TIME,
00085 CONNECT,
00086 TRACE,
00087 ADMIN,
00088 INFO,
00089 PRIVMSG,
00090 NOTICE,
00091 WHO,
00092 WHOIS,
00093 WHOWAS,
00094 KILL,
00095 PING,
00096 PONG,
00097 ERROR
00098 };
00099
00100 }
00101
00102 #endif