| Index: compiled/subscription/Subscription.h | 
| =================================================================== | 
| new file mode 100644 | 
| --- /dev/null | 
| +++ b/compiled/subscription/Subscription.h | 
| @@ -0,0 +1,87 @@ | 
| +#pragma once | 
| + | 
| +#include <vector> | 
| + | 
| +#include "../filter/Filter.h" | 
| +#include "../String.h" | 
| +#include "../intrusive_ptr.h" | 
| +#include "../debug.h" | 
| + | 
| +#define SUBSCRIPTION_PROPERTY(type, name, getter, setter) \ | 
| +    private:\ | 
| +      type name;\ | 
| +    public:\ | 
| +      type EMSCRIPTEN_KEEPALIVE getter() const\ | 
| +      {\ | 
| +        return name;\ | 
| +      }\ | 
| +      void EMSCRIPTEN_KEEPALIVE setter(type value)\ | 
| +      {\ | 
| +        if (name != value)\ | 
| +        {\ | 
| +          type oldvalue = name;\ | 
| +          name = value;\ | 
| +          DependentString action(u"subscription."_str #name);\ | 
| +          EM_ASM_ARGS({\ | 
| +            var subscription = new (exports[Subscription_mapping[$2]])($1);\ | 
| +            FilterNotifier.triggerListeners(readString($0), subscription, $3, $4);\ | 
| +          }, &action, this, mType, value, oldvalue);\ | 
| +        }\ | 
| +      } | 
| + | 
| +#define SUBSCRIPTION_STRING_PROPERTY(name, getter, setter) \ | 
| +    private:\ | 
| +      OwnedString name;\ | 
| +    public:\ | 
| +      const String& EMSCRIPTEN_KEEPALIVE getter() const\ | 
| +      {\ | 
| +        return name;\ | 
| +      }\ | 
| +      void EMSCRIPTEN_KEEPALIVE setter(const String& value)\ | 
| +      {\ | 
| +        if (!name.equals(value))\ | 
| +        {\ | 
| +          OwnedString oldvalue(name);\ | 
| +          name = value;\ | 
| +          DependentString action(u"subscription."_str #name);\ | 
| +          EM_ASM_ARGS({\ | 
| +            var subscription = new (exports[Subscription_mapping[$2]])($1);\ | 
| +            FilterNotifier.triggerListeners(readString($0), subscription, readString($3), readString($4));\ | 
| +          }, &action, this, mType, &value, &oldvalue);\ | 
| +        }\ | 
| +      } | 
| + | 
| +class Subscription : public ref_counted | 
| +{ | 
| +protected: | 
| +  OwnedString mID; | 
| +  std::vector<Filter> mFilters; | 
| + | 
| +public: | 
| +  enum Type | 
| +  { | 
| +    UNKNOWN = 0, | 
| +    DOWNLOADABLE = 1, | 
| +    USERDEFINED = 2 | 
| +  }; | 
| + | 
| +  explicit Subscription(Type type, const String& id); | 
| +  ~Subscription(); | 
| + | 
| +  Type mType; | 
| + | 
| +  EMSCRIPTEN_KEEPALIVE const String& GetID() const | 
| +  { | 
| +    return mID; | 
| +  } | 
| + | 
| +  SUBSCRIPTION_STRING_PROPERTY(mTitle, GetTitle, SetTitle); | 
| +  SUBSCRIPTION_PROPERTY(bool, mDisabled, GetDisabled, SetDisabled); | 
| + | 
| +  EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; | 
| +  EMSCRIPTEN_KEEPALIVE OwnedString SerializeFilters() const; | 
| + | 
| +  static EMSCRIPTEN_KEEPALIVE Subscription* FromID(const String& id); | 
| +}; | 
| + | 
| +typedef intrusive_ptr<Subscription> SubscriptionPtr; | 
|  |