uitranslator.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 2005 by Tobias Nadler                                         */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library 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 GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
00019 /*                                                                              */
00020 /********************************************************************************/
00021 
00022 #ifndef UITRANSLATOR_H
00023 #define UITRANSLATOR_H
00024 
00025 #include <list>
00026 #include "SDL/SDL.h"
00027 
00028 using namespace std;
00029 
00049 class DECLSPEC UiTranslator
00050 {
00051 public:
00057     DECLSPEC UiTranslator( const char *language = 0 );
00058     virtual DECLSPEC ~UiTranslator();
00059 
00063     const char *getLanguage() const { return chLanguage; }
00069     virtual const char *translate( const char *expression ) = 0;
00070 
00071 protected:
00077     DECLSPEC void setLanguage( const char * lang );
00078 
00079 private:
00080     char * chLanguage;
00081 };
00082 
00097 class DECLSPEC UiFileTranslator : public UiTranslator
00098 {
00099 public:
00104     DECLSPEC UiFileTranslator( const char *fn = 0 );
00105     virtual DECLSPEC ~UiFileTranslator();
00106 
00112     DECLSPEC bool load( const char *fn );
00113     virtual DECLSPEC const char *translate( const char *expression );
00114 
00115 private:
00116     struct EXPRESSION
00117     {
00118         EXPRESSION()    {
00119             chCoded = 0;
00120             chTranslated = 0;
00121         }
00122         char *chCoded;
00123         char *chTranslated;
00124     };
00125     list<EXPRESSION> lExpressions[27];// [0..25]: alphabetical order a..z; [26]: numbers&co
00126 };
00127 
00128 
00129 
00130 #endif

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1