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 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 var subscription = new (exports[Subscription_mapping[$2]])($1);\ | 65 var subscription = new (exports[Subscription_mapping[$2]])($1);\ |
66 FilterNotifier.triggerListeners(readString($0), subscription, readSt
ring($3), readString($4));\ | 66 FilterNotifier.triggerListeners(readString($0), subscription, readSt
ring($3), readString($4));\ |
67 }, &action, this, mType, &value, &oldvalue);\ | 67 }, &action, this, mType, &value, &oldvalue);\ |
68 }\ | 68 }\ |
69 } | 69 } |
70 | 70 |
71 class Subscription : public ref_counted | 71 class Subscription : public ref_counted |
72 { | 72 { |
73 protected: | 73 protected: |
74 OwnedString mID; | 74 OwnedString mID; |
75 std::vector<Filter> mFilters; | 75 std::vector<FilterPtr> mFilters; |
76 | 76 |
77 public: | 77 public: |
78 enum Type | 78 enum Type |
79 { | 79 { |
80 UNKNOWN = 0, | 80 UNKNOWN = 0, |
81 DOWNLOADABLE = 1, | 81 DOWNLOADABLE = 1, |
82 USERDEFINED = 2 | 82 USERDEFINED = 2 |
83 }; | 83 }; |
84 | 84 |
85 explicit Subscription(Type type, const String& id); | 85 explicit Subscription(Type type, const String& id); |
86 ~Subscription(); | 86 ~Subscription(); |
87 | 87 |
88 Type mType; | 88 Type mType; |
89 | 89 |
90 EMSCRIPTEN_KEEPALIVE const String& GetID() const | 90 EMSCRIPTEN_KEEPALIVE const String& GetID() const |
91 { | 91 { |
92 return mID; | 92 return mID; |
93 } | 93 } |
94 | 94 |
95 SUBSCRIPTION_STRING_PROPERTY(mTitle, GetTitle, SetTitle); | 95 SUBSCRIPTION_STRING_PROPERTY(mTitle, GetTitle, SetTitle); |
96 SUBSCRIPTION_PROPERTY(bool, mDisabled, GetDisabled, SetDisabled); | 96 SUBSCRIPTION_PROPERTY(bool, mDisabled, GetDisabled, SetDisabled); |
97 | 97 |
| 98 EMSCRIPTEN_KEEPALIVE unsigned GetFilterCount() const |
| 99 { |
| 100 return mFilters.size(); |
| 101 } |
| 102 |
| 103 EMSCRIPTEN_KEEPALIVE Filter* FilterAt(unsigned index); |
| 104 EMSCRIPTEN_KEEPALIVE int IndexOfFilter(Filter* filter); |
98 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; | 105 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; |
99 EMSCRIPTEN_KEEPALIVE OwnedString SerializeFilters() const; | 106 EMSCRIPTEN_KEEPALIVE OwnedString SerializeFilters() const; |
100 | 107 |
101 static EMSCRIPTEN_KEEPALIVE Subscription* FromID(const String& id); | 108 static EMSCRIPTEN_KEEPALIVE Subscription* FromID(const String& id); |
102 }; | 109 }; |
103 | 110 |
104 typedef intrusive_ptr<Subscription> SubscriptionPtr; | 111 typedef intrusive_ptr<Subscription> SubscriptionPtr; |
OLD | NEW |