| LEFT | RIGHT |
| 1 #ifndef ADBLOCKPLUS_FILTER_H | 1 #pragma once |
| 2 #define ADBLOCKPLUS_FILTER_H | |
| 3 | 2 |
| 4 #include <string> | |
| 5 #include <vector> | 3 #include <vector> |
| 6 | 4 |
| 7 class Filter | 5 #include "String.h" |
| 6 #include "intrusive_ptr.h" |
| 7 #include "debug.h" |
| 8 |
| 9 class Filter : public ref_counted |
| 8 { | 10 { |
| 9 private: | 11 protected: |
| 10 std::u16string text; | 12 OwnedString mText; |
| 11 | 13 |
| 12 public: | 14 public: |
| 13 Filter(const std::u16string& text); | |
| 14 | |
| 15 /* TODO | |
| 16 std::vector<Subscription> subscriptions; | |
| 17 */ | |
| 18 | |
| 19 const std::u16string get_text() {return text;} | |
| 20 | |
| 21 enum Type | 15 enum Type |
| 22 { | 16 { |
| 23 UNKNOWN = 0, | 17 UNKNOWN = 0, |
| 24 INVALID = 1, | 18 INVALID = 1, |
| 25 COMMENT = 2, | 19 COMMENT = 2, |
| 26 BLOCKING = 3, | 20 BLOCKING = 3, |
| 27 WHITELIST = 4, | 21 WHITELIST = 4, |
| 28 ELEMHIDE = 5, | 22 ELEMHIDE = 5, |
| 29 ELEMHIDEEXCEPTION = 6, | 23 ELEMHIDEEXCEPTION = 6, |
| 30 CSSPROPERTY = 7, | 24 CSSPROPERTY = 7, |
| 31 }; | 25 }; |
| 32 | 26 |
| 33 virtual Type get_type() = 0; | 27 explicit Filter(Type type, const String& text); |
| 28 ~Filter(); |
| 34 | 29 |
| 35 virtual const std::u16string Serialize(); | 30 Type mType; |
| 31 |
| 32 /* TODO |
| 33 std::vector<Subscription> mSubscriptions; |
| 34 */ |
| 35 |
| 36 EMSCRIPTEN_KEEPALIVE const String& GetText() const |
| 37 { |
| 38 return mText; |
| 39 } |
| 40 |
| 41 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; |
| 42 |
| 43 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text); |
| 36 }; | 44 }; |
| 37 | 45 |
| 38 #endif | 46 typedef intrusive_ptr<Filter> FilterPtr; |
| LEFT | RIGHT |