aboutsummaryrefslogtreecommitdiff
path: root/lib/urlfilter/formats/adblocklist.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/urlfilter/formats/adblocklist.h')
-rw-r--r--lib/urlfilter/formats/adblocklist.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/urlfilter/formats/adblocklist.h b/lib/urlfilter/formats/adblocklist.h
new file mode 100644
index 0000000..34a2120
--- /dev/null
+++ b/lib/urlfilter/formats/adblocklist.h
@@ -0,0 +1,32 @@
+#ifndef ADBLOCKLIST_H
+#define ADBLOCKLIST_H
+
+#include <QHash>
+#include "adblockrule.h"
+
+class AdBlockList
+{
+public:
+ AdBlockList();
+
+ QString metadata(const QString &key) const;
+ FilterLeaf::Action match(const QUrl &firstParty, const QUrl &requestUrl, QWebEngineUrlRequestInfo::ResourceType type = QWebEngineUrlRequestInfo::ResourceTypeUnknown) const;
+
+ bool parseLine(const QString &line);
+
+protected:
+ bool parseComment(const QString &commentLine);
+
+private:
+ struct Filter
+ {
+ FilterLeaf::Action action = FilterLeaf::Block;
+ Matcher *matcher;
+ };
+
+ QHash<QString, QString> m_metadata;
+ //QMap<QString, Filter> m_rules;
+ std::vector<Filter> m_rules;
+};
+
+#endif // ADBLOCKLIST_H