diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-18 10:07:51 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-18 10:07:51 +0200 |
commit | f507a7a5557c7cca9570c684920e055c5251b08e (patch) | |
tree | 0fad83fc99053006b375608e2a2d04388776ad89 /lib/web/urlfilter/adblockrule.h | |
parent | AdBlockTest: loading subscription (diff) | |
download | smolbote-f507a7a5557c7cca9570c684920e055c5251b08e.tar.xz |
AdBlockRule: move matching logic to FilterRule
Diffstat (limited to 'lib/web/urlfilter/adblockrule.h')
-rw-r--r-- | lib/web/urlfilter/adblockrule.h | 35 |
1 files changed, 5 insertions, 30 deletions
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 <QObject> #include <QString> #include <QRegularExpression> #include <QUrl> #include <QWebEngineUrlRequestInfo> +#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<QWebEngineUrlRequestInfo::ResourceType, bool> m_resourceTypeOptions; - QStringList allowedDomains, blockedDomains; - - QString match; - QRegularExpression regexp; - QStringMatcher matcher; }; -#endif // ADBLOCKRULE_H +#endif // SMOLBOTE_ADBLOCKRULE_H |