7 |
|
#ifndef _Matcher_hpp_ |
8 |
|
#define _Matcher_hpp_ |
9 |
|
|
10 |
+ |
#include <pcre.h> |
11 |
+ |
|
12 |
|
#include "Bender.hpp" |
13 |
|
|
14 |
|
class Matcher |
15 |
|
{ |
16 |
|
private: |
17 |
< |
string expression; |
17 |
> |
pcre* expression; |
18 |
> |
vector<string> substrings; |
19 |
|
public: |
20 |
< |
Matcher(const string& expression) { this->expression = expression; } |
21 |
< |
~Matcher() {} |
20 |
> |
Matcher() { expression = NULL; } |
21 |
> |
Matcher(const string& expression); |
22 |
> |
~Matcher(); |
23 |
|
bool match(const string& stuff); |
24 |
+ |
Matcher& operator()(const string& expression); |
25 |
+ |
string& operator[](unsigned index) { return substrings[index]; } |
26 |
|
bool operator==(const string& stuff) { return match(stuff); } |
27 |
|
bool operator!=(const string& stuff) { return !match(stuff); } |
28 |
|
// friends: |