ISOLanguage.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:       ISOLanguage.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose:
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 //      CLASS NAME : ISOLanguage
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 namespace std {
00083   template<>
00084     inline bool less<ISOLanguage>::operator()( const ISOLanguage & lhs,
00085                                                const ISOLanguage & rhs ) const
00086     {
00087       return( lhs.code() < rhs.code() );
00088     }
00089 }
00090 
00092 
00093 #endif // ISOLanguage_h

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