summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2013-08-27 05:28:15 -0700
committerAttila Molnar <attilamolnar@hush.com>2013-08-27 05:28:15 -0700
commit620e818578a5e0dbebd07fb27a571d5392c66c24 (patch)
tree6d20eef5fd9b98fecd93df2caf197ad08c168562 /include
parentd9d9cbe025f94523265daa72de7596467d71f5c8 (diff)
parenteaf658de3d1ef984c9a0b4273a9cfbd3029f8b5b (diff)
Merge pull request #619 from SaberUK/master+regex-dedupe
Various regex module improvements.
Diffstat (limited to 'include')
-rw-r--r--include/modules/regex.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/modules/regex.h b/include/modules/regex.h
index 875f942bc..0bced4e2b 100644
--- a/include/modules/regex.h
+++ b/include/modules/regex.h
@@ -25,18 +25,15 @@
class Regex : public classbase
{
protected:
- std::string regex_string; // The raw uncompiled regex string.
+ /** The uncompiled regex string. */
+ std::string regex_string;
// Constructor may as well be protected, as this class is abstract.
- Regex(const std::string& rx) : regex_string(rx)
- {
- }
+ Regex(const std::string& rx) : regex_string(rx) { }
public:
- virtual ~Regex()
- {
- }
+ virtual ~Regex() { }
virtual bool Matches(const std::string& text) = 0;
@@ -49,7 +46,17 @@ public:
class RegexFactory : public DataProvider
{
public:
- RegexFactory(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
+ RegexFactory(Module* creator, const std::string& name) : DataProvider(creator, name) { }
virtual Regex* Create(const std::string& expr) = 0;
};
+
+class RegexException : public ModuleException
+{
+ public:
+ RegexException(const std::string& regex, const std::string& error)
+ : ModuleException("Error in regex '" + regex + "': " + error) { }
+
+ RegexException(const std::string& regex, const std::string& error, int offset)
+ : ModuleException("Error in regex '" + regex + "' at offset " + ConvToStr(offset) + ": " + error) { }
+};