1 |
Douglas Thrift |
113 |
// Bender |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _Matcher_hpp_ |
8 |
|
|
#define _Matcher_hpp_ |
9 |
|
|
|
10 |
|
|
#include "Bender.hpp" |
11 |
|
|
|
12 |
|
|
class Matcher |
13 |
|
|
{ |
14 |
|
|
private: |
15 |
|
|
string expression; |
16 |
|
|
public: |
17 |
|
|
Matcher(const string& expression) { this->expression = expression; } |
18 |
|
|
~Matcher() {} |
19 |
|
|
bool match(const string& stuff); |
20 |
|
|
bool operator==(const string& stuff) { return match(stuff); } |
21 |
|
|
bool operator!=(const string& stuff) { return !match(stuff); } |
22 |
|
|
// friends: |
23 |
|
|
friend bool operator==(const string& stuff, Matcher& matcher) { return |
24 |
|
|
matcher == stuff; } |
25 |
|
|
friend bool operator!=(const string& stuff, Matcher& matcher) { return |
26 |
|
|
matcher != stuff; } |
27 |
|
|
}; |
28 |
|
|
|
29 |
|
|
#endif // _Matcher_hpp_ |