| 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   explicit UserDefinedSubscription(const String& id); | 33   explicit UserDefinedSubscription(const String& id); | 
| 31   bool BINDINGS_EXPORTED IsDefaultFor(const Filter& filter) const; | 34   bool BINDINGS_EXPORTED IsDefaultFor(const Filter& filter) const; | 
| 32   void BINDINGS_EXPORTED MakeDefaultFor(const Filter& filter); | 35   void BINDINGS_EXPORTED MakeDefaultFor(const Filter& filter); | 
| 33   bool BINDINGS_EXPORTED IsGeneric() const | 36   bool BINDINGS_EXPORTED IsGeneric() const | 
| 34   { | 37   { | 
| 35     return mDefaults == 0; | 38     return mDefaults == 0; | 
| 36   } | 39   } | 
| 37   void BINDINGS_EXPORTED InsertFilterAt(Filter& filter, unsigned pos); | 40   void BINDINGS_EXPORTED InsertFilterAt(Filter& filter, unsigned pos); | 
| 38   bool BINDINGS_EXPORTED RemoveFilterAt(unsigned pos); | 41   bool BINDINGS_EXPORTED RemoveFilterAt(unsigned pos); | 
| 39   OwnedString BINDINGS_EXPORTED Serialize() const; | 42   OwnedString BINDINGS_EXPORTED Serialize() const; | 
| 40 }; | 43 }; | 
| 41 | 44 | 
| 42 template<> | 45 template<> | 
| 43 inline UserDefinedSubscription* Subscription::As<UserDefinedSubscription>() | 46 inline UserDefinedSubscription* Subscription::As<UserDefinedSubscription>() | 
| 44 { | 47 { | 
| 45   if (mType != Type::USERDEFINED) | 48   if (mType != Type::USERDEFINED) | 
| 46     return nullptr; | 49     return nullptr; | 
| 47 | 50 | 
| 48   return static_cast<UserDefinedSubscription*>(this); | 51   return static_cast<UserDefinedSubscription*>(this); | 
| 49 } | 52 } | 
|  | 53 | 
|  | 54 ABP_NS_END | 
| OLD | NEW | 
|---|