12 #ifndef ZYPP_BASE_FUNCTIONAL_H
13 #define ZYPP_BASE_FUNCTIONAL_H
15 #include <boost/functional.hpp>
30 using boost::mem_fun_ref;
77 namespace functor_detail
80 template <
class TFunctor,
class res_type>
96 template <
class TFunctor,
class res_type,
class arg1_type>
97 struct FunctorRef1 :
public std::unary_function<arg1_type, res_type>
112 template <
class TFunctor,
class res_type,
class arg1_type,
class arg2_type>
113 struct FunctorRef2 :
public std::binary_function<arg1_type, arg2_type, res_type>
142 : functor_detail::
FunctorRef2<TFunctor, res_type, arg1_type, arg2_type>( f_r )
149 template <
class TFunctor,
class res_type,
class arg1_type>
154 : functor_detail::FunctorRef1<TFunctor, res_type, arg1_type>( f_r )
161 template <
class TFunctor,
class res_type>
166 : functor_detail::FunctorRef0<TFunctor, res_type>( f_r )
171 template <
class res_type,
class arg1_type,
class arg2_type,
class TFunctor>
172 FunctorRef<TFunctor, res_type, arg1_type, arg2_type>
175 template <
class res_type,
class arg1_type,
class TFunctor>
176 FunctorRef<TFunctor, res_type, arg1_type>
179 template <
class res_type,
class TFunctor>
180 FunctorRef<TFunctor, res_type>
218 template<
class TConst>
235 template<
class TConst>
270 template<
class TCondition>
287 template<
class TCondition>
295 template<
class TACondition,
class TBCondition>
298 Or( TACondition conda_r, TBCondition condb_r )
316 template<
class TACondition,
class TBCondition>
324 template<
class TACondition,
class TBCondition>
327 Chain( TACondition conda_r, TBCondition condb_r )
345 template<
class TACondition,
class TBCondition>
374 { *
_result = val_r;
return false; }
395 { *
_result = val_r;
return true; }
414 template<
class TOutputIterator>
423 { *(
_result++) = val_r;
return true; }
430 template<
class TOutputIterator>
443 #endif // ZYPP_BASE_FUNCTIONAL_H
bool operator()(Tp) const
FunctorRef1(TFunctor &f_r)
bool operator()(const Tp &val_r)
Or< TACondition, TBCondition > or_c(TACondition conda_r, TBCondition condb_r)
Convenience function for creating a Or from two conditions conda_r OR condb_r.
res_type operator()(arg1_type a1, arg2_type a2) const
Logical functor chaining TACondition OR TBCondition.
GetLast< Tp > getLast(Tp &result_r)
Convenience function for creating GetLast.
Store all results found to some output_iterator.
FunctorRef(TFunctor &f_r)
TConst operator()() const
GetFirst< Tp > getFirst(Tp &result_r)
Convenience function for creating GetFirst.
bool operator()(Tp t) const
TConst operator()(Tp) const
False false_c()
Convenience function for creating a False.
bool operator()(Tp t) const
Or(TACondition conda_r, TBCondition condb_r)
FunctorRef(TFunctor &f_r)
Constant< TConst > constant(const TConst &value)
Logical functor always false.
res_type operator()(arg1_type a1) const
GetAll(TOutputIterator result_r)
True true_c()
Convenience function for creating a True.
Strore the 1st result found in the variable passed to the ctor.
Constant(const TConst &value)
Logical functor chaining TACondition AND TBCondition.
FunctorRef(TFunctor &f_r)
Strore the last result found in the variable passed to the ctor.
Not< TCondition > not_c(TCondition cond_r)
Convenience function for creating a Not from TCondition.
Chain< TACondition, TBCondition > chain(TACondition conda_r, TBCondition condb_r)
Convenience function for creating a Chain from two conditions conda_r and condb_r.
bool operator()(Tp) const
FunctorRef2(TFunctor &f_r)
bool operator()(Tp t) const
FunctorRef< TFunctor, res_type, arg1_type, arg2_type > functorRef(TFunctor &f_r)
Convenience function creating a binary FunctorRef.
Chain(TACondition conda_r, TBCondition condb_r)
bool operator()(const Tp &val_r)
Logical functor inverting TCondition.
Logical functor always true.
FunctorRef0(TFunctor &f_r)
bool operator()(const Tp &val_r) const
res_type operator()() const
GetAll< TOutputIterator > getAll(TOutputIterator result_r)
Convenience function for creating GetAll.