libyui
YTransText.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YTransText.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef YTransText_h
26 #define YTransText_h
27 
28 #include <libintl.h>
29 #include <string>
30 
31 
37 {
38 public:
39 
43  YTransText( const std::string & orig,
44  const std::string & translation )
45  : _orig( orig ), _translation( translation ) {}
46 
50  YTransText( const std::string & orig ) : _orig( orig )
51  {
52  _translation = gettext( _orig.c_str() );
53  }
54 
58  YTransText( const YTransText & src )
59  {
60  _orig = src.orig();
61  _translation = src.translation();
62  }
63 
67  YTransText & operator= ( const YTransText & src )
68  {
69  _orig = src.orig();
70  _translation = src.translation();
71 
72  return *this;
73  }
74 
78  const std::string & orig() const { return _orig; }
79 
83  const std::string & translation() const { return _translation; }
84 
89  const std::string & trans() const { return _translation; }
90 
95  void setOrig( const std::string & newOrig ) { _orig = newOrig; }
96 
100  void setTranslation( const std::string & newTrans ) { _translation = newTrans; }
101 
105  bool operator< ( const YTransText & other ) const
106  { return _translation < other.translation(); }
107 
111  bool operator> ( const YTransText & other ) const
112  { return _translation > other.translation(); }
113 
117  bool operator== ( const YTransText & other ) const
118  { return _translation == other.translation(); }
119 
120 
121 private:
122 
123  std::string _orig;
124  std::string _translation;
125 
126 };
127 
128 
129 
130 #endif // YTransText_h
YTransText(const std::string &orig, const std::string &translation)
Definition: YTransText.h:43
const std::string & trans() const
Definition: YTransText.h:89
bool operator>(const YTransText &other) const
Definition: YTransText.h:111
bool operator<(const YTransText &other) const
Definition: YTransText.h:105
const std::string & translation() const
Definition: YTransText.h:83
YTransText(const std::string &orig)
Definition: YTransText.h:50
YTransText(const YTransText &src)
Definition: YTransText.h:58
void setTranslation(const std::string &newTrans)
Definition: YTransText.h:100
void setOrig(const std::string &newOrig)
Definition: YTransText.h:95
const std::string & orig() const
Definition: YTransText.h:78
YTransText & operator=(const YTransText &src)
Definition: YTransText.h:67
Definition: YTransText.h:36
bool operator==(const YTransText &other) const
Definition: YTransText.h:117