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: Fixed some inconsistencies Created May 3, 2017, 8:25 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
@@ -26,12 +26,25 @@ class UserDefinedSubscription : public S
{
private:
int mDefaults;
public:
explicit UserDefinedSubscription(const String& id);
EMSCRIPTEN_KEEPALIVE bool IsDefaultFor(const Filter* filter) const;
EMSCRIPTEN_KEEPALIVE void MakeDefaultFor(const Filter* filter);
+ EMSCRIPTEN_KEEPALIVE bool IsGeneric() const
+ {
+ return mDefaults == 0;
+ }
EMSCRIPTEN_KEEPALIVE void InsertFilterAt(Filter* filter, unsigned pos);
EMSCRIPTEN_KEEPALIVE bool RemoveFilterAt(unsigned pos);
EMSCRIPTEN_KEEPALIVE 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