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

Unified 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: Rebased, updated copyright year Created Aug. 22, 2017, 11:03 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
@@ -25,12 +25,25 @@ class UserDefinedSubscription : public S
{
private:
int mDefaults;
public:
explicit UserDefinedSubscription(const String& id);
BINDINGS_EXPORTED bool IsDefaultFor(const Filter* filter) const;
BINDINGS_EXPORTED void MakeDefaultFor(const Filter* filter);
+ BINDINGS_EXPORTED bool IsGeneric() const
+ {
+ return mDefaults == 0;
+ }
BINDINGS_EXPORTED void InsertFilterAt(Filter* filter, unsigned pos);
BINDINGS_EXPORTED bool RemoveFilterAt(unsigned pos);
BINDINGS_EXPORTED OwnedString 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