libzypp 17.31.7
ResFilters.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_RESFILTERS_H
13#define ZYPP_RESFILTERS_H
14
16#include <zypp/Filter.h>
17#include <zypp/Resolvable.h>
18
19#include <zypp/PoolItem.h>
20#include <zypp/Repository.h>
21
23namespace zypp
24{
26 namespace resfilter
27 {
28
138 //
139 // Some ResObject attributes
140 //
142
144 template<class TRes>
147
149 struct ByName
150 {
152 {}
153
154 ByName( const std::string & name_r )
155 : _name( name_r )
156 {}
157
159 {
160 return p->name() == _name;
161 }
162
163 std::string _name;
164 };
165
168 {
169 ByRepository( Repository repository_r )
170 : _alias( repository_r.info().alias() )
171 {}
172
173 ByRepository( const std::string & alias_r )
174 : _alias( alias_r )
175 {}
176
178 {
179 return p->repoInfo().alias() == _alias;
180 }
181
182 std::string _alias;
183 };
184
197 template<class TCompare = CompareByEQ<Edition> >
199 {
200 ByEdition( const Edition & edition_r, TCompare cmp_r )
201 : _edition( edition_r )
202 , _cmp( cmp_r )
203 {}
204
206 {
207 return _cmp( p->edition(), _edition );
208 }
209
211 TCompare _cmp;
212 };
213
215 template<class TCompare>
216 ByEdition<TCompare> byEdition( const Edition & edition_r, TCompare cmp_r )
217 { return ByEdition<TCompare>( edition_r, cmp_r ); }
218
220 template<class TCompare>
222 { return byEdition( edition_r, TCompare() ); }
223
224
237 template<class TCompare = CompareByEQ<Arch> >
238 struct ByArch
239 {
240 ByArch( const Arch & arch_r, TCompare cmp_r )
241 : _arch( arch_r )
242 , _cmp( cmp_r )
243 {}
244
246 {
247 return _cmp( p->arch(), _arch );
248 }
249
251 TCompare _cmp;
252 };
253
255 template<class TCompare>
256 ByArch<TCompare> byArch( const Arch & arch_r, TCompare cmp_r )
257 { return ByArch<TCompare>( arch_r, cmp_r ); }
258
260 template<class TCompare>
261 ByArch<TCompare> byArch( const Arch & arch_r )
262 { return byArch( arch_r, TCompare() ); }
263
264
266
268 //
269 // Some PoolItem attributes
270 //
272
275 {
276 bool operator()( const PoolItem & p ) const
277 {
278 return p.status().isInstalled();
279 }
280 };
281
284 {
285 bool operator()( const PoolItem & p ) const
286 {
287 return p.status().isUninstalled();
288 }
289 };
290
293 {
294 bool operator()( const PoolItem & p ) const
295 {
296 return p.status().transacts();
297 }
298 };
299
301 struct ByLock
302 {
303 bool operator()( const PoolItem & p ) const
304 {
305 return p.status().isLocked();
306 }
307 };
308
310 struct ByKeep
311 {
312 bool operator()( const PoolItem & p ) const
313 {
314 return p.status().isKept();
315 }
316 };
317
320 {
321 bool operator()( const PoolItem & p ) const
322 {
323 return p.status().isRecommended();
324 }
325 };
326
329 {
330 bool operator()( const PoolItem & p ) const
331 {
332 return p.status().isSuggested();
333 }
334 };
335
337
338 } // namespace resfilter
341} // namespace zypp
343#endif // ZYPP_RESFILTERS_H
Architecture.
Definition: Arch.h:37
Edition represents [epoch:]version[-release]
Definition: Edition.h:61
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
ResStatus & status() const
Returns the current status.
Definition: PoolItem.cc:211
TraitsType::constPtrType constPtr
Definition: ResObject.h:43
bool isSuggested() const
Definition: ResStatus.h:185
bool isLocked() const
Definition: ResStatus.h:264
bool isKept() const
Definition: ResStatus.h:273
bool transacts() const
Definition: ResStatus.h:276
bool isRecommended() const
Definition: ResStatus.h:182
bool isInstalled() const
Definition: ResStatus.h:240
bool isUninstalled() const
Definition: ResStatus.h:243
Filter solvables according to their kind.
Definition: Filter.h:106
ByEdition< TCompare > byEdition(const Edition &edition_r, TCompare cmp_r)
Definition: ResFilters.h:216
ByArch< TCompare > byArch(const Arch &arch_r, TCompare cmp_r)
Definition: ResFilters.h:256
filter::ByKind byKind()
Definition: ResFilters.h:145
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
ResTraits.
Definition: ResTraits.h:80
Select ResObject by Arch using TCompare functor.
Definition: ResFilters.h:239
ByArch(const Arch &arch_r, TCompare cmp_r)
Definition: ResFilters.h:240
bool operator()(ResObject::constPtr p) const
Definition: ResFilters.h:245
Select ResObject by Edition using TCompare functor.
Definition: ResFilters.h:199
ByEdition(const Edition &edition_r, TCompare cmp_r)
Definition: ResFilters.h:200
bool operator()(ResObject::constPtr p) const
Definition: ResFilters.h:205
Select PoolItem by installed.
Definition: ResFilters.h:275
bool operator()(const PoolItem &p) const
Definition: ResFilters.h:276
Select PoolItem by keep.
Definition: ResFilters.h:311
bool operator()(const PoolItem &p) const
Definition: ResFilters.h:312
Select PoolItem by lock.
Definition: ResFilters.h:302
bool operator()(const PoolItem &p) const
Definition: ResFilters.h:303
Select ResObject by name.
Definition: ResFilters.h:150
ByName(const std::string &name_r)
Definition: ResFilters.h:154
bool operator()(ResObject::constPtr p) const
Definition: ResFilters.h:158
PoolItem which is recommended.
Definition: ResFilters.h:320
bool operator()(const PoolItem &p) const
Definition: ResFilters.h:321
Select ResObject by repository or repository alias.
Definition: ResFilters.h:168
ByRepository(const std::string &alias_r)
Definition: ResFilters.h:173
ByRepository(Repository repository_r)
Definition: ResFilters.h:169
bool operator()(ResObject::constPtr p) const
Definition: ResFilters.h:177
PoolItem which is suggested.
Definition: ResFilters.h:329
bool operator()(const PoolItem &p) const
Definition: ResFilters.h:330
Select PoolItem by transact.
Definition: ResFilters.h:293
bool operator()(const PoolItem &p) const
Definition: ResFilters.h:294
Select PoolItem by uninstalled.
Definition: ResFilters.h:284
bool operator()(const PoolItem &p) const
Definition: ResFilters.h:285