1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ui/SelFilters.h
12 #ifndef ZYPP_UI_SELFILTERS_H
13 #define ZYPP_UI_SELFILTERS_H
17 #include "zypp/base/Functional.h"
18 #include "zypp/ui/Selectable.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
30 typedef std::unary_function<Selectable::constPtr,bool> SelectableFilterFunctor;
33 struct ByKind : public SelectableFilterFunctor
35 ByKind( const ResObject::Kind & kind_r )
39 bool operator()( const Selectable::constPtr & obj ) const
41 return obj && obj->kind() == _kind;
44 ResObject::Kind _kind;
48 struct ByName : public SelectableFilterFunctor
50 ByName( const std::string & name_r )
54 bool operator()( const ui::Selectable::constPtr & obj ) const
55 { return obj && obj->name() == _name; }
61 struct ByHasInstalledObj : public SelectableFilterFunctor
63 bool operator()( const ui::Selectable::constPtr & obj ) const
64 { return obj && !obj->installedEmpty(); }
68 struct ByHasCandidateObj : public SelectableFilterFunctor
70 bool operator()( const ui::Selectable::constPtr & obj ) const
71 { return obj && obj->hasCandidateObj(); }
74 struct ByStatus : public SelectableFilterFunctor
77 ByStatus( Status status_r )
81 bool operator()( const ui::Selectable::constPtr & obj ) const
82 { return obj && obj->status() == _status; }
87 /////////////////////////////////////////////////////////////////
88 } // namespace selfilter
89 ///////////////////////////////////////////////////////////////////
90 /////////////////////////////////////////////////////////////////
92 ///////////////////////////////////////////////////////////////////
93 /////////////////////////////////////////////////////////////////
95 ///////////////////////////////////////////////////////////////////
96 #endif // ZYPP_UI_SELFILTERS_H