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

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

Issue 29613616: Issue 6064 - Put C++ code into a configurable namespace (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git
Left Patch Set: Created Nov. 21, 2017, 1:53 p.m.
Right Patch Set: rebase Created Feb. 6, 2018, 9:54 a.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
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
(...skipping 12 matching lines...) Expand all
23 #include "../bindings/runtime.h" 23 #include "../bindings/runtime.h"
24 24
25 ABP_NS_BEGIN 25 ABP_NS_BEGIN
26 26
27 class UserDefinedSubscription : public Subscription 27 class UserDefinedSubscription : public Subscription
28 { 28 {
29 private: 29 private:
30 int mDefaults; 30 int mDefaults;
31 31
32 public: 32 public:
33 static constexpr Type classType = Type::USERDEFINED;
33 explicit UserDefinedSubscription(const String& id); 34 explicit UserDefinedSubscription(const String& id);
34 bool BINDINGS_EXPORTED IsDefaultFor(const Filter& filter) const; 35 bool BINDINGS_EXPORTED IsDefaultFor(const Filter& filter) const;
35 void BINDINGS_EXPORTED MakeDefaultFor(const Filter& filter); 36 void BINDINGS_EXPORTED MakeDefaultFor(const Filter& filter);
36 bool BINDINGS_EXPORTED IsGeneric() const 37 bool BINDINGS_EXPORTED IsGeneric() const
37 { 38 {
38 return mDefaults == 0; 39 return mDefaults == 0;
39 } 40 }
40 void BINDINGS_EXPORTED InsertFilterAt(Filter& filter, unsigned pos); 41 void BINDINGS_EXPORTED InsertFilterAt(Filter& filter, unsigned pos);
41 bool BINDINGS_EXPORTED RemoveFilterAt(unsigned pos); 42 bool BINDINGS_EXPORTED RemoveFilterAt(unsigned pos);
42 OwnedString BINDINGS_EXPORTED Serialize() const; 43 OwnedString BINDINGS_EXPORTED Serialize() const;
43 }; 44 };
44 45
45 template<> 46 typedef intrusive_ptr<UserDefinedSubscription> UserDefinedSubscriptionPtr;
46 inline UserDefinedSubscription* Subscription::As<UserDefinedSubscription>()
47 {
48 if (mType != Type::USERDEFINED)
49 return nullptr;
50
51 return static_cast<UserDefinedSubscription*>(this);
52 }
53 47
54 ABP_NS_END 48 ABP_NS_END
LEFTRIGHT

Powered by Google App Engine
This is Rietveld