Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: compiled/subscription/DownloadableSubscription.h

Issue 29606600: Issue 5146 - Implement DownloadableSubscription parsing in C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created Nov. 13, 2017, 10:25 p.m.
Right Patch Set: Removed Md5sum and associated code Created Aug. 14, 2018, 12:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/storage/FilterStorage.cpp ('k') | compiled/subscription/DownloadableSubscription.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 #include <vector>
22 22
23 #include "../base.h"
24 #include "../bindings/runtime.h"
25 #include "../filter/Filter.h"
23 #include "../StringMap.h" 26 #include "../StringMap.h"
24 #include "Subscription.h" 27 #include "Subscription.h"
25 #include "../bindings/runtime.h" 28
26 #include "../filter/Filter.h" 29 ABP_NS_BEGIN
27 30
28 class String; 31 class String;
29 class _DownloadableSubscription_Parser; 32 class DownloadableSubscription_Parser;
30 33
31 class DownloadableSubscription : public Subscription 34 class DownloadableSubscription : public Subscription
32 { 35 {
33 public: 36 public:
34 static constexpr Type classType = Type::DOWNLOADABLE; 37 static constexpr Type classType = Type::DOWNLOADABLE;
35 explicit DownloadableSubscription(const String& id); 38 explicit DownloadableSubscription(const String& id);
36 39
37 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE, 40 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE,
38 GetFixedTitle, SetFixedTitle); 41 GetFixedTitle, SetFixedTitle);
39 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE, 42 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE,
(...skipping 12 matching lines...) Expand all
52 GetLastSuccess, SetLastSuccess); 55 GetLastSuccess, SetLastSuccess);
53 SUBSCRIPTION_PROPERTY(int, mErrorCount, SUBSCRIPTION_ERRORS, 56 SUBSCRIPTION_PROPERTY(int, mErrorCount, SUBSCRIPTION_ERRORS,
54 GetErrorCount, SetErrorCount); 57 GetErrorCount, SetErrorCount);
55 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE, 58 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE,
56 GetDataRevision, SetDataRevision); 59 GetDataRevision, SetDataRevision);
57 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE, 60 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE,
58 GetRequiredVersion, SetRequiredVersion); 61 GetRequiredVersion, SetRequiredVersion);
59 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE, 62 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE,
60 GetDownloadCount, SetDownloadCount); 63 GetDownloadCount, SetDownloadCount);
61 64
62 _DownloadableSubscription_Parser* BINDINGS_EXPORTED ParseDownload(); 65 static DownloadableSubscription_Parser* BINDINGS_EXPORTED ParseDownload();
63 OwnedString BINDINGS_EXPORTED Serialize() const; 66 OwnedString BINDINGS_EXPORTED Serialize() const;
64 }; 67 };
65 68
66 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; 69 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr;
67 70
68 class _DownloadableSubscription_Parser : public ref_counted 71 class DownloadableSubscription_Parser : public ref_counted
69 { 72 {
70 DownloadableSubscriptionPtr mSubscription; 73 std::vector<OwnedString> mFiltersText;
71 Subscription::Filters mFilters; 74 OwnedStringMap<OwnedString> mParams;
72 StringMap<OwnedString> mParams; 75 bool mFirstLine;
73 public: 76 public:
74 _DownloadableSubscription_Parser(DownloadableSubscription& sub); 77 DownloadableSubscription_Parser();
75 void BINDINGS_EXPORTED Process(DependentString& line); 78 void BINDINGS_EXPORTED Process(const String& line);
76 // return the expiration interval. 79 // return the expiration interval.
77 int BINDINGS_EXPORTED Finalize(); 80 int64_t BINDINGS_EXPORTED Finalize(DownloadableSubscription&);
78 const String& BINDINGS_EXPORTED GetRedirect() const; 81 const String& BINDINGS_EXPORTED GetRedirect() const;
79 const String& BINDINGS_EXPORTED GetHomepage() const; 82 const String& BINDINGS_EXPORTED GetHomepage() const;
80 const String& BINDINGS_EXPORTED GetVersion() const;
81 private: 83 private:
82 static int ParseExpires(const String& expires); 84 static int64_t ParseExpires(const String& expires);
83 }; 85 };
84 86
87 ABP_NS_END
LEFTRIGHT

Powered by Google App Engine
This is Rietveld