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