LEFT | RIGHT |
1 #ifndef ADBLOCK_PLUS_CSS_PROPERTY_FILTER_H | 1 #pragma once |
2 #define ADBLOCK_PLUS_CSS_PROPERTY_FILTER_H | |
3 | 2 |
4 #include <cstddef> | 3 #include <cstddef> |
5 | 4 |
6 #include "Filter.h" | 5 #include "Filter.h" |
7 #include "ElemHideBase.h" | 6 #include "ElemHideBase.h" |
8 | 7 |
9 struct CSSPropertyFilterData | 8 struct CSSPropertyFilterData |
10 { | 9 { |
11 String::size_type mPrefixEnd; | 10 String::size_type mPrefixEnd; |
12 String::size_type mRegexpStart; | 11 String::size_type mRegexpStart; |
13 String::size_type mRegexpEnd; | 12 String::size_type mRegexpEnd; |
14 String::size_type mSuffixStart; | 13 String::size_type mSuffixStart; |
15 | 14 |
16 const String GetSelectorPrefix(const String& text, | 15 const DependentString GetSelectorPrefix(const String& text, |
17 String::size_type selectorStart) const | 16 String::size_type selectorStart) const |
18 { | 17 { |
19 return String(text, selectorStart, mPrefixEnd - selectorStart); | 18 return DependentString(text, selectorStart, mPrefixEnd - selectorStart); |
20 } | 19 } |
21 | 20 |
22 const String GetRegExpSource(const String& text) const | 21 const DependentString GetRegExpSource(const String& text) const |
23 { | 22 { |
24 return String(text, mRegexpStart, mRegexpEnd - mRegexpStart); | 23 return DependentString(text, mRegexpStart, mRegexpEnd - mRegexpStart); |
25 } | 24 } |
26 | 25 |
27 const String GetSelectorSuffix(const String& text) const | 26 const DependentString GetSelectorSuffix(const String& text) const |
28 { | 27 { |
29 return String(text, mSuffixStart); | 28 return DependentString(text, mSuffixStart); |
30 } | 29 } |
31 }; | 30 }; |
32 | 31 |
33 struct ElemHideData : ElemHideBaseData, CSSPropertyFilterData | 32 struct ElemHideData : ElemHideBaseData, CSSPropertyFilterData |
34 { | 33 { |
35 }; | 34 }; |
36 | 35 |
37 class CSSPropertyFilter: public ElemHideBase, protected CSSPropertyFilterData | 36 class CSSPropertyFilter: public ElemHideBase |
38 { | 37 { |
| 38 protected: |
| 39 CSSPropertyFilterData mPropertyData; |
39 public: | 40 public: |
40 CSSPropertyFilter(const String& text, const ElemHideData& data); | 41 explicit CSSPropertyFilter(const String& text, const ElemHideData& data); |
41 Type GetType() const; | 42 EMSCRIPTEN_KEEPALIVE OwnedString GetRegExpString() const; |
42 EMSCRIPTEN_KEEPALIVE String GetRegExpString() const; | 43 EMSCRIPTEN_KEEPALIVE const DependentString GetSelectorPrefix() const |
43 EMSCRIPTEN_KEEPALIVE const String GetSelectorPrefix() const | |
44 { | 44 { |
45 return CSSPropertyFilterData::GetSelectorPrefix(mText, mSelectorStart); | 45 return mPropertyData.GetSelectorPrefix(mText, mData.mSelectorStart); |
46 } | 46 } |
47 EMSCRIPTEN_KEEPALIVE const String GetSelectorSuffix() const | 47 EMSCRIPTEN_KEEPALIVE const DependentString GetSelectorSuffix() const |
48 { | 48 { |
49 return CSSPropertyFilterData::GetSelectorSuffix(mText); | 49 return mPropertyData.GetSelectorSuffix(mText); |
50 } | 50 } |
51 }; | 51 }; |
52 | |
53 #endif | |
LEFT | RIGHT |