00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_RESPOOL_H 00013 #define ZYPP_RESPOOL_H 00014 00015 #include <iosfwd> 00016 00017 #include "zypp/pool/PoolTraits.h" 00018 #include "zypp/base/Iterator.h" 00019 #include "zypp/ResFilters.h" 00020 00022 namespace zypp 00023 { 00024 00026 // 00027 // CLASS NAME : ResPool 00028 // 00037 class ResPool 00038 { 00039 friend std::ostream & operator<<( std::ostream & str, const ResPool & obj ); 00040 00041 public: 00043 typedef pool::PoolTraits::Item Item; 00044 typedef pool::PoolTraits::size_type size_type; 00045 typedef pool::PoolTraits::const_iterator const_iterator; 00046 typedef pool::PoolTraits::byName_iterator byName_iterator; 00047 typedef pool::PoolTraits::byCapabilityIndex_iterator byCapabilityIndex_iterator; 00048 00049 public: 00051 ResPool(); 00053 ~ResPool(); 00054 00055 public: 00057 bool empty() const; 00059 size_type size() const; 00060 00061 public: 00062 00066 const_iterator begin() const; 00068 const_iterator end() const; 00070 00071 public: 00074 typedef resfilter::ByKind ByKind; 00075 typedef filter_iterator<ByKind,const_iterator> byKind_iterator; 00076 00077 byKind_iterator byKindBegin( const ResObject::Kind & kind_r ) const 00078 { return make_filter_begin( ByKind(kind_r), *this ); } 00079 00080 template<class _Res> 00081 byKind_iterator byKindBegin() const 00082 { return make_filter_begin( resfilter::byKind<_Res>(), *this ); } 00083 00084 00085 byKind_iterator byKindEnd( const ResObject::Kind & kind_r ) const 00086 { return make_filter_end( ByKind(kind_r), *this ); } 00087 00088 template<class _Res> 00089 byKind_iterator byKindEnd() const 00090 { return make_filter_end( resfilter::byKind<_Res>(), *this ); } 00092 00093 public: 00096 byName_iterator byNameBegin( const std::string & name_r ) const; 00097 00098 byName_iterator byNameEnd( const std::string & name_r ) const; 00100 00101 public: 00106 byCapabilityIndex_iterator byCapabilityIndexBegin( const std::string & index_r, Dep depType_r ) const; 00107 00108 byCapabilityIndex_iterator byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const; 00110 00111 private: 00113 friend class ResPoolManager; 00115 ResPool( pool::PoolTraits::Impl_constPtr impl_r ); 00116 private: 00118 pool::PoolTraits::Impl_constPtr _pimpl; 00119 }; 00121 00123 typedef ResPool ResPool_Ref; 00124 00126 00128 std::ostream & operator<<( std::ostream & str, const ResPool & obj ); 00129 00131 } // namespace zypp 00133 #endif // ZYPP_RESPOOL_H