libzypp  13.10.6
ResPoolProxy.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_RESPOOLPROXY_H
13 #define ZYPP_RESPOOLPROXY_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/base/PtrTypes.h"
18 
19 #include "zypp/ResPool.h"
20 #include "zypp/ui/Selectable.h"
21 #include "zypp/ui/SelFilters.h"
22 
24 namespace zypp
25 {
26 
28  //
29  // CLASS NAME : ResPoolProxy
30  //
35  {
36  friend std::ostream & operator<<( std::ostream & str, const ResPoolProxy & obj );
37  friend std::ostream & dumpOn( std::ostream & str, const ResPoolProxy & obj );
38  typedef std::multimap<ResKind,ui::Selectable::Ptr> SelectablePool;
39 
40  public:
42  class Impl;
43 
46 
48 
49  public:
50 
58  ResPoolProxy();
59 
61  ~ResPoolProxy();
62 
63  public:
66  ui::Selectable::Ptr lookup( const pool::ByIdent & ident_r ) const;
67 
69  { return lookup( pool::ByIdent( ident_r ) ); }
70 
71  ui::Selectable::Ptr lookup( ResKind kind_r, const std::string & name_r ) const
72  { return lookup( pool::ByIdent( kind_r, name_r ) ); }
73 
74  ui::Selectable::Ptr lookup( const sat::Solvable & solv_r ) const
75  { return lookup( pool::ByIdent( solv_r ) ); }
76 
77  ui::Selectable::Ptr lookup( const ResObject::constPtr & resolvable_r ) const
78  { return resolvable_r ? lookup( resolvable_r->satSolvable() ) : ui::Selectable::Ptr(); }
79 
80  ui::Selectable::Ptr lookup( const PoolItem & pi_r ) const
81  { return lookup( pi_r.satSolvable() ); }
83 
84  public:
87  bool empty() const;
88  size_type size() const;
89  const_iterator begin() const;
90  const_iterator end() const;
92 
96  bool empty( const ResKind & kind_r ) const;
97 
98  template<class _Res>
99  bool empty() const
100  { return empty( ResTraits<_Res>::kind ); }
101 
103  size_type size( const ResKind & kind_r ) const;
104 
105  template<class _Res>
106  size_type size() const
107  { return size( ResTraits<_Res>::kind ); }
108 
109  const_iterator byKindBegin( const ResKind & kind_r ) const;
110 
111  template<class _Res>
113  { return byKindBegin( ResTraits<_Res>::kind ); }
114 
115 
116  const_iterator byKindEnd( const ResKind & kind_r ) const;
117 
118  template<class _Res>
120  { return byKindEnd( ResTraits<_Res>::kind ); }
122 
123  public:
128 
130 
133 
134  public:
138  bool hasInstalledObj( const ResKind & kind_r ) const
139  {
140  return( make_begin<ui::selfilter::ByHasInstalledObj>( kind_r )
141  != make_end<ui::selfilter::ByHasInstalledObj>( kind_r ) );
142  }
143 
144  template<class _Res>
145  bool hasInstalledObj() const
147 
148  public:
157  void saveState() const;
158 
159  void saveState( const ResKind & kind_r ) const;
160 
161  template<class _Res>
162  void saveState() const
163  { return saveState( ResTraits<_Res>::kind ); }
164 
165  void restoreState() const;
166 
167  void restoreState( const ResKind & kind_r ) const;
168 
169  template<class _Res>
170  void restoreState() const
171  { return restoreState( ResTraits<_Res>::kind ); }
172 
173  bool diffState() const;
174 
175  bool diffState( const ResKind & kind_r ) const;
176 
177  template<class _Res>
178  bool diffState() const
179  { return diffState( ResTraits<_Res>::kind ); }
181 
182  private:
183  template<class _Filter>
184  filter_iterator<_Filter,const_iterator>
185  make_begin( _Filter filter_r, const ResKind & kind_r ) const
186  {
187  return make_filter_iterator( filter_r,
188  byKindBegin(kind_r),
189  byKindEnd(kind_r) );
190  }
191  template<class _Filter>
192  filter_iterator<_Filter,const_iterator>
193  make_begin( const ResKind & kind_r ) const
194  {
195  return make_begin( _Filter(), kind_r );
196  }
197 
198 
199  template<class _Filter>
200  filter_iterator<_Filter,const_iterator>
201  make_end( _Filter filter_r, const ResKind & kind_r ) const
202  {
203  return make_filter_iterator( filter_r,
204  byKindEnd(kind_r),
205  byKindEnd(kind_r) );
206  }
207  template<class _Filter>
208  filter_iterator<_Filter,const_iterator>
209  make_end( const ResKind & kind_r ) const
210  {
211  return make_end( _Filter(), kind_r );
212  }
213 
214  private:
215  friend class pool::PoolImpl;
217  ResPoolProxy( ResPool pool_r, const pool::PoolImpl & poolImpl_r );
220  };
222 
224  std::ostream & operator<<( std::ostream & str, const ResPoolProxy & obj );
225 
227  std::ostream & dumpOn( std::ostream & str, const ResPoolProxy & obj );
228 
230 } // namespace zypp
232 #endif // ZYPP_RESPOOLPROXY_H
void restoreState() const
Definition: ResPoolProxy.h:170
size_type size() const
ui::Selectable::Ptr lookup(const pool::ByIdent &ident_r) const
A Solvable object within the sat Pool.
Definition: Solvable.h:55
size_type size() const
Definition: ResPoolProxy.h:106
ui::Selectable::Ptr lookup(IdString ident_r) const
Definition: ResPoolProxy.h:68
void restoreState() const
intrusive_ptr< Selectable > Ptr
Definition: Selectable.h:57
size_type knownRepositoriesSize() const
filter_iterator< _Filter, const_iterator > make_begin(const ResKind &kind_r) const
Definition: ResPoolProxy.h:193
ui::Selectable::Ptr lookup(const PoolItem &pi_r) const
Definition: ResPoolProxy.h:80
Access to the sat-pools string space.
Definition: IdString.h:39
ResTraits.
Definition: ResTraits.h:77
TraitsType::constPtrType constPtr
Definition: ResObject.h:50
bool empty() const
ResPool::instance().proxy();.
Definition: ResPoolProxy.h:34
const_iterator end() const
ResPoolProxy implementation.
Definition: ResPoolProxy.cc:91
bool diffState() const
Definition: ResPoolProxy.h:178
transform_iterator< GetPairSecond< typename MapType::value_type >, typename MapType::const_iterator > Value_const_iterator
The value iterator type.
Definition: Iterator.h:221
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
friend std::ostream & operator<<(std::ostream &str, const ResPoolProxy &obj)
repository_iterator knownRepositoriesEnd() const
ResPool::repository_iterator repository_iterator
Definition: ResPoolProxy.h:47
bool hasInstalledObj(const ResKind &kind_r) const
Test whether there is at least one ui::Selectable with an installed object.
Definition: ResPoolProxy.h:138
bool diffState() const
RW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: ResPoolProxy.h:219
void saveState() const
Definition: ResPoolProxy.h:162
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition: Capability.cc:435
friend std::ostream & dumpOn(std::ostream &str, const ResPoolProxy &obj)
const_iterator byKindEnd() const
Definition: ResPoolProxy.h:119
SolvableIdType size_type
Definition: PoolMember.h:99
bool empty() const
Definition: ResPoolProxy.h:99
repository_iterator knownRepositoriesBegin() const
Global ResObject pool.
Definition: ResPool.h:48
SelectablePool::size_type size_type
Definition: ResPoolProxy.h:45
std::multimap< ResKind, ui::Selectable::Ptr > SelectablePool
Definition: ResPoolProxy.h:38
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:265
filter_iterator< _Filter, const_iterator > make_end(const ResKind &kind_r) const
Definition: ResPoolProxy.h:209
ui::Selectable::Ptr lookup(const sat::Solvable &solv_r) const
Definition: ResPoolProxy.h:74
sat::Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: PoolItem.h:114
filter_iterator< _Filter, const_iterator > make_end(_Filter filter_r, const ResKind &kind_r) const
Definition: ResPoolProxy.h:201
filter_iterator< _Filter, const_iterator > make_begin(_Filter filter_r, const ResKind &kind_r) const
Definition: ResPoolProxy.h:185
ResPoolProxy()
Default ctor: no pool Nonempty proxies are provided by ResPool.
bool hasInstalledObj() const
Definition: ResPoolProxy.h:145
Reference to a PoolItem connecting ResObject and ResStatus.
Definition: PoolItem.h:50
void saveState() const
const_iterator byKindBegin() const
Definition: ResPoolProxy.h:112
const_iterator begin() const
MapKVIteratorTraits< SelectablePool >::Value_const_iterator const_iterator
Definition: ResPoolProxy.h:42
ui::Selectable::Ptr lookup(ResKind kind_r, const std::string &name_r) const
Definition: ResPoolProxy.h:71
Resolvable kinds.
Definition: ResKind.h:35
Main filter selecting PoolItems by name and kind.
Definition: ByIdent.h:26
ui::Selectable::Ptr lookup(const ResObject::constPtr &resolvable_r) const
Definition: ResPoolProxy.h:77