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