ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/Matcher.hpp
Revision: 6
Committed: 2004-07-09T15:09:38-07:00 (20 years, 11 months ago) by douglas
File size: 1002 byte(s)
Log Message:
Oops!

File Contents

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

Properties

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