// Zoe AIM Away Message RSS Feed Generator // // Douglas Thrift // // $Id$ #ifndef _Matcher_hpp_ #define _Matcher_hpp_ #include #include "Zoe.hpp" class Matcher { private: pcre* expression; std::vector substrings; public: Matcher() : expression(NULL) {} Matcher(const ext::String& expression); ~Matcher(); bool match(const ext::String& stuff); unsigned size(void) const { return substrings.size(); } Matcher& operator()(const ext::String& expression); const ext::String& operator[](unsigned index) const { return substrings[index]; } operator ext::String() const { return substrings[0]; } bool operator==(const ext::String& stuff) { return match(stuff); } bool operator!=(const ext::String& stuff) { return !match(stuff); } // friends: friend bool operator==(const ext::String& stuff, Matcher& matcher) { return matcher == stuff; } friend bool operator!=(const ext::String& stuff, Matcher& matcher) { return matcher != stuff; } }; #endif // _Matcher_hpp_