ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/SiteMapper/Matcher.hpp
(Generate patch)

Comparing SiteMapper/Matcher.hpp (file contents):
Revision 200 by Douglas Thrift, 2004-08-30T18:28:29-07:00 vs.
Revision 312 by douglas, 2004-12-13T15:01:12-08:00

# Line 9 | Line 9
9  
10   #include "SiteMapper.hpp"
11  
12 + #ifdef MENES_PRAGMA_ONCE
13 + #pragma once
14 + #endif
15 +
16   #include <pcre.h>
17  
18   class Matcher
19   {
20   private:
21 <        pcre* expression;
22 <        vector<string> substrings;
21 >        ::pcre* expression;
22 >        ext::Vector<ext::String> substrings;
23   public:
24 <        Matcher() { expression = NULL; }
25 <        Matcher(const string& expression);
26 <        ~Matcher();
27 <        bool match(const string& stuff);
28 <        int size(void) { return substrings.size(); }
29 <        Matcher& operator()(const string& expression);
30 <        string& operator[](unsigned index) { return substrings[index]; }
31 <        bool operator==(const string& stuff) { return match(stuff); }
32 <        bool operator!=(const string& stuff) { return !match(stuff); }
24 >        Matcher() : expression(NULL) {}
25 >        Matcher(const ext::String& expression) : expression(NULL) { (*this)(expression); }
26 >        ~Matcher() { if (expression != NULL) ::pcre_free(expression); }
27 >        bool match(const ext::String& stuff);
28 >        size_t size() { return substrings.GetSize(); }
29 >        Matcher& operator()(const ext::String& expression);
30 >        ext::String& operator[](size_t index) { return substrings[index]; }
31 >        bool operator==(const ext::String& stuff) { return match(stuff); }
32 >        bool operator!=(const ext::String& stuff) { return !match(stuff); }
33   // friends:
34 <        friend bool operator==(const string& stuff, Matcher& matcher) { return
35 <                matcher == stuff; }
32 <        friend bool operator!=(const string& stuff, Matcher& matcher) { return
33 <                matcher != stuff; }
34 >        friend bool operator==(const ext::String& stuff, Matcher& matcher) { return matcher == stuff; }
35 >        friend bool operator!=(const ext::String& stuff, Matcher& matcher) { return matcher != stuff; }
36   };
37  
38   #endif // _Matcher_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines