From 11cafc12d5440b67a9f676c9f6aa67840ca5399d Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 2 Apr 2013 20:12:15 +0100 Subject: Tidy up source files: - Use #pragma once instead of include guards. - Move header files in src/modules to include/modules. - Fixed various spacing issues. --- include/modules/regex.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 include/modules/regex.h (limited to 'include/modules/regex.h') 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 + * Copyright (C) 2008 Thomas Stagner + * + * 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 . + */ + + +#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; +}; -- cgit v1.2.3