]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_regex.h
523f9f0d32f4bbce6ca44a65feba28a0cb916a61
[user/henk/code/inspircd.git] / src / modules / m_regex.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *          the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef _M_REGEX_H
15 #define _M_REGEX_H
16
17 #include "inspircd.h"
18
19 class Regex : public classbase
20 {
21 protected:
22         std::string regex_string; // The raw uncompiled regex string.
23
24         // Constructor may as well be protected, as this class is abstract.
25         Regex(const std::string& rx) : regex_string(rx)
26         {
27         }
28
29 public:
30
31         virtual ~Regex()
32         {
33         }
34
35         virtual bool Matches(const std::string& text) = 0;
36
37         const std::string& GetRegexString() const
38         {
39                 return regex_string;
40         }
41 };
42
43 class RegexFactory : public DataProvider
44 {
45  public:
46         RegexFactory(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
47
48         virtual Regex* Create(const std::string& expr) = 0;
49 };
50
51 #endif