00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef TRANSLATOR_H
00029 #define TRANSLATOR_H
00030
00031 #include <string>
00032 #include <exception>
00033
00034 using std::exception;
00035 using std::string;
00036
00037 namespace ICQ2000 {
00038 class TranslatorException : exception {
00039 private:
00040 string m_errortext;
00041
00042 public:
00043 TranslatorException(const string& text);
00044 ~TranslatorException() throw() { }
00045
00046 const char* what() const throw();
00047 };
00048
00049 class Translator{
00050 public:
00051 Translator();
00052 void setDefaultTranslationMap();
00053 void setTranslationMap(const string& szMapFileName);
00054 void ServerToClient(string& szString);
00055 void ClientToServer(string& szString);
00056 string ServerToClientCC(const string& szString);
00057 string ClientToServerCC(const string& szString);
00058 void ServerToClient(char &_cChar);
00059 void ClientToServer(char &_cChar);
00060 static void CRLFtoLF(string& s);
00061 static void LFtoCRLF(string& s);
00062 bool usingDefaultMap() const { return m_bDefault; }
00063 const string& getMapFileName() const { return m_szMapFileName; }
00064 const string& getMapName() const { return m_szMapName; }
00065
00066 protected:
00067 unsigned char serverToClientTab[256];
00068 unsigned char clientToServerTab[256];
00069 string m_szMapFileName, m_szMapName;
00070 bool m_bDefault;
00071 };
00072 }
00073
00074 #endif