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