X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_regex_stdlib.cpp;h=7a888ed722b77b0523ec321a44372b71d76d03b8;hb=e7c829af5941c6a8a303ca75ed9ac47570347e41;hp=d69f739ecedadc702929b74957879534c4c7335a;hpb=b7e793d96131e7813fe42984ec3a04254720ad20;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_regex_stdlib.cpp b/src/modules/extra/m_regex_stdlib.cpp index d69f739ec..7a888ed72 100644 --- a/src/modules/extra/m_regex_stdlib.cpp +++ b/src/modules/extra/m_regex_stdlib.cpp @@ -16,21 +16,13 @@ * along with this program. If not, see . */ +/// $CompilerFlags: -std=c++11 + + #include "inspircd.h" #include "modules/regex.h" #include -/* $CompileFlags: -std=c++11 */ - -class StdRegexException : public ModuleException -{ - public: - StdRegexException(const std::string& rx, const std::string& error) - : ModuleException(std::string("Error in regex ") + rx + ": " + error) - { - } -}; - class StdRegex : public Regex { std::regex regexcl; @@ -43,11 +35,11 @@ class StdRegex : public Regex } catch(std::regex_error rxerr) { - throw StdRegexException(rx, rxerr.what()); + throw RegexException(rx, rxerr.what()); } } - bool Matches(const std::string& text) + bool Matches(const std::string& text) CXX11_OVERRIDE { return std::regex_search(text, regexcl); } @@ -58,7 +50,7 @@ class StdRegexFactory : public RegexFactory public: std::regex::flag_type regextype; StdRegexFactory(Module* m) : RegexFactory(m, "regex/stdregex") {} - Regex* Create(const std::string& expr) + Regex* Create(const std::string& expr) CXX11_OVERRIDE { return new StdRegex(expr, regextype); } @@ -70,8 +62,6 @@ public: StdRegexFactory ref; ModuleRegexStd() : ref(this) { - ServerInstance->Modules->AddService(ref); - OnRehash(NULL); } Version GetVersion() CXX11_OVERRIDE @@ -79,7 +69,7 @@ public: return Version("Regex Provider Module for std::regex", VF_VENDOR); } - void OnRehash(User* u) CXX11_OVERRIDE + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* Conf = ServerInstance->Config->ConfValue("stdregex"); std::string regextype = Conf->getString("type", "ecmascript");