1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/CapFilters.h
12 #ifndef ZYPP_CAPFILTERS_H
13 #define ZYPP_CAPFILTERS_H
15 #include "zypp/base/Functional.h"
16 #include "zypp/Capability.h"
18 ///////////////////////////////////////////////////////////////////
20 { /////////////////////////////////////////////////////////////////
21 ///////////////////////////////////////////////////////////////////
23 { /////////////////////////////////////////////////////////////////
25 /** \defgroup CAPFILTERS Filter functors operating on Capability.
31 typedef std::unary_function<Capability, bool> CapabilityFilterFunctor;
34 struct ByRefers : public CapabilityFilterFunctor
36 bool operator()( const Capability & c ) const
38 return c.refers() == _refers;
41 ByRefers( Resolvable::Kind refers_r )
44 ByRefers( ResObject::constPtr p )
45 : _refers( p->kind() )
47 ByRefers( const Capability & cap_r )
48 : _refers( cap_r.refers() )
50 Resolvable::Kind _refers;
54 struct ByIndex : public CapabilityFilterFunctor
56 bool operator()( const Capability & c ) const
58 return c.index() == _index;
61 ByIndex( const std::string & index_r )
64 ByIndex( const Capability & cap_r )
65 : _index( cap_r.index() )
71 struct ByCapMatch : public CapabilityFilterFunctor
73 bool operator()( const Capability & c ) const
75 return _lhs.matches( c ) == _expect;
78 ByCapMatch( const Capability & cap_r, CapMatch expect_r = CapMatch::yes )
87 /////////////////////////////////////////////////////////////////
88 } // namespace capfilter
89 ///////////////////////////////////////////////////////////////////^
90 /////////////////////////////////////////////////////////////////
92 ///////////////////////////////////////////////////////////////////
93 #endif // ZYPP_CAPFILTERS_H