Hamcrest-Qt  0.0.1
Hamcrest matchers for C++/Qt
 All Classes Namespaces Functions
diagnosingmatcher.h
1 #ifndef HAMCRESTQT_DIAGNOSINGMATCHER_H
2 #define HAMCRESTQT_DIAGNOSINGMATCHER_H
3 
4 #include "basematcher.h"
5 
6 namespace HamcrestQt {
7 
8 template <typename T>
9 class DiagnosingMatcher : public BaseMatcher<T>
10 {
11 public:
12  virtual bool matches(const T &item) const
13  {
14  return matches(item, Description::NONE());
15  }
16 
17  virtual void describeMismatch(const T &item, Description &mismatchDescription) const
18  {
19  matches(item, mismatchDescription);
20  }
21 
22 protected:
23  virtual bool matches(const T &item, Description &mismatchDescription) const = 0;
24 };
25 
26 } // namespace HamcrestQt
27 
28 #endif // HAMCRESTQT_DIAGNOSINGMATCHER_H
virtual bool matches(const T &item) const
Evaluates the matcher for argument item.
Definition: diagnosingmatcher.h:12
virtual void describeMismatch(const T &item, Description &mismatchDescription) const
Generate a description of why the matcher has not accepted the item.
Definition: diagnosingmatcher.h:17
A description of a Matcher.
Definition: description.h:17
Definition: diagnosingmatcher.h:9
BaseClass for all Matcher implementations.
Definition: basematcher.h:17