diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rules/debug.cpp | 2 | ||||
-rw-r--r-- | src/rules/license.cpp | 5 | ||||
-rw-r--r-- | src/stringutils.cpp | 11 | ||||
-rw-r--r-- | src/stringutils.h | 2 | ||||
-rw-r--r-- | src/template.hpp | 2 |
5 files changed, 20 insertions, 2 deletions
diff --git a/src/rules/debug.cpp b/src/rules/debug.cpp index e2279bf..7c16990 100644 --- a/src/rules/debug.cpp +++ b/src/rules/debug.cpp @@ -45,6 +45,8 @@ registerRuleExt(debugCpp, "004", "(.+)[.]cpp") startRule(debugCpp) { + if (isMatch(file, "(.*)[/]debug[/]([^/]*)[.](cpp|h)")) + terminateRule(); } endRule(debugCpp) diff --git a/src/rules/license.cpp b/src/rules/license.cpp index d70a051..06eda18 100644 --- a/src/rules/license.cpp +++ b/src/rules/license.cpp @@ -24,6 +24,11 @@ registerRuleExt(license, "005", "(.+)[.](h|cpp)") startRule(license) { + if (isMatch(file, "(.*)[/]((debug|sdl2gfx)[/]([^/]*)|mumblemanager" + "|SDLMain|utils/physfsrwops|utils/base64)[.](cpp|h)")) + { + terminateRule(); + } } endRule(license) diff --git a/src/stringutils.cpp b/src/stringutils.cpp index f580266..05e6a01 100644 --- a/src/stringutils.cpp +++ b/src/stringutils.cpp @@ -24,11 +24,12 @@ #include <string> #include <algorithm> +#include <cctype> #include <cstdarg> #include <cstdio> -#include <cctype> -#include <list> #include <ctime> +#include <list> +#include <regex> std::string &trim(std::string &str) { @@ -694,3 +695,9 @@ void secureChatCommand(std::string &str) if (str[0] == '/' || str[0] == '@' || str[0] == '#') str = "_" + str; } + +bool isMatch(const std::string &str, const std::string &exp) +{ + std::regex regExp(exp); + return std::regex_match(str, regExp); +} diff --git a/src/stringutils.h b/src/stringutils.h index 8943317..f7218c0 100644 --- a/src/stringutils.h +++ b/src/stringutils.h @@ -234,4 +234,6 @@ bool isDigit(const std::string &str); void secureChatCommand(std::string &str); +bool isMatch(const std::string &str, const std::string &exp); + #endif // STRINGUTILS_H diff --git a/src/template.hpp b/src/template.hpp index 3acfb86..25c7b88 100644 --- a/src/template.hpp +++ b/src/template.hpp @@ -21,6 +21,8 @@ #include "rulebase.h" #include "stringutils.h" +#include <regex> + #include "localconsts.h" #define registerRule(rule) \ |