ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Smersh/Matcher.hpp
Revision: 175
Committed: 2004-06-25T01:10:49-07:00 (21 years ago) by Douglas Thrift
File size: 841 byte(s)
Log Message:
Arg, I wish it worked better.

File Contents

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

Properties

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