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); |
+} |