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

Unified Diff: compiled/subscription/UserDefinedSubscription.h

Issue 29574591: Issue 5258 - Implement Filter::As<>() method to make working with filters easier from C++ code (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Use static classType member Created Oct. 13, 2017, 11:40 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiled/subscription/UserDefinedSubscription.h
===================================================================
--- a/compiled/subscription/UserDefinedSubscription.h
+++ b/compiled/subscription/UserDefinedSubscription.h
@@ -22,28 +22,20 @@
#include "../bindings/runtime.h"
class UserDefinedSubscription : public Subscription
{
private:
int mDefaults;
public:
+ static constexpr Type classType = Type::USERDEFINED;
explicit UserDefinedSubscription(const String& id);
bool BINDINGS_EXPORTED IsDefaultFor(const Filter& filter) const;
void BINDINGS_EXPORTED MakeDefaultFor(const Filter& filter);
bool BINDINGS_EXPORTED IsGeneric() const
{
return mDefaults == 0;
}
void BINDINGS_EXPORTED InsertFilterAt(Filter& filter, unsigned pos);
bool BINDINGS_EXPORTED RemoveFilterAt(unsigned pos);
OwnedString BINDINGS_EXPORTED Serialize() const;
};
-
-template<>
-inline UserDefinedSubscription* Subscription::As<UserDefinedSubscription>()
-{
- if (mType != Type::USERDEFINED)
- return nullptr;
-
- return static_cast<UserDefinedSubscription*>(this);
-}

Powered by Google App Engine
This is Rietveld