diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-11-16 16:26:22 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-11-16 16:26:22 +0100 |
commit | 566abfa99120652fb1e9190d791fdbbba64d2e0d (patch) | |
tree | 86a6f71b926794298d922a9319b55909cf5a07b4 /lib/urlfilter/formats/adblockrule.h | |
parent | Add more regex benchmarks (diff) | |
download | smolbote-566abfa99120652fb1e9190d791fdbbba64d2e0d.tar.xz |
Add adblockrule_parse
Diffstat (limited to 'lib/urlfilter/formats/adblockrule.h')
-rw-r--r-- | lib/urlfilter/formats/adblockrule.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/urlfilter/formats/adblockrule.h b/lib/urlfilter/formats/adblockrule.h index da7e4fc..9c89dac 100644 --- a/lib/urlfilter/formats/adblockrule.h +++ b/lib/urlfilter/formats/adblockrule.h @@ -16,13 +16,22 @@ class AdBlockRule : public FilterLeaf { public: explicit AdBlockRule(FilterLeaf::UrlMatchType matchType, const QString &filter, FilterLeaf::Action action); + ~AdBlockRule() + { + delete stringMatcher; + delete regExp; + }; + void mergeOptions(const QHash<QWebEngineUrlRequestInfo::ResourceType, bool> &options); bool match(const QUrl &requestUrl) const override; - FilterLeaf::Action action() const override; -}; + bool match(const QUrl &requestUrl, QWebEngineUrlRequestInfo::ResourceType type) const; + std::pair<FilterLeaf::Action, QVariant> action() const override; -std::optional<QPair<QWebEngineUrlRequestInfo::ResourceType, bool>> parseOption(const QString &option); -AdBlockRule *loadRule(const QString &filter); +private: + /* Once C++20 comes out, perhaps this can be replaced with a concept template */ + QStringMatcher *stringMatcher = nullptr; + QRegExp *regExp = nullptr; +}; #endif // SMOLBOTE_ADBLOCKRULE_H |