OLD | NEW |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #pragma once | 18 #pragma once |
19 | 19 |
20 #include <cstdint> | 20 #include <cstdint> |
| 21 #include <vector> |
21 | 22 |
| 23 #include "../bindings/runtime.h" |
| 24 #include "../filter/Filter.h" |
| 25 #include "../Md5.h" |
| 26 #include "../StringMap.h" |
22 #include "Subscription.h" | 27 #include "Subscription.h" |
23 #include "../bindings/runtime.h" | 28 |
| 29 class String; |
| 30 class DownloadableSubscription_Parser; |
24 | 31 |
25 class DownloadableSubscription : public Subscription | 32 class DownloadableSubscription : public Subscription |
26 { | 33 { |
27 public: | 34 public: |
28 static constexpr Type classType = Type::DOWNLOADABLE; | 35 static constexpr Type classType = Type::DOWNLOADABLE; |
29 explicit DownloadableSubscription(const String& id); | 36 explicit DownloadableSubscription(const String& id); |
30 | 37 |
31 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE, | 38 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE, |
32 GetFixedTitle, SetFixedTitle); | 39 GetFixedTitle, SetFixedTitle); |
33 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE, | 40 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE, |
(...skipping 12 matching lines...) Expand all Loading... |
46 GetLastSuccess, SetLastSuccess); | 53 GetLastSuccess, SetLastSuccess); |
47 SUBSCRIPTION_PROPERTY(int, mErrorCount, SUBSCRIPTION_ERRORS, | 54 SUBSCRIPTION_PROPERTY(int, mErrorCount, SUBSCRIPTION_ERRORS, |
48 GetErrorCount, SetErrorCount); | 55 GetErrorCount, SetErrorCount); |
49 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE, | 56 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE, |
50 GetDataRevision, SetDataRevision); | 57 GetDataRevision, SetDataRevision); |
51 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE, | 58 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE, |
52 GetRequiredVersion, SetRequiredVersion); | 59 GetRequiredVersion, SetRequiredVersion); |
53 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE, | 60 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE, |
54 GetDownloadCount, SetDownloadCount); | 61 GetDownloadCount, SetDownloadCount); |
55 | 62 |
| 63 DownloadableSubscription_Parser* BINDINGS_EXPORTED ParseDownload(); |
56 OwnedString BINDINGS_EXPORTED Serialize() const; | 64 OwnedString BINDINGS_EXPORTED Serialize() const; |
57 }; | 65 }; |
58 | 66 |
59 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; | 67 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; |
| 68 |
| 69 class DownloadableSubscription_Parser : public ref_counted |
| 70 { |
| 71 DownloadableSubscriptionPtr mSubscription; |
| 72 std::vector<DependentString> mFiltersText; |
| 73 StringMap<OwnedString> mParams; |
| 74 bool mFirstLine; |
| 75 public: |
| 76 DownloadableSubscription_Parser(DownloadableSubscription& sub); |
| 77 void BINDINGS_EXPORTED Process(const String& line); |
| 78 // return the expiration interval. |
| 79 int BINDINGS_EXPORTED Finalize(); |
| 80 const String& BINDINGS_EXPORTED GetRedirect() const; |
| 81 const String& BINDINGS_EXPORTED GetHomepage() const; |
| 82 const String& BINDINGS_EXPORTED GetVersion() const; |
| 83 private: |
| 84 MD5 mChecksum; |
| 85 static int ParseExpires(const String& expires); |
| 86 }; |
| 87 |
OLD | NEW |