Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: compiled/subscription/Subscription.h

Issue 29606600: Issue 5146 - Implement DownloadableSubscription parsing in C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Fix the UTF-8 encoding used for MD5. Created Dec. 12, 2017, 4:49 a.m.
Right Patch Set: Removed Md5sum and associated code Created Aug. 14, 2018, 12:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/subscription/DownloadableSubscription.cpp ('k') | lib/synchronizer.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 <vector> 20 #include <vector>
21 21
22 #include "../base.h"
22 #include "../filter/Filter.h" 23 #include "../filter/Filter.h"
23 #include "../String.h" 24 #include "../String.h"
24 #include "../FilterNotifier.h" 25 #include "../FilterNotifier.h"
25 #include "../intrusive_ptr.h" 26 #include "../intrusive_ptr.h"
26 #include "../debug.h" 27 #include "../debug.h"
27 #include "../bindings/runtime.h" 28 #include "../bindings/runtime.h"
28 29
29 #define SUBSCRIPTION_PROPERTY_INTERNAL(field_type, param_type, name, topic, gett er, setter) \ 30 #define SUBSCRIPTION_PROPERTY_INTERNAL(field_type, param_type, name, topic, gett er, setter) \
30 private:\ 31 private:\
31 field_type name;\ 32 field_type name;\
32 public:\ 33 public:\
33 param_type BINDINGS_EXPORTED getter() const\ 34 param_type BINDINGS_EXPORTED getter() const\
34 {\ 35 {\
35 return name;\ 36 return name;\
36 }\ 37 }\
37 void BINDINGS_EXPORTED setter(param_type value)\ 38 void BINDINGS_EXPORTED setter(param_type value)\
38 {\ 39 {\
39 if (name != value)\ 40 if (name != value)\
40 {\ 41 {\
41 name = value;\ 42 name = value;\
42 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\ 43 if (ABP_NS::FilterNotifier::Topic::topic != ABP_NS::FilterNotifier::To pic::NONE)\
43 {\ 44 {\
44 FilterNotifier::SubscriptionChange(FilterNotifier::Topic::topic,\ 45 ABP_NS::FilterNotifier::SubscriptionChange(ABP_NS::FilterNotifier::T opic::topic,\
45 *this);\ 46 *this);\
46 }\ 47 }\
47 }\ 48 }\
48 } 49 }
49 50
50 #define SUBSCRIPTION_PROPERTY(type, name, topic, getter, setter) \ 51 #define SUBSCRIPTION_PROPERTY(type, name, topic, getter, setter) \
51 static_assert(std::is_arithmetic<type>::value, "SUBSCRIPTION_PROPERTY macro can only be used with arithmetic types");\ 52 static_assert(std::is_arithmetic<type>::value, "SUBSCRIPTION_PROPERTY macro can only be used with arithmetic types");\
52 SUBSCRIPTION_PROPERTY_INTERNAL(type, type, name, topic, getter, setter) 53 SUBSCRIPTION_PROPERTY_INTERNAL(type, type, name, topic, getter, setter)
53 54
54 #define SUBSCRIPTION_STRING_PROPERTY(name, topic, getter, setter) \ 55 #define SUBSCRIPTION_STRING_PROPERTY(name, topic, getter, setter) \
55 SUBSCRIPTION_PROPERTY_INTERNAL(OwnedString, const String&, name, topic, gett er, setter) 56 SUBSCRIPTION_PROPERTY_INTERNAL(OwnedString, const String&, name, topic, gett er, setter)
57
58 ABP_NS_BEGIN
56 59
57 class Subscription : public ref_counted 60 class Subscription : public ref_counted
58 { 61 {
59 public: 62 public:
60 typedef std::vector<FilterPtr> Filters; 63 typedef std::vector<FilterPtr> Filters;
61 64
62 protected: 65 protected:
63 OwnedString mID; 66 OwnedString mID;
64 Filters mFilters; 67 Filters mFilters;
65 68
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 const T* As() const 124 const T* As() const
122 { 125 {
123 if (mType != T::classType) 126 if (mType != T::classType)
124 return nullptr; 127 return nullptr;
125 128
126 return static_cast<const T*>(this); 129 return static_cast<const T*>(this);
127 } 130 }
128 }; 131 };
129 132
130 typedef intrusive_ptr<Subscription> SubscriptionPtr; 133 typedef intrusive_ptr<Subscription> SubscriptionPtr;
134
135 ABP_NS_END
LEFTRIGHT

Powered by Google App Engine
This is Rietveld