ISOCountry.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                    (C) SuSE Linux AG |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       ISOCountry.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose:
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 //      CLASS NAME : ISOCountry
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

Generated on Fri Jun 16 15:51:35 2006 for liby2util by  doxygen 1.4.6