Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

Translator.h

00001 /*
00002  * Translate class
00003  *
00004  * Many parts of this source code were 'inspired' by the ircII4.4 translat.c source.
00005  * RIPPED FROM KVirc: http://www.kvirc.org
00006  * Original by Szymon Stefanek (kvirc@tin.it).
00007  * Modified by Andrew Frolov (dron@linuxer.net)
00008  * Further modified by Graham Roff
00009  *
00010  * 'Borrowed' from licq - thanks Barnaby
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public
00014  * License as published by the Free Software Foundation; either
00015  * version 2.1 of the License, or (at your option) any later version.
00016  *
00017  * This library is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020  * Lesser General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU Lesser General Public
00023  * License along with this library; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
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     void ServerToClient(char &_cChar);
00057     void ClientToServer(char &_cChar);
00058     static void CRLFtoLF(string& s);
00059     static void LFtoCRLF(string& s);
00060     bool usingDefaultMap() const { return m_bDefault; }
00061     const string& getMapFileName() const { return m_szMapFileName; }
00062     const string& getMapName() const { return m_szMapName; }
00063 
00064    protected:
00065     unsigned char serverToClientTab[256];
00066     unsigned char clientToServerTab[256];
00067     string m_szMapFileName, m_szMapName;
00068     bool m_bDefault;
00069   };
00070 }
00071 
00072 #endif

Generated on Tue Jan 15 12:24:36 2002 for libicq2000 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001