00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ISOLanguage_h
00022 #define ISOLanguage_h
00023
00024 #include <iosfwd>
00025 #include <string>
00026
00027 #include <y2util/Rep.h>
00028
00030
00031
00035 class ISOLanguage {
00036
00037 private:
00038
00039 struct _D;
00040 VarPtr<_D> _d;
00041
00042 public:
00043
00044 ISOLanguage();
00045 explicit ISOLanguage( const std::string & code_r );
00046 ~ISOLanguage();
00047
00048 bool isSet() const;
00049
00050 std::string code() const;
00051 std::string name() const;
00052 };
00053
00055
00056 std::ostream & operator<<( std::ostream & str, const ISOLanguage & obj );
00057
00059
00060 inline bool operator==( const ISOLanguage & lhs, const ISOLanguage & rhs ) {
00061 return( lhs.code() == rhs.code() );
00062 }
00063 inline bool operator==( const std::string & lhs, const ISOLanguage & rhs ) {
00064 return( lhs == rhs.code() );
00065 }
00066 inline bool operator==( const ISOLanguage & lhs, const std::string & rhs ) {
00067 return( lhs.code() == rhs );
00068 }
00069
00070 inline bool operator!=( const ISOLanguage & lhs, const ISOLanguage & rhs ) {
00071 return( ! operator==( lhs, rhs ) );
00072 }
00073 inline bool operator!=( const std::string & lhs, const ISOLanguage & rhs ) {
00074 return( ! operator==( lhs, rhs ) );
00075 }
00076 inline bool operator!=( const ISOLanguage & lhs, const std::string & rhs ) {
00077 return( ! operator==( lhs, rhs ) );
00078 }
00079
00081
00082 template<>
00083 inline bool std::less<ISOLanguage>::operator()( const ISOLanguage & lhs,
00084 const ISOLanguage & rhs ) const
00085 {
00086 return( lhs.code() < rhs.code() );
00087 }
00088
00090
00091 #endif // ISOLanguage_h