LEFT | RIGHT |
1 #ifndef ADBLOCK_PLUS_REG_EXP_FILTER_H | 1 #pragma once |
2 #define ADBLOCK_PLUS_REG_EXP_FILTER_H | |
3 | 2 |
4 #include "Filter.h" | 3 #include "Filter.h" |
5 #include "ActiveFilter.h" | 4 #include "ActiveFilter.h" |
6 | 5 |
7 enum class TrippleState {YES, NO, ANY}; | 6 enum class TrippleState {YES, NO, ANY}; |
8 | 7 |
9 struct RegExpFilterData | 8 struct RegExpFilterData |
10 { | 9 { |
11 mutable String::size_type mPatternStart; | 10 mutable String::size_type mPatternStart; |
12 union | 11 union |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 { | 67 { |
69 mSitekeysStart = String::npos; | 68 mSitekeysStart = String::npos; |
70 } | 69 } |
71 | 70 |
72 const DependentString GetSitekeysSource(const String& text) const | 71 const DependentString GetSitekeysSource(const String& text) const |
73 { | 72 { |
74 return DependentString(text, mSitekeysStart, mSitekeysEnd - mSitekeysStart); | 73 return DependentString(text, mSitekeysStart, mSitekeysEnd - mSitekeysStart); |
75 } | 74 } |
76 }; | 75 }; |
77 | 76 |
78 class RegExpFilter : public ActiveFilter, protected RegExpFilterData | 77 class RegExpFilter : public ActiveFilter |
79 { | 78 { |
80 private: | 79 private: |
81 void ParseSitekeys(const String& sitekeys) const; | 80 void ParseSitekeys(const String& sitekeys) const; |
82 | 81 |
83 protected: | 82 protected: |
84 virtual DomainMap* GetDomains() const; | 83 RegExpFilterData mData; |
85 virtual SitekeySet* GetSitekeys() const; | 84 |
| 85 DomainMap* GetDomains() const override; |
| 86 SitekeySet* GetSitekeys() const override; |
86 public: | 87 public: |
87 RegExpFilter(const String& text, const RegExpFilterData& data); | 88 explicit RegExpFilter(Type type, const String& text, const RegExpFilterData& d
ata); |
88 ~RegExpFilter(); | 89 ~RegExpFilter(); |
89 static Type Parse(DependentString& text, OwnedString& error, | 90 static Type Parse(DependentString& text, DependentString& error, |
90 RegExpFilterData& data); | 91 RegExpFilterData& data); |
91 EMSCRIPTEN_KEEPALIVE static void InitJSTypes(); | 92 EMSCRIPTEN_KEEPALIVE static void InitJSTypes(); |
92 static OwnedString RegExpFromSource(const String& source); | 93 static OwnedString RegExpFromSource(const String& source); |
93 Type GetType() const; | |
94 EMSCRIPTEN_KEEPALIVE bool Matches(const String& location, int typeMask, | 94 EMSCRIPTEN_KEEPALIVE bool Matches(const String& location, int typeMask, |
95 DependentString& docDomain, bool thirdParty, const String& sitekey) const; | 95 DependentString& docDomain, bool thirdParty, const String& sitekey) const; |
96 }; | 96 }; |
97 | |
98 #endif | |
LEFT | RIGHT |