OLD | NEW |
(Empty) | |
| 1 #ifndef ADBLOCK_PLUS_FILTER_H |
| 2 #define ADBLOCK_PLUS_FILTER_H |
| 3 |
| 4 #include <vector> |
| 5 |
| 6 #include "String.h" |
| 7 #include "intrusive_ptr.h" |
| 8 #include "debug.h" |
| 9 |
| 10 class Filter : public ref_counted |
| 11 { |
| 12 protected: |
| 13 OwnedString mText; |
| 14 |
| 15 public: |
| 16 explicit Filter(const String& text); |
| 17 virtual ~Filter(); |
| 18 |
| 19 /* TODO |
| 20 std::vector<Subscription> subscriptions; |
| 21 */ |
| 22 |
| 23 EMSCRIPTEN_KEEPALIVE const DependentString GetText() const |
| 24 { |
| 25 return mText; |
| 26 } |
| 27 |
| 28 enum Type |
| 29 { |
| 30 UNKNOWN = 0, |
| 31 INVALID = 1, |
| 32 COMMENT = 2, |
| 33 BLOCKING = 3, |
| 34 WHITELIST = 4, |
| 35 ELEMHIDE = 5, |
| 36 ELEMHIDEEXCEPTION = 6, |
| 37 CSSPROPERTY = 7, |
| 38 }; |
| 39 |
| 40 virtual Type GetType() const = 0; |
| 41 |
| 42 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; |
| 43 |
| 44 static EMSCRIPTEN_KEEPALIVE Type GetType(Filter* filter) |
| 45 { |
| 46 return filter->GetType(); |
| 47 } |
| 48 |
| 49 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text); |
| 50 static EMSCRIPTEN_KEEPALIVE Filter* GetKnownFilter(const String& text); |
| 51 }; |
| 52 |
| 53 typedef intrusive_ptr<Filter> FilterPtr; |
| 54 |
| 55 #endif |
OLD | NEW |