regexpr.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * (C) 2003-2013 Anope Team
00004  * Contact us at team@anope.org
00005  *
00006  * Please read COPYING and README for further details.
00007  *
00008  * Based on the original code of Epona by Lara.
00009  * Based on the original code of Services by Andy Church.
00010  *
00011  */
00012 
00013 #ifndef REGEXPR_H
00014 #define REGEXPR_H
00015 
00016 #include "services.h"
00017 #include "anope.h"
00018 #include "service.h"
00019 
00020 class RegexException : public CoreException
00021 {
00022  public:
00023         RegexException(const Anope::string &reason = "") : CoreException(reason) { }
00024 
00025         virtual ~RegexException() throw() { }
00026 };
00027 
00028 class CoreExport Regex
00029 {
00030         Anope::string expression;
00031  protected:
00032         Regex(const Anope::string &expr) : expression(expr) { }
00033  public:
00034         virtual ~Regex() { }
00035         const Anope::string &GetExpression() { return expression; }
00036         virtual bool Matches(const Anope::string &str) = 0;
00037 };
00038 
00039 class CoreExport RegexProvider : public Service
00040 {
00041  public:
00042         RegexProvider(Module *o, const Anope::string &n) : Service(o, "Regex", n) { }
00043         virtual Regex *Compile(const Anope::string &) = 0;
00044 };
00045 
00046 #endif // REGEXPR_H
00047