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

Side by Side Diff: compiled/subscription/UserDefinedSubscription.cpp

Issue 29384812: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 1 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Fixed method names according to convention Created March 16, 2017, 6:26 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/subscription/UserDefinedSubscription.h ('k') | lib/subscriptionClassesNew.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "UserDefinedSubscription.h"
2
3 int UserDefinedSubscription::filterTypeToDefaults[] = {
4 UserDefinedSubscription::Defaults::BLOCKING, // UNKNOWN
5 UserDefinedSubscription::Defaults::BLOCKING, // INVALID
6 UserDefinedSubscription::Defaults::BLOCKING, // COMMENT
7 UserDefinedSubscription::Defaults::BLOCKING, // BLOCKING
8 UserDefinedSubscription::Defaults::WHITELIST, // WHITELIST
9 UserDefinedSubscription::Defaults::ELEMHIDE, // ELEMHIDE
10 UserDefinedSubscription::Defaults::ELEMHIDE, // ELEMHIDEEXCEPTION
11 UserDefinedSubscription::Defaults::ELEMHIDE, // ELEMHIDEEMULATION
12 };
13
14 UserDefinedSubscription::UserDefinedSubscription(const String& id)
15 : Subscription(Type::USERDEFINED, id), mDefaults(0)
16 {
17 }
18
19 bool UserDefinedSubscription::IsDefaultFor(const Filter* filter) const
20 {
21 return mDefaults & filterTypeToDefaults[filter->mType];
22 }
23
24 void UserDefinedSubscription::MakeDefaultFor(const Filter* filter)
25 {
26 mDefaults |= filterTypeToDefaults[filter->mType];
27 }
28
29 OwnedString UserDefinedSubscription::Serialize() const
30 {
31 OwnedString result(Subscription::Serialize());
32 if (mDefaults)
33 {
34 result.append(u"defaults="_str);
35 if (mDefaults & Defaults::BLOCKING)
36 result.append(u" blocking"_str);
37 if (mDefaults & Defaults::WHITELIST)
38 result.append(u" whitelist"_str);
39 if (mDefaults & Defaults::ELEMHIDE)
40 result.append(u" elemhide"_str);
41 result.append(u'\n');
42 }
43 return result;
44 }
OLDNEW
« no previous file with comments | « compiled/subscription/UserDefinedSubscription.h ('k') | lib/subscriptionClassesNew.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld