| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 "../base.h" |
| 20 #include "Subscription.h" | 21 #include "Subscription.h" |
| 21 #include "../filter/Filter.h" | 22 #include "../filter/Filter.h" |
| 22 #include "../bindings/runtime.h" | 23 #include "../bindings/runtime.h" |
| 23 | 24 |
| 25 ABP_NS_BEGIN |
| 26 |
| 24 class UserDefinedSubscription : public Subscription | 27 class UserDefinedSubscription : public Subscription |
| 25 { | 28 { |
| 26 private: | 29 private: |
| 27 int mDefaults; | 30 int mDefaults; |
| 28 | 31 |
| 29 public: | 32 public: |
| 30 static constexpr Type classType = Type::USERDEFINED; | 33 static constexpr Type classType = Type::USERDEFINED; |
| 31 explicit UserDefinedSubscription(const String& id); | 34 explicit UserDefinedSubscription(const String& id); |
| 32 bool BINDINGS_EXPORTED IsDefaultFor(const Filter& filter) const; | 35 bool BINDINGS_EXPORTED IsDefaultFor(const Filter& filter) const; |
| 33 void BINDINGS_EXPORTED MakeDefaultFor(const Filter& filter); | 36 void BINDINGS_EXPORTED MakeDefaultFor(const Filter& filter); |
| 34 bool BINDINGS_EXPORTED IsGeneric() const | 37 bool BINDINGS_EXPORTED IsGeneric() const |
| 35 { | 38 { |
| 36 return mDefaults == 0; | 39 return mDefaults == 0; |
| 37 } | 40 } |
| 38 void BINDINGS_EXPORTED InsertFilterAt(Filter& filter, unsigned pos); | 41 void BINDINGS_EXPORTED InsertFilterAt(Filter& filter, unsigned pos); |
| 39 bool BINDINGS_EXPORTED RemoveFilterAt(unsigned pos); | 42 bool BINDINGS_EXPORTED RemoveFilterAt(unsigned pos); |
| 40 OwnedString BINDINGS_EXPORTED Serialize() const; | 43 OwnedString BINDINGS_EXPORTED Serialize() const; |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 typedef intrusive_ptr<UserDefinedSubscription> UserDefinedSubscriptionPtr; | 46 typedef intrusive_ptr<UserDefinedSubscription> UserDefinedSubscriptionPtr; |
| 47 |
| 48 ABP_NS_END |
| OLD | NEW |