LEFT | RIGHT |
1 #ifndef ADBLOCK_PLUS_ELEM_HIDE_BASE_H | 1 #pragma once |
2 #define ADBLOCK_PLUS_ELEM_HIDE_BASE_H | |
3 | 2 |
4 #include <cstddef> | 3 #include <cstddef> |
5 | 4 |
6 #include "ActiveFilter.h" | 5 #include "ActiveFilter.h" |
7 | 6 |
8 struct ElemHideBaseData | 7 struct ElemHideBaseData |
9 { | 8 { |
10 String::size_type mDomainsEnd; | 9 String::size_type mDomainsEnd; |
11 String::size_type mSelectorStart; | 10 String::size_type mSelectorStart; |
12 | 11 |
13 bool HasDomains() const | 12 bool HasDomains() const |
14 { | 13 { |
15 return mDomainsEnd != 0; | 14 return mDomainsEnd != 0; |
16 } | 15 } |
17 | 16 |
18 String GetDomainsSource(String& text) const | 17 DependentString GetDomainsSource(String& text) const |
19 { | 18 { |
20 return String(text, 0, mDomainsEnd); | 19 return DependentString(text, 0, mDomainsEnd); |
21 } | 20 } |
22 | 21 |
23 const String GetDomainsSource(const String& text) const | 22 const DependentString GetDomainsSource(const String& text) const |
24 { | 23 { |
25 return String(text, 0, mDomainsEnd); | 24 return DependentString(text, 0, mDomainsEnd); |
26 } | 25 } |
27 | 26 |
28 String GetSelector(String& text) const | 27 DependentString GetSelector(String& text) const |
29 { | 28 { |
30 return String(text, mSelectorStart); | 29 return DependentString(text, mSelectorStart); |
31 } | 30 } |
32 | 31 |
33 const String GetSelector(const String& text) const | 32 const DependentString GetSelector(const String& text) const |
34 { | 33 { |
35 return String(text, mSelectorStart); | 34 return DependentString(text, mSelectorStart); |
36 } | 35 } |
37 }; | 36 }; |
38 | 37 |
39 struct ElemHideData; | 38 struct ElemHideData; |
40 | 39 |
41 class ElemHideBase : public ActiveFilter, protected ElemHideBaseData | 40 class ElemHideBase : public ActiveFilter |
42 { | 41 { |
| 42 protected: |
| 43 ElemHideBaseData mData; |
43 public: | 44 public: |
44 ElemHideBase(const String& text, const ElemHideBaseData& data); | 45 explicit ElemHideBase(Type type, const String& text, const ElemHideBaseData& d
ata); |
45 static Type Parse(String& text, ElemHideData& data); | 46 static Type Parse(DependentString& text, ElemHideData& data); |
46 | 47 |
47 EMSCRIPTEN_KEEPALIVE const String GetSelector() const | 48 EMSCRIPTEN_KEEPALIVE const DependentString GetSelector() const |
48 { | 49 { |
49 return ElemHideBaseData::GetSelector(mText); | 50 return mData.GetSelector(mText); |
50 } | 51 } |
51 | 52 |
52 EMSCRIPTEN_KEEPALIVE String GetSelectorDomain() const; | 53 EMSCRIPTEN_KEEPALIVE OwnedString GetSelectorDomain() const; |
53 }; | 54 }; |
54 | |
55 #endif | |
LEFT | RIGHT |