libzypp 17.37.10

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
15#include <zypp/base/Functional.h>
16#include <zypp/Filter.h>
17#include <zypp/Resolvable.h>
18
19#include <zypp/PoolItem.h>
20#include <zypp/Repository.h>
21
22#include <utility>
23
25 namespace zypp
26{
28 namespace resfilter
29 {
30
139
140 //
141 // Some ResObject attributes
142 //
144
146 template<class TRes>
147 inline filter::ByKind byKind()
148 { return filter::ByKind( ResTraits<TRes>::kind ); }
149
151 struct ByName
152 {
153 ByName()
154 {}
155
156 ByName( std::string name_r )
157 : _name(std::move( name_r ))
158 {}
159
160 bool operator()( const ResObject::constPtr& p ) const
161 {
162 return p->name() == _name;
163 }
164
165 std::string _name;
166 };
167
169 struct ByRepository
170 {
171 ByRepository( Repository repository_r )
172 : _alias( repository_r.info().alias() )
173 {}
174
175 ByRepository( std::string alias_r )
176 : _alias(std::move( alias_r ))
177 {}
178
179 bool operator()( const ResObject::constPtr& p ) const
180 {
181 return p->repoInfo().alias() == _alias;
182 }
183
184 std::string _alias;
185 };
186
199 template<class TCompare = CompareByEQ<Edition> >
200 struct ByEdition
201 {
202 ByEdition( Edition edition_r, TCompare cmp_r )
203 : _edition(std::move( edition_r ))
204 , _cmp( cmp_r )
205 {}
206
207 bool operator()( const ResObject::constPtr& p ) const
208 {
209 return _cmp( p->edition(), _edition );
210 }
211
212 Edition _edition;
213 TCompare _cmp;
214 };
215
217 template<class TCompare>
218 ByEdition<TCompare> byEdition( const Edition & edition_r, TCompare cmp_r )
219 { return ByEdition<TCompare>( edition_r, cmp_r ); }
220
222 template<class TCompare>
223 ByEdition<TCompare> byEdition( const Edition & edition_r )
224 { return byEdition( edition_r, TCompare() ); }
225
226
239 template<class TCompare = CompareByEQ<Arch> >
240 struct ByArch
241 {
242 ByArch( const Arch & arch_r, TCompare cmp_r )
243 : _arch( arch_r )
244 , _cmp( cmp_r )
245 {}
246
247 bool operator()( const ResObject::constPtr& p ) const
248 {
249 return _cmp( p->arch(), _arch );
250 }
251
252 Arch _arch;
253 TCompare _cmp;
254 };
255
257 template<class TCompare>
258 ByArch<TCompare> byArch( const Arch & arch_r, TCompare cmp_r )
259 { return ByArch<TCompare>( arch_r, cmp_r ); }
260
262 template<class TCompare>
263 ByArch<TCompare> byArch( const Arch & arch_r )
264 { return byArch( arch_r, TCompare() ); }
265
266
268
270 //
271 // Some PoolItem attributes
272 //
274
276 struct ByInstalled
277 {
278 bool operator()( const PoolItem & p ) const
279 {
280 return p.status().isInstalled();
281 }
282 };
283
285 struct ByUninstalled
286 {
287 bool operator()( const PoolItem & p ) const
288 {
289 return p.status().isUninstalled();
290 }
291 };
292
294 struct ByTransact
295 {
296 bool operator()( const PoolItem & p ) const
297 {
298 return p.status().transacts();
299 }
300 };
301
303 struct ByLock
304 {
305 bool operator()( const PoolItem & p ) const
306 {
307 return p.status().isLocked();
308 }
309 };
310
312 struct ByKeep
313 {
314 bool operator()( const PoolItem & p ) const
315 {
316 return p.status().isKept();
317 }
318 };
319
321 struct ByRecommended
322 {
323 bool operator()( const PoolItem & p ) const
324 {
325 return p.status().isRecommended();
326 }
327 };
328
330 struct BySuggested
331 {
332 bool operator()( const PoolItem & p ) const
333 {
334 return p.status().isSuggested();
335 }
336 };
337
339
340 } // namespace resfilter
341
343} // namespace zypp
345#endif // ZYPP_RESFILTERS_H
Filter.h
Functional.h
PoolItem.h
Repository.h
Resolvable.h
zypp::Arch
Architecture.
Definition Arch.h:37
zypp::Edition
Edition represents [epoch:]version[-release]
Definition Edition.h:61
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::PoolItem::status
ResStatus & status() const
Returns the current status.
Definition PoolItem.cc:212
zypp::Repository
Definition Repository.h:40
zypp::ResObject::constPtr
TraitsType::constPtrType constPtr
Definition ResObject.h:43
zypp::ResStatus::isSuggested
bool isSuggested() const
Definition ResStatus.h:191
zypp::ResStatus::isLocked
bool isLocked() const
Definition ResStatus.h:270
zypp::ResStatus::isKept
bool isKept() const
Definition ResStatus.h:279
zypp::ResStatus::transacts
bool transacts() const
Definition ResStatus.h:282
zypp::ResStatus::isRecommended
bool isRecommended() const
Definition ResStatus.h:188
zypp::ResStatus::isInstalled
bool isInstalled() const
Definition ResStatus.h:246
zypp::ResStatus::isUninstalled
bool isUninstalled() const
Definition ResStatus.h:249
zypp::filter::ByKind
Filter solvables according to their kind.
Definition Filter.h:107
std
Definition Arch.h:364
zypp::resfilter
Definition ResFilters.h:29
zypp::resfilter::byEdition
ByEdition< TCompare > byEdition(const Edition &edition_r, TCompare cmp_r)
Definition ResFilters.h:218
zypp::resfilter::byArch
ByArch< TCompare > byArch(const Arch &arch_r, TCompare cmp_r)
Definition ResFilters.h:258
zypp::resfilter::byKind
filter::ByKind byKind()
Definition ResFilters.h:147
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::ResTraits
ResTraits.
Definition ResTraits.h:80
zypp::resfilter::ByArch
Select ResObject by Arch using TCompare functor.
Definition ResFilters.h:241
zypp::resfilter::ByArch::_arch
Arch _arch
Definition ResFilters.h:252
zypp::resfilter::ByArch::ByArch
ByArch(const Arch &arch_r, TCompare cmp_r)
Definition ResFilters.h:242
zypp::resfilter::ByArch::operator()
bool operator()(const ResObject::constPtr &p) const
Definition ResFilters.h:247
zypp::resfilter::ByArch::_cmp
TCompare _cmp
Definition ResFilters.h:253
zypp::resfilter::ByEdition
Select ResObject by Edition using TCompare functor.
Definition ResFilters.h:201
zypp::resfilter::ByEdition::_edition
Edition _edition
Definition ResFilters.h:212
zypp::resfilter::ByEdition::operator()
bool operator()(const ResObject::constPtr &p) const
Definition ResFilters.h:207
zypp::resfilter::ByEdition::ByEdition
ByEdition(Edition edition_r, TCompare cmp_r)
Definition ResFilters.h:202
zypp::resfilter::ByEdition::_cmp
TCompare _cmp
Definition ResFilters.h:213
zypp::resfilter::ByInstalled
Select PoolItem by installed.
Definition ResFilters.h:277
zypp::resfilter::ByInstalled::operator()
bool operator()(const PoolItem &p) const
Definition ResFilters.h:278
zypp::resfilter::ByKeep
Select PoolItem by keep.
Definition ResFilters.h:313
zypp::resfilter::ByKeep::operator()
bool operator()(const PoolItem &p) const
Definition ResFilters.h:314
zypp::resfilter::ByLock
Select PoolItem by lock.
Definition ResFilters.h:304
zypp::resfilter::ByLock::operator()
bool operator()(const PoolItem &p) const
Definition ResFilters.h:305
zypp::resfilter::ByName::ByName
ByName()
Definition ResFilters.h:153
zypp::resfilter::ByName::ByName
ByName(std::string name_r)
Definition ResFilters.h:156
zypp::resfilter::ByName::operator()
bool operator()(const ResObject::constPtr &p) const
Definition ResFilters.h:160
zypp::resfilter::ByName::_name
std::string _name
Definition ResFilters.h:165
zypp::resfilter::ByRecommended
PoolItem which is recommended.
Definition ResFilters.h:322
zypp::resfilter::ByRecommended::operator()
bool operator()(const PoolItem &p) const
Definition ResFilters.h:323
zypp::resfilter::ByRepository::ByRepository
ByRepository(Repository repository_r)
Definition ResFilters.h:171
zypp::resfilter::ByRepository::operator()
bool operator()(const ResObject::constPtr &p) const
Definition ResFilters.h:179
zypp::resfilter::ByRepository::_alias
std::string _alias
Definition ResFilters.h:184
zypp::resfilter::ByRepository::ByRepository
ByRepository(std::string alias_r)
Definition ResFilters.h:175
zypp::resfilter::BySuggested
PoolItem which is suggested.
Definition ResFilters.h:331
zypp::resfilter::BySuggested::operator()
bool operator()(const PoolItem &p) const
Definition ResFilters.h:332
zypp::resfilter::ByTransact
Select PoolItem by transact.
Definition ResFilters.h:295
zypp::resfilter::ByTransact::operator()
bool operator()(const PoolItem &p) const
Definition ResFilters.h:296
zypp::resfilter::ByUninstalled
Select PoolItem by uninstalled.
Definition ResFilters.h:286
zypp::resfilter::ByUninstalled::operator()
bool operator()(const PoolItem &p) const
Definition ResFilters.h:287