summaryrefslogtreecommitdiff
path: root/include/modules/regex.h
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2013-04-02 20:12:15 +0100
committerPeter Powell <petpow@saberuk.com>2013-04-12 17:03:05 +0100
commit11cafc12d5440b67a9f676c9f6aa67840ca5399d (patch)
tree7c8eac3b1ad474fdaf42767bffee7c3c4b4cce48 /include/modules/regex.h
parenta5fe50aca04ca554d313e7361c571c6a497a9c4e (diff)
Tidy up source files:
- Use #pragma once instead of include guards. - Move header files in src/modules to include/modules. - Fixed various spacing issues.
Diffstat (limited to 'include/modules/regex.h')
-rw-r--r--include/modules/regex.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/include/modules/regex.h b/include/modules/regex.h
new file mode 100644
index 000000000..875f942bc
--- /dev/null
+++ b/include/modules/regex.h
@@ -0,0 +1,55 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ *
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+#include "inspircd.h"
+
+class Regex : public classbase
+{
+protected:
+ std::string regex_string; // The raw uncompiled regex string.
+
+ // Constructor may as well be protected, as this class is abstract.
+ Regex(const std::string& rx) : regex_string(rx)
+ {
+ }
+
+public:
+
+ virtual ~Regex()
+ {
+ }
+
+ virtual bool Matches(const std::string& text) = 0;
+
+ const std::string& GetRegexString() const
+ {
+ return regex_string;
+ }
+};
+
+class RegexFactory : public DataProvider
+{
+ public:
+ RegexFactory(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
+
+ virtual Regex* Create(const std::string& expr) = 0;
+};