diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-14 22:09:01 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-21 20:14:56 +0300 |
commit | 68da62a64cd65a8b28dcfe61b2174e55a47b7517 (patch) | |
tree | c7058ef19c30c86c0d1626c3fcb691b944f02e02 /staging/adblock/rule.h | |
parent | Add tests for MatcherRule and RegexRule (diff) | |
download | smolbote-68da62a64cd65a8b28dcfe61b2174e55a47b7517.tar.xz |
Add some FilterList tests
Diffstat (limited to 'staging/adblock/rule.h')
-rw-r--r-- | staging/adblock/rule.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/staging/adblock/rule.h b/staging/adblock/rule.h index 03970dc..90062ba 100644 --- a/staging/adblock/rule.h +++ b/staging/adblock/rule.h @@ -45,7 +45,8 @@ public: enum MatchPosition { UrlStartsWith, UrlEndsWith, - UrlContains + UrlContains, + UrlEquals }; MatcherRule(const QString &pattern, const Options &opt, const MatchPosition pos = UrlContains) @@ -58,6 +59,9 @@ public: explicit MatcherRule(const MatcherRule &) = delete; MatcherRule &operator=(const MatcherRule &) = delete; + explicit MatcherRule(MatcherRule &&) = delete; + MatcherRule &operator=(MatcherRule &&) = delete; + ~MatcherRule() = default; bool hasMatch(const QStringRef &url) const override { @@ -70,6 +74,8 @@ public: return (index == url.length() - patternLength); case UrlContains: return (index != -1); + case UrlEquals: + return (index == 0 && patternLength == url.length()); } } @@ -93,6 +99,9 @@ public: explicit RegexRule(const RegexRule &) = delete; RegexRule &operator=(const RegexRule &) = delete; + explicit RegexRule(RegexRule &&) = delete; + RegexRule &operator=(RegexRule &&) = delete; + ~RegexRule() = default; bool hasMatch(const QStringRef &url) const override { |