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

Side by Side Diff: compiled/subscription/DownloadableSubscription.h

Issue 29606600: Issue 5146 - Implement DownloadableSubscription parsing in C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 13, 2017, 10:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 "../StringMap.h"
22 #include "Subscription.h" 24 #include "Subscription.h"
23 #include "../bindings/runtime.h" 25 #include "../bindings/runtime.h"
26 #include "../filter/Filter.h"
27
28 class String;
29 class _DownloadableSubscription_Parser;
24 30
25 class DownloadableSubscription : public Subscription 31 class DownloadableSubscription : public Subscription
26 { 32 {
27 public: 33 public:
28 static constexpr Type classType = Type::DOWNLOADABLE; 34 static constexpr Type classType = Type::DOWNLOADABLE;
29 explicit DownloadableSubscription(const String& id); 35 explicit DownloadableSubscription(const String& id);
30 36
31 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE, 37 SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE,
32 GetFixedTitle, SetFixedTitle); 38 GetFixedTitle, SetFixedTitle);
33 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE, 39 SUBSCRIPTION_STRING_PROPERTY(mHomepage, SUBSCRIPTION_HOMEPAGE,
(...skipping 12 matching lines...) Expand all
46 GetLastSuccess, SetLastSuccess); 52 GetLastSuccess, SetLastSuccess);
47 SUBSCRIPTION_PROPERTY(int, mErrorCount, SUBSCRIPTION_ERRORS, 53 SUBSCRIPTION_PROPERTY(int, mErrorCount, SUBSCRIPTION_ERRORS,
48 GetErrorCount, SetErrorCount); 54 GetErrorCount, SetErrorCount);
49 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE, 55 SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE,
50 GetDataRevision, SetDataRevision); 56 GetDataRevision, SetDataRevision);
51 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE, 57 SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE,
52 GetRequiredVersion, SetRequiredVersion); 58 GetRequiredVersion, SetRequiredVersion);
53 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE, 59 SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE,
54 GetDownloadCount, SetDownloadCount); 60 GetDownloadCount, SetDownloadCount);
55 61
62 _DownloadableSubscription_Parser* BINDINGS_EXPORTED ParseDownload();
56 OwnedString BINDINGS_EXPORTED Serialize() const; 63 OwnedString BINDINGS_EXPORTED Serialize() const;
57 }; 64 };
58 65
59 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; 66 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr;
67
68 class _DownloadableSubscription_Parser : public ref_counted
69 {
70 DownloadableSubscriptionPtr mSubscription;
71 Subscription::Filters mFilters;
72 StringMap<OwnedString> mParams;
73 public:
74 _DownloadableSubscription_Parser(DownloadableSubscription& sub);
75 void BINDINGS_EXPORTED Process(DependentString& line);
76 // return the expiration interval.
77 int BINDINGS_EXPORTED Finalize();
78 const String& BINDINGS_EXPORTED GetRedirect() const;
79 const String& BINDINGS_EXPORTED GetHomepage() const;
80 const String& BINDINGS_EXPORTED GetVersion() const;
81 private:
82 static int ParseExpires(const String& expires);
83 };
84
OLDNEW

Powered by Google App Engine
This is Rietveld