aboutsummaryrefslogtreecommitdiff
path: root/lib/web/urlfilter/adblockrule.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/web/urlfilter/adblockrule.h')
-rw-r--r--lib/web/urlfilter/adblockrule.h35
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