libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_SAT_LOCALESUPPORT_H 00013 #define ZYPP_SAT_LOCALESUPPORT_H 00014 00015 #include <iosfwd> 00016 00017 #include "zypp/sat/detail/PoolMember.h" 00018 #include "zypp/sat/SolvIterMixin.h" 00019 #include "zypp/Locale.h" 00020 #include "zypp/Filter.h" 00021 00023 namespace zypp 00024 { 00025 00026 namespace sat 00027 { 00028 00030 // 00031 // CLASS NAME : LocaleSupport 00032 // 00059 class LocaleSupport : public SolvIterMixin<LocaleSupport,filter_iterator<filter::ByLocaleSupport,Pool::SolvableIterator> > 00060 , protected detail::PoolMember 00061 { 00062 public: 00064 LocaleSupport() 00065 {} 00067 LocaleSupport( const Locale & locale_r ) 00068 : _locale( locale_r ) 00069 {} 00070 00071 public: 00073 const Locale & locale() const 00074 { return _locale; } 00075 00077 bool isAvailable() const 00078 { return Pool(*this).isAvailableLocale( _locale ); } 00079 00081 bool isRequested() const 00082 { return Pool(*this).isRequestedLocale( _locale ); } 00083 00085 void setRequested( bool yesno_r ) 00086 { yesno_r ? Pool(*this).addRequestedLocale( _locale ) : Pool(*this).eraseRequestedLocale( _locale ); } 00087 00088 public: 00091 typedef Solvable_iterator iterator; // from SolvIterMixin 00092 00093 iterator begin() const 00094 { return Pool(*this).filterBegin( filter::ByLocaleSupport( _locale ) ); } 00095 00096 iterator end() const 00097 { return Pool(*this).filterEnd( filter::ByLocaleSupport( _locale ) ); } 00099 00100 private: 00101 Locale _locale; 00102 }; 00104 00106 std::ostream & operator<<( std::ostream & str, const LocaleSupport & obj ); 00107 00109 std::ostream & dumpOn( std::ostream & str, const LocaleSupport & obj ); 00110 00112 inline bool operator==( const LocaleSupport & lhs, const LocaleSupport & rhs ) 00113 { return lhs.locale() == rhs.locale(); } 00114 00116 inline bool operator!=( const LocaleSupport & lhs, const LocaleSupport & rhs ) 00117 { return lhs.locale() != rhs.locale(); } 00118 00120 inline bool operator<( const LocaleSupport & lhs, const LocaleSupport & rhs ) 00121 { return lhs.locale() < rhs.locale(); } 00122 00124 } // namespace sat 00127 } // namespace zypp 00129 #endif // ZYPP_SAT_LOCALESUPPORT_H