25 #ifndef WPREDICATEHELPER_H
26 #define WPREDICATEHELPER_H
30 #include <boost/shared_ptr.hpp>
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< boost::shared_ptr< T > >
116 explicit Name( std::string check ):
130 return inst->getName() ==
m_check;
149 template <
typename T >
174 virtual bool operator()( T
const& inst )
const = 0;
184 template <
typename T,
typename Predicate = boost::function1<
bool, T > >
226 #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...