// Site Mapper // // Douglas Thrift // // $Id$ #ifndef _Matcher_hpp_ #define _Matcher_hpp_ #include "SiteMapper.hpp" #include class Matcher { private: pcre* expression; vector substrings; public: Matcher() { expression = NULL; } Matcher(const string& expression); ~Matcher(); bool match(const string& stuff); int size(void) { return substrings.size(); } Matcher& operator()(const string& expression); string& operator[](unsigned index) { return substrings[index]; } bool operator==(const string& stuff) { return match(stuff); } bool operator!=(const string& stuff) { return !match(stuff); } // friends: friend bool operator==(const string& stuff, Matcher& matcher) { return matcher == stuff; } friend bool operator!=(const string& stuff, Matcher& matcher) { return matcher != stuff; } }; #endif // _Matcher_hpp_