X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=include%2Fmodules%2Fregex.h;h=2a915ae61dda1f0806e2edb35cdcb69e2a823f59;hb=c7b938502295ddc5b2c89e0854d8c5c19ede32dc;hp=875f942bcbd27b0fcbb9d0c312d0fd24a2b7f6ed;hpb=11cafc12d5440b67a9f676c9f6aa67840ca5399d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules/regex.h b/include/modules/regex.h index 875f942bc..2a915ae61 100644 --- a/include/modules/regex.h +++ b/include/modules/regex.h @@ -1,6 +1,11 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2013, 2021 Sadie Powell + * Copyright (C) 2013 Attila Molnar + * Copyright (C) 2012 Robby + * Copyright (C) 2010 Craig Edwards + * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2009 Daniel De Graaf * Copyright (C) 2008 Thomas Stagner * @@ -20,23 +25,20 @@ #pragma once -#include "inspircd.h" +#include "event.h" 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 +51,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) { } +};