blob: e1cabae843d17f7497798d2777f5172682b23e7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#ifndef ADBLOCKRULE_H
#define ADBLOCKRULE_H
#include <QObject>
#include <QString>
#include <QRegularExpression>
#include <QUrl>
#include <QWebEngineUrlRequestInfo>
class AdBlockRule
{
public:
enum MatchType {
InvalidMatch,
RegularExpressionMatch,
StringContains,
StringStartsWith,
StringEndsWith,
StringEquals,
DomainMatch
};
AdBlockRule(const QString &filter);
bool isEnabled() const;
bool shouldBlock(const QUrl &url) const;
private:
Q_DISABLE_COPY(AdBlockRule)
bool m_isEnabled = false;
bool m_isException = false;
MatchType matchType = InvalidMatch;
QHash<QWebEngineUrlRequestInfo::ResourceType, bool> m_resourceTypeOptions;
QString match;
QRegularExpression regexp;
QStringMatcher matcher;
};
#endif // ADBLOCKRULE_H
|