| LEFT | RIGHT |
| 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 <emscripten.h> | |
| 23 | |
| 24 #include "../String.h" | 22 #include "../String.h" |
| 25 #include "../intrusive_ptr.h" | 23 #include "../intrusive_ptr.h" |
| 26 #include "../debug.h" | 24 #include "../debug.h" |
| 25 #include "../bindings/runtime.h" |
| 27 | 26 |
| 28 class Filter : public ref_counted | 27 class Filter : public ref_counted |
| 29 { | 28 { |
| 30 protected: | 29 protected: |
| 31 OwnedString mText; | 30 OwnedString mText; |
| 32 | 31 |
| 33 public: | 32 public: |
| 34 enum Type | 33 enum Type |
| 35 { | 34 { |
| 36 UNKNOWN = 0, | 35 UNKNOWN = 0, |
| 37 INVALID = 1, | 36 INVALID = 1, |
| 38 COMMENT = 2, | 37 COMMENT = 2, |
| 39 BLOCKING = 3, | 38 BLOCKING = 3, |
| 40 WHITELIST = 4, | 39 WHITELIST = 4, |
| 41 ELEMHIDE = 5, | 40 ELEMHIDE = 5, |
| 42 ELEMHIDEEXCEPTION = 6, | 41 ELEMHIDEEXCEPTION = 6, |
| 43 ELEMHIDEEMULATION = 7, | 42 ELEMHIDEEMULATION = 7, |
| 44 VALUE_COUNT = 8 | 43 VALUE_COUNT = 8 |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 explicit Filter(Type type, const String& text); | 46 explicit Filter(Type type, const String& text); |
| 48 ~Filter(); | 47 ~Filter(); |
| 49 | 48 |
| 50 Type mType; | 49 Type mType; |
| 51 | 50 |
| 52 EMSCRIPTEN_KEEPALIVE const String& GetText() const | 51 BINDINGS_EXPORTED const String& GetText() const |
| 53 { | 52 { |
| 54 return mText; | 53 return mText; |
| 55 } | 54 } |
| 56 | 55 |
| 57 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; | 56 BINDINGS_EXPORTED OwnedString Serialize() const; |
| 58 | 57 |
| 59 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text); | 58 static BINDINGS_EXPORTED Filter* FromText(DependentString& text); |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 typedef intrusive_ptr<Filter> FilterPtr; | 61 typedef intrusive_ptr<Filter> FilterPtr; |
| LEFT | RIGHT |