From 5f623dcfc8f02504d745f47f8b9274b2bca5fd67 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 18 Oct 2018 23:39:28 +0200 Subject: urlfilter: destroy FilterLeaves only when destroying the FilterTree Add QMutex lock when adding rules clang-format pass --- lib/urlfilter/filterleaf.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'lib/urlfilter/filterleaf.h') diff --git a/lib/urlfilter/filterleaf.h b/lib/urlfilter/filterleaf.h index 6d9caae..36c00e9 100644 --- a/lib/urlfilter/filterleaf.h +++ b/lib/urlfilter/filterleaf.h @@ -9,8 +9,10 @@ #ifndef SMOLBOTE_FILTERLEAF_H #define SMOLBOTE_FILTERLEAF_H +#include #include #include +#include class FilterLeaf { @@ -23,7 +25,7 @@ public: }; FilterLeaf(FilterLeaf &&other); - FilterLeaf& operator=(FilterLeaf &&other); + FilterLeaf &operator=(FilterLeaf &&other); ~FilterLeaf() = default; virtual bool match(const QString &requestUrl) const = 0; @@ -33,11 +35,26 @@ public: const QString redirect() const; protected: + enum UrlMatchType { + InvalidMatch, + RegularExpressionMatch, + StringContains, + StringStartsWith, + StringEndsWith, + StringEquals, + DomainMatch + }; + explicit FilterLeaf() = default; + // rule matching + UrlMatchType matchType = InvalidMatch; + QHash resourceTypeOptions; + QString m_request; + + // rule action bool m_isBlocking; - std::string m_request; - std::string m_redirect; + QString m_redirect; }; #endif // SMOLBOTE_FILTERLEAF_H -- cgit v1.2.1