X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules%2Fregex.h;h=5ef00cdd043806e178878c9f7fe47010db70eb76;hb=79892a727e323dcc4bce7e9c0cf3c99c5fe61706;hp=875f942bcbd27b0fcbb9d0c312d0fd24a2b7f6ed;hpb=11cafc12d5440b67a9f676c9f6aa67840ca5399d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules/regex.h b/include/modules/regex.h index 875f942bc..5ef00cdd0 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) { } +};