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

Side by Side Diff: compiled/subscription/Subscription.h

Issue 29385742: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 2 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Rebased Created April 13, 2017, 1:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/intrusive_ptr.h ('k') | compiled/subscription/Subscription.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 var subscription = new (exports[Subscription_mapping[$2]])($1);\ 77 var subscription = new (exports[Subscription_mapping[$2]])($1);\
78 FilterNotifier.triggerListeners(readString($0), subscription, readSt ring($3), readString($4));\ 78 FilterNotifier.triggerListeners(readString($0), subscription, readSt ring($3), readString($4));\
79 }, &action, this, mType, &value, &oldvalue);\ 79 }, &action, this, mType, &value, &oldvalue);\
80 }\ 80 }\
81 } 81 }
82 82
83 class Subscription : public ref_counted 83 class Subscription : public ref_counted
84 { 84 {
85 protected: 85 protected:
86 OwnedString mID; 86 OwnedString mID;
87 std::vector<Filter> mFilters; 87 std::vector<FilterPtr> mFilters;
88 88
89 public: 89 public:
90 enum Type 90 enum Type
91 { 91 {
92 UNKNOWN = 0, 92 UNKNOWN = 0,
93 DOWNLOADABLE = 1, 93 DOWNLOADABLE = 1,
94 USERDEFINED = 2 94 USERDEFINED = 2
95 }; 95 };
96 96
97 explicit Subscription(Type type, const String& id); 97 explicit Subscription(Type type, const String& id);
98 ~Subscription(); 98 ~Subscription();
99 99
100 Type mType; 100 Type mType;
101 101
102 EMSCRIPTEN_KEEPALIVE const String& GetID() const 102 EMSCRIPTEN_KEEPALIVE const String& GetID() const
103 { 103 {
104 return mID; 104 return mID;
105 } 105 }
106 106
107 SUBSCRIPTION_STRING_PROPERTY(mTitle, GetTitle, SetTitle); 107 SUBSCRIPTION_STRING_PROPERTY(mTitle, GetTitle, SetTitle);
108 SUBSCRIPTION_PROPERTY(bool, mDisabled, GetDisabled, SetDisabled); 108 SUBSCRIPTION_PROPERTY(bool, mDisabled, GetDisabled, SetDisabled);
109 109
110 EMSCRIPTEN_KEEPALIVE unsigned GetFilterCount() const
111 {
112 return mFilters.size();
113 }
114
115 EMSCRIPTEN_KEEPALIVE Filter* FilterAt(unsigned index);
116 EMSCRIPTEN_KEEPALIVE int IndexOfFilter(Filter* filter);
110 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; 117 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const;
111 EMSCRIPTEN_KEEPALIVE OwnedString SerializeFilters() const; 118 EMSCRIPTEN_KEEPALIVE OwnedString SerializeFilters() const;
112 119
113 static EMSCRIPTEN_KEEPALIVE Subscription* FromID(const String& id); 120 static EMSCRIPTEN_KEEPALIVE Subscription* FromID(const String& id);
114 }; 121 };
115 122
116 typedef intrusive_ptr<Subscription> SubscriptionPtr; 123 typedef intrusive_ptr<Subscription> SubscriptionPtr;
OLDNEW
« no previous file with comments | « compiled/intrusive_ptr.h ('k') | compiled/subscription/Subscription.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld