25 #ifndef WPREDICATEHELPER_H
26 #define WPREDICATEHELPER_H
31 #include <boost/shared_ptr.hpp>
34 #include <boost/function.hpp>
50 template<
typename T >
63 template<
typename T >
73 template<
typename T >
82 explicit Name( std::string check ):
96 return inst.getName() ==
m_check;
111 template<
typename T >
112 class Name< boost::shared_ptr< T > >
120 explicit Name( std::string check ):
134 return inst->getName() ==
m_check;
153 template <
typename T >
178 virtual bool operator()( T
const& inst )
const = 0;
188 template <
typename T,
typename Predicate = boost::function1<
bool, T > >
230 #endif // WPREDICATEHELPER_H
ArbitraryPredicate(Predicate predicate)
Creates instance.
This namespace contains some useful helper classes which use some common class methods as predicate...
Name(std::string check)
Creates instance.
bool alwaysFalse(const T &)
Predicate which is always false.
virtual ~ArbitraryPredicate()
Destructor.
virtual bool operator()(T const &inst) const
Checks the instance of T against an arbitrary predicate.
bool operator()(const boost::shared_ptr< T > &inst)
Checks the instance of T against the string specified during construction.
bool operator()(const T &inst)
Checks the instance of T against the string specified during construction.
ArbitraryPredicateBase()
Creates instance.
bool alwaysTrue(const T &)
Predicate which is always true.
Predicate m_predicate
The predicate to use for checking.
The actual class implementing the predicate evaluation.
virtual ~ArbitraryPredicateBase()
Destructor.
virtual bool operator()(T const &inst) const =0
Checks the instance of T against an arbitrary predicate.
Name(std::string check)
Creates instance.
std::string m_check
The string to check against.
This class tests against the getName() method of the instances of type T.
This class builds the base for wrapping around nearly every possible predicates like functors...