LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 #include "../base.h" | 22 #include "../base.h" |
23 #include "Subscription.h" | 23 #include "Subscription.h" |
24 #include "../bindings/runtime.h" | 24 #include "../bindings/runtime.h" |
25 | 25 |
26 ABP_NS_BEGIN | 26 ABP_NS_BEGIN |
27 | 27 |
28 class DownloadableSubscription : public Subscription | 28 class DownloadableSubscription : public Subscription |
29 { | 29 { |
30 public: | 30 public: |
| 31 static constexpr Type classType = Type::DOWNLOADABLE; |
31 explicit DownloadableSubscription(const String& id); | 32 explicit DownloadableSubscription(const String& id); |
32 | 33 |
33 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE, | 34 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE, |
34 GetFixedTitle, SetFixedTitle); | 35 GetFixedTitle, SetFixedTitle); |
35 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE, | 36 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE, |
36 GetHomepage, SetHomepage); | 37 GetHomepage, SetHomepage); |
37 SUBSCRIPTION_PROPERTY(uint64_t, mLastCheck, SUBSCRIPTION_LASTCHECK, | 38 SUBSCRIPTION_PROPERTY(uint64_t, mLastCheck, SUBSCRIPTION_LASTCHECK, |
38 GetLastCheck, SetLastCheck); | 39 GetLastCheck, SetLastCheck); |
39 SUBSCRIPTION_PROPERTY(uint64_t, mHardExpiration, NONE, | 40 SUBSCRIPTION_PROPERTY(uint64_t, mHardExpiration, NONE, |
40 GetHardExpiration, SetHardExpiration); | 41 GetHardExpiration, SetHardExpiration); |
(...skipping 10 matching lines...) Expand all Loading... |
51 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE, | 52 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE, |
52 GetDataRevision, SetDataRevision); | 53 GetDataRevision, SetDataRevision); |
53 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE, | 54 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE, |
54 GetRequiredVersion, SetRequiredVersion); | 55 GetRequiredVersion, SetRequiredVersion); |
55 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE, | 56 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE, |
56 GetDownloadCount, SetDownloadCount); | 57 GetDownloadCount, SetDownloadCount); |
57 | 58 |
58 OwnedString BINDINGS_EXPORTED Serialize() const; | 59 OwnedString BINDINGS_EXPORTED Serialize() const; |
59 }; | 60 }; |
60 | 61 |
61 template<> | 62 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; |
62 inline DownloadableSubscription* Subscription::As<DownloadableSubscription>() | |
63 { | |
64 if (mType != Type::DOWNLOADABLE) | |
65 return nullptr; | |
66 | |
67 return static_cast<DownloadableSubscription*>(this); | |
68 } | |
69 | 63 |
70 ABP_NS_END | 64 ABP_NS_END |
LEFT | RIGHT |