25 #ifndef WPREDICATEHELPER_H
26 #define WPREDICATEHELPER_H
31 #include <boost/function.hpp>
46 template<
typename T >
59 template<
typename T >
69 template<
typename T >
78 explicit Name( std::string check ):
92 return inst.getName() ==
m_check;
107 template<
typename T >
108 class Name< std::shared_ptr< T > >
116 explicit Name( std::string check ):
130 return inst->getName() ==
m_check;
149 template <
typename T >
184 template <
typename T,
typename Predicate = boost::function1<
bool, T > >
This class builds the base for wrapping around nearly every possible predicates like functors,...
virtual bool operator()(T const &inst) const =0
Checks the instance of T against an arbitrary predicate.
virtual ~ArbitraryPredicateBase()
Destructor.
ArbitraryPredicateBase()
Creates instance.
The actual class implementing the predicate evaluation.
ArbitraryPredicate(Predicate predicate)
Creates instance.
virtual ~ArbitraryPredicate()
Destructor.
Predicate m_predicate
The predicate to use for checking.
virtual bool operator()(T const &inst) const
Checks the instance of T against an arbitrary predicate.
std::string m_check
The string to check against.
bool operator()(const std::shared_ptr< T > &inst)
Checks the instance of T against the string specified during construction.
Name(std::string check)
Creates instance.
This class tests against the getName() method of the instances of type T.
bool operator()(const T &inst)
Checks the instance of T against the string specified during construction.
std::string m_check
The string to check against.
Name(std::string check)
Creates instance.
This namespace contains some useful helper classes which use some common class methods as predicate.
bool alwaysTrue(const T &)
Predicate which is always true.
bool alwaysFalse(const T &)
Predicate which is always false.