Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

YTransText.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       YTransText.h
00014 
00015   Author:     Stefan Hundhammer <sh@suse.de>
00016 
00017 /-*/
00018 
00019 #ifndef YTransText_h
00020 #define YTransText_h
00021 
00022 #include <libintl.h>
00023 #include <string>
00024 
00025 
00030 class YTransText
00031 {
00032 public:
00033 
00037     YTransText( const std::string & orig,
00038                 const std::string & translation )
00039         : _orig( orig ), _translation( translation ) {}
00040 
00044     YTransText( const std::string & orig ) : _orig( orig )
00045     {
00046         _translation = gettext( _orig.c_str() );
00047     }
00048 
00052     YTransText( const YTransText & src )
00053     {
00054         _orig           = src.orig();
00055         _translation    = src.translation();
00056     }
00057 
00061     YTransText & operator= ( const YTransText & src )
00062     {
00063         _orig           = src.orig();
00064         _translation    = src.translation();
00065 
00066         return *this;
00067     }
00068 
00072     const std::string & orig()          const { return _orig;           }
00073 
00077     const std::string & translation()   const { return _translation;    }
00078     
00083     const std::string & trans()         const { return _translation;    }
00084 
00089     void setOrig( const std::string & newOrig ) { _orig = newOrig; }
00090 
00094     void setTranslation( const std::string &newTrans ) { _translation = newTrans; }
00095 
00099     bool operator< ( const YTransText & other ) const
00100         { return _translation < other.translation(); }
00101 
00105     bool operator> ( const YTransText & other ) const
00106         { return _translation > other.translation(); }
00107     
00111     bool operator== ( const YTransText & other ) const
00112         { return _translation == other.translation(); }
00113     
00114     
00115 private:
00116     
00117     std::string _orig;
00118     std::string _translation;
00119     
00120 };
00121 
00122 
00123 
00124 #endif // YTransText_h

Generated on Thu Feb 23 23:56:10 2006 for liby2util by doxygen 1.3.6