From f507a7a5557c7cca9570c684920e055c5251b08e Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 18 Jul 2018 10:07:51 +0200 Subject: AdBlockRule: move matching logic to FilterRule --- lib/web/urlfilter/adblockrule.h | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'lib/web/urlfilter/adblockrule.h') diff --git a/lib/web/urlfilter/adblockrule.h b/lib/web/urlfilter/adblockrule.h index 76484c3..aeabf4f 100644 --- a/lib/web/urlfilter/adblockrule.h +++ b/lib/web/urlfilter/adblockrule.h @@ -1,43 +1,18 @@ -#ifndef ADBLOCKRULE_H -#define ADBLOCKRULE_H +#ifndef SMOLBOTE_ADBLOCKRULE_H +#define SMOLBOTE_ADBLOCKRULE_H #include #include #include #include #include +#include "filterrule.h" -class AdBlockRule +class AdBlockRule : public FilterRule { public: - - enum MatchType { - InvalidMatch, - RegularExpressionMatch, - StringContains, - StringStartsWith, - StringEndsWith, - StringEquals, - DomainMatch - }; - AdBlockRule(const QString &filter); - bool isEnabled() const; - bool matchesType(QWebEngineUrlRequestInfo::ResourceType type) const; - bool matchesUrl(const QUrl &url) const; - -private: - bool m_isEnabled = false; - bool m_isException = false; - - MatchType matchType = InvalidMatch; - QHash m_resourceTypeOptions; - QStringList allowedDomains, blockedDomains; - - QString match; - QRegularExpression regexp; - QStringMatcher matcher; }; -#endif // ADBLOCKRULE_H +#endif // SMOLBOTE_ADBLOCKRULE_H -- cgit v1.2.1