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

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

Issue 29426559: Issue 5137 - [emscripten] Added basic filter storage implementation (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Fixed some inconsistencies Created May 3, 2017, 8:25 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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 13 matching lines...) Expand all
24 24
25 class UserDefinedSubscription : public Subscription 25 class UserDefinedSubscription : public Subscription
26 { 26 {
27 private: 27 private:
28 int mDefaults; 28 int mDefaults;
29 29
30 public: 30 public:
31 explicit UserDefinedSubscription(const String& id); 31 explicit UserDefinedSubscription(const String& id);
32 EMSCRIPTEN_KEEPALIVE bool IsDefaultFor(const Filter* filter) const; 32 EMSCRIPTEN_KEEPALIVE bool IsDefaultFor(const Filter* filter) const;
33 EMSCRIPTEN_KEEPALIVE void MakeDefaultFor(const Filter* filter); 33 EMSCRIPTEN_KEEPALIVE void MakeDefaultFor(const Filter* filter);
34 EMSCRIPTEN_KEEPALIVE bool IsGeneric() const
35 {
36 return mDefaults == 0;
37 }
34 EMSCRIPTEN_KEEPALIVE void InsertFilterAt(Filter* filter, unsigned pos); 38 EMSCRIPTEN_KEEPALIVE void InsertFilterAt(Filter* filter, unsigned pos);
35 EMSCRIPTEN_KEEPALIVE bool RemoveFilterAt(unsigned pos); 39 EMSCRIPTEN_KEEPALIVE bool RemoveFilterAt(unsigned pos);
36 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; 40 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const;
37 }; 41 };
42
43 template<>
44 inline UserDefinedSubscription* Subscription::As<UserDefinedSubscription>()
45 {
46 if (mType != Type::USERDEFINED)
47 return nullptr;
48
49 return static_cast<UserDefinedSubscription*>(this);
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld