Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXTranslator.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       M e s s a g e   T r a n s l a t o r                     *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2005,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXTranslator.h,v 1.6 2006/01/22 17:58:11 fox Exp $                       *
00023 ********************************************************************************/
00024 #ifndef FXTRANSLATOR_H
00025 #define FXTRANSLATOR_H
00026 
00027 #ifndef FXOBJECT_H
00028 #include "FXObject.h"
00029 #endif
00030 
00031 
00032 ////////////////////////////  UNDER DEVELOPMENT  ////////////////////////////////
00033 
00034 
00035 namespace FX {
00036 
00037 class FXApp;
00038 class FXTextCodec;
00039 
00040 
00041 /**
00042 * The translator class translates a message to another language.
00043 */
00044 class FXAPI FXTranslator : public FXObject {
00045   FXDECLARE(FXTranslator)
00046 private:
00047   FXApp       *app;     // Back link to application object
00048   FXTextCodec *codec;   // Text codec used for source text
00049 private:
00050   FXTranslator(const FXTranslator&);
00051   FXTranslator &operator=(const FXTranslator&);
00052 protected:
00053   FXTranslator():app((FXApp*)-1L){}
00054 public:
00055 
00056   /// Construct translator
00057   FXTranslator(FXApp* a);
00058 
00059   /// Get application
00060   FXApp* getApp() const { return app; }
00061 
00062   /// Translate a string
00063   virtual const FXchar* tr(const FXchar* context,const FXchar* message,const FXchar* hint=NULL) const;
00064 
00065   /// Change text codec used to decode the messages embedded in the source
00066   void setTextCodec(FXTextCodec *cdc){ codec=cdc; }
00067 
00068   /// Return text codec
00069   FXTextCodec *getTextCodec() const { return codec; }
00070 
00071   /// Save translator to a stream
00072   virtual void save(FXStream& store) const;
00073 
00074   /// Load translator from a stream
00075   virtual void load(FXStream& store);
00076 
00077   /// Destructor
00078   virtual ~FXTranslator();
00079   };
00080 
00081 
00082 }
00083 
00084 #endif

Copyright © 1997-2005 Jeroen van der Zijp