Hamcrest-Qt  0.0.1
Hamcrest matchers for C++/Qt
 All Classes Namespaces Functions
matcher.h
1 #ifndef HAMCRESTQT_MATCHER_H
2 #define HAMCRESTQT_MATCHER_H
3 
4 #include "selfdescribing.h"
5 
10 namespace HamcrestQt {
11 
12 class Description;
13 
20 template <typename T>
21 class Matcher : public SelfDescribing
22 {
23 public:
24  virtual ~Matcher() {}
25 
34  virtual bool matches(const T &item) const = 0;
35 
47  virtual void describeMismatch(const T &item, Description &mismatchDescription) const = 0;
48 
49  virtual QString toString() const = 0;
50 };
51 
52 } // namespace HamcrestQt
53 
54 #endif // HAMCRESTQT_MATCHER_H
A description of a Matcher.
Definition: description.h:17
A matcher over acceptable values.
Definition: matcher.h:21
virtual bool matches(const T &item) const =0
Evaluates the matcher for argument item.
virtual void describeMismatch(const T &item, Description &mismatchDescription) const =0
Generate a description of why the matcher has not accepted the item.
The ability of an object to describe itself.
Definition: selfdescribing.h:11