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 class CSSPropertyFilter: public ElemHideBase | 8 struct CSSPropertyFilterData |
10 { | 9 { |
11 private: | 10 String::size_type mPrefixEnd; |
12 String mRegexpSource; | 11 String::size_type mRegexpStart; |
13 String mPrefix; | 12 String::size_type mRegexpEnd; |
14 String mSuffix; | 13 String::size_type mSuffixStart; |
15 public: | 14 |
16 CSSPropertyFilter(const String& text, String::size_type domainsEnd, | 15 const DependentString GetSelectorPrefix(const String& text, |
17 String::size_type selectorStart, String::size_type prefixEnd, | 16 String::size_type selectorStart) const |
18 String::size_type regexpStart, String::size_type regexpEnd, | |
19 String::size_type suffixStart); | |
20 Type GetType() const; | |
21 String GetRegExpString(); | |
22 const String GetSelectorPrefix() | |
23 { | 17 { |
24 return mPrefix; | 18 return DependentString(text, selectorStart, mPrefixEnd - selectorStart); |
25 } | 19 } |
26 const String GetSelectorSuffix() | 20 |
| 21 const DependentString GetRegExpSource(const String& text) const |
27 { | 22 { |
28 return mSuffix; | 23 return DependentString(text, mRegexpStart, mRegexpEnd - mRegexpStart); |
| 24 } |
| 25 |
| 26 const DependentString GetSelectorSuffix(const String& text) const |
| 27 { |
| 28 return DependentString(text, mSuffixStart); |
29 } | 29 } |
30 }; | 30 }; |
31 | 31 |
32 #endif | 32 struct ElemHideData : ElemHideBaseData, CSSPropertyFilterData |
| 33 { |
| 34 }; |
| 35 |
| 36 class CSSPropertyFilter: public ElemHideBase |
| 37 { |
| 38 protected: |
| 39 CSSPropertyFilterData mPropertyData; |
| 40 public: |
| 41 explicit CSSPropertyFilter(const String& text, const ElemHideData& data); |
| 42 EMSCRIPTEN_KEEPALIVE OwnedString GetRegExpString() const; |
| 43 EMSCRIPTEN_KEEPALIVE const DependentString GetSelectorPrefix() const |
| 44 { |
| 45 return mPropertyData.GetSelectorPrefix(mText, mData.mSelectorStart); |
| 46 } |
| 47 EMSCRIPTEN_KEEPALIVE const DependentString GetSelectorSuffix() const |
| 48 { |
| 49 return mPropertyData.GetSelectorSuffix(mText); |
| 50 } |
| 51 }; |
LEFT | RIGHT |