LEFT | RIGHT |
| 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 eyeo GmbH |
| 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ |
| 17 |
1 #pragma once | 18 #pragma once |
2 | 19 |
3 #include <vector> | 20 #include <vector> |
4 | 21 |
5 #include "../String.h" | 22 #include "../String.h" |
6 #include "../intrusive_ptr.h" | 23 #include "../intrusive_ptr.h" |
7 #include "../debug.h" | 24 #include "../debug.h" |
8 | 25 |
9 class Filter : public ref_counted | 26 class Filter : public ref_counted |
10 { | 27 { |
11 protected: | 28 protected: |
12 OwnedString mText; | 29 OwnedString mText; |
13 | 30 |
14 public: | 31 public: |
15 enum Type | 32 enum Type |
16 { | 33 { |
17 UNKNOWN = 0, | 34 UNKNOWN = 0, |
18 INVALID = 1, | 35 INVALID = 1, |
19 COMMENT = 2, | 36 COMMENT = 2, |
20 BLOCKING = 3, | 37 BLOCKING = 3, |
21 WHITELIST = 4, | 38 WHITELIST = 4, |
22 ELEMHIDE = 5, | 39 ELEMHIDE = 5, |
23 ELEMHIDEEXCEPTION = 6, | 40 ELEMHIDEEXCEPTION = 6, |
24 ELEMHIDEEMULATION = 7, | 41 ELEMHIDEEMULATION = 7, |
25 MAXTYPE = 7 | 42 VALUE_COUNT = 8 |
26 }; | 43 }; |
27 | 44 |
28 explicit Filter(Type type, const String& text); | 45 explicit Filter(Type type, const String& text); |
29 ~Filter(); | 46 ~Filter(); |
30 | 47 |
31 Type mType; | 48 Type mType; |
32 | 49 |
33 EMSCRIPTEN_KEEPALIVE const String& GetText() const | 50 EMSCRIPTEN_KEEPALIVE const String& GetText() const |
34 { | 51 { |
35 return mText; | 52 return mText; |
36 } | 53 } |
37 | 54 |
38 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; | 55 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; |
39 | 56 |
40 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text); | 57 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text); |
41 }; | 58 }; |
42 | 59 |
43 typedef intrusive_ptr<Filter> FilterPtr; | 60 typedef intrusive_ptr<Filter> FilterPtr; |
LEFT | RIGHT |