ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Bender/Matcher.hpp
Revision: 115
Committed: 2004-03-16T22:53:38-08:00 (21 years, 3 months ago) by Douglas Thrift
File size: 796 byte(s)
Log Message:
Hot!

File Contents

# User Rev Content
1 Douglas Thrift 113 // Bender
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #ifndef _Matcher_hpp_
8     #define _Matcher_hpp_
9    
10 Douglas Thrift 114 #include <pcre.h>
11    
12 Douglas Thrift 113 #include "Bender.hpp"
13    
14     class Matcher
15     {
16     private:
17 Douglas Thrift 114 pcre* expression;
18 Douglas Thrift 115 vector<string> substrings;
19 Douglas Thrift 113 public:
20 Douglas Thrift 115 Matcher() { expression = NULL; }
21     Matcher(const string& expression);
22 Douglas Thrift 114 ~Matcher();
23 Douglas Thrift 113 bool match(const string& stuff);
24 Douglas Thrift 114 Matcher& operator()(const string& expression);
25 Douglas Thrift 115 string& operator[](unsigned index) { return substrings[index]; }
26 Douglas Thrift 113 bool operator==(const string& stuff) { return match(stuff); }
27     bool operator!=(const string& stuff) { return !match(stuff); }
28     // friends:
29     friend bool operator==(const string& stuff, Matcher& matcher) { return
30     matcher == stuff; }
31     friend bool operator!=(const string& stuff, Matcher& matcher) { return
32     matcher != stuff; }
33     };
34    
35     #endif // _Matcher_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id