libyui
|
00001 /************************************************************************** 00002 Copyright (C) 2000 - 2010 Novell, Inc. 00003 All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00019 **************************************************************************/ 00020 00021 00022 /*---------------------------------------------------------------------\ 00023 | | 00024 | __ __ ____ _____ ____ | 00025 | \ \ / /_ _/ ___|_ _|___ \ | 00026 | \ V / _` \___ \ | | __) | | 00027 | | | (_| |___) || | / __/ | 00028 | |_|\__,_|____/ |_| |_____| | 00029 | | 00030 | core system | 00031 | (C) SuSE GmbH | 00032 \----------------------------------------------------------------------/ 00033 00034 File: YTransText.h 00035 00036 Author: Stefan Hundhammer <sh@suse.de> 00037 00038 /-*/ 00039 00040 #ifndef YTransText_h 00041 #define YTransText_h 00042 00043 #include <libintl.h> 00044 #include <string> 00045 00046 00051 class YTransText 00052 { 00053 public: 00054 00058 YTransText( const std::string & orig, 00059 const std::string & translation ) 00060 : _orig( orig ), _translation( translation ) {} 00061 00065 YTransText( const std::string & orig ) : _orig( orig ) 00066 { 00067 _translation = gettext( _orig.c_str() ); 00068 } 00069 00073 YTransText( const YTransText & src ) 00074 { 00075 _orig = src.orig(); 00076 _translation = src.translation(); 00077 } 00078 00082 YTransText & operator= ( const YTransText & src ) 00083 { 00084 _orig = src.orig(); 00085 _translation = src.translation(); 00086 00087 return *this; 00088 } 00089 00093 const std::string & orig() const { return _orig; } 00094 00098 const std::string & translation() const { return _translation; } 00099 00104 const std::string & trans() const { return _translation; } 00105 00110 void setOrig( const std::string & newOrig ) { _orig = newOrig; } 00111 00115 void setTranslation( const std::string & newTrans ) { _translation = newTrans; } 00116 00120 bool operator< ( const YTransText & other ) const 00121 { return _translation < other.translation(); } 00122 00126 bool operator> ( const YTransText & other ) const 00127 { return _translation > other.translation(); } 00128 00132 bool operator== ( const YTransText & other ) const 00133 { return _translation == other.translation(); } 00134 00135 00136 private: 00137 00138 std::string _orig; 00139 std::string _translation; 00140 00141 }; 00142 00143 00144 00145 #endif // YTransText_h