| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #pragma once | |
| 2 | |
| 3 #include <vector> | |
| 4 | |
| 5 #include "String.h" | |
| 6 #include "intrusive_ptr.h" | |
| 7 #include "debug.h" | |
| 8 | |
| 9 class Filter : public ref_counted | |
| 10 { | |
| 11 protected: | |
| 12 OwnedString mText; | |
| 13 | |
| 14 public: | |
| 15 explicit Filter(const String& text); | |
| 16 virtual ~Filter(); | |
| 17 | |
| 18 /* TODO | |
| 19 std::vector<Subscription> subscriptions; | |
|
sergei
2016/06/16 21:16:36
May be it makes sense to remove this comment from
Wladimir Palant
2016/12/06 10:47:28
This is merely a reverse mapping meant to speed up
| |
| 20 */ | |
| 21 | |
| 22 EMSCRIPTEN_KEEPALIVE const String& GetText() const | |
| 23 { | |
| 24 return mText; | |
| 25 } | |
| 26 | |
| 27 enum Type | |
| 28 { | |
| 29 UNKNOWN = 0, | |
| 30 INVALID = 1, | |
| 31 COMMENT = 2, | |
| 32 BLOCKING = 3, | |
| 33 WHITELIST = 4, | |
| 34 ELEMHIDE = 5, | |
| 35 ELEMHIDEEXCEPTION = 6, | |
| 36 CSSPROPERTY = 7, | |
| 37 }; | |
| 38 | |
| 39 virtual Type GetType() const = 0; | |
|
sergei
2016/06/16 21:16:34
Can we set filter type in constructor and make thi
Wladimir Palant
2016/12/06 10:47:26
Actually, if we do that then we can just read out
| |
| 40 | |
| 41 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; | |
| 42 | |
| 43 static EMSCRIPTEN_KEEPALIVE Type GetType(Filter* filter) | |
| 44 { | |
| 45 return filter->GetType(); | |
| 46 } | |
| 47 | |
| 48 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text); | |
| 49 static EMSCRIPTEN_KEEPALIVE Filter* GetKnownFilter(const String& text); | |
| 50 }; | |
| 51 | |
| 52 typedef intrusive_ptr<Filter> FilterPtr; | |
| OLD | NEW |