diff options
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 |