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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiled/subscription/DownloadableSubscription.h
===================================================================
--- a/compiled/subscription/DownloadableSubscription.h
+++ b/compiled/subscription/DownloadableSubscription.h
@@ -13,19 +13,25 @@
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstdint>
+#include <vector>
+#include "../StringMap.h"
#include "Subscription.h"
#include "../bindings/runtime.h"
+#include "../filter/Filter.h"
+
+class String;
+class _DownloadableSubscription_Parser;
class DownloadableSubscription : public Subscription
{
public:
static constexpr Type classType = Type::DOWNLOADABLE;
explicit DownloadableSubscription(const String& id);
SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE,
@@ -48,12 +54,31 @@
GetErrorCount, SetErrorCount);
SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE,
GetDataRevision, SetDataRevision);
SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE,
GetRequiredVersion, SetRequiredVersion);
SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE,
GetDownloadCount, SetDownloadCount);
+ _DownloadableSubscription_Parser* BINDINGS_EXPORTED ParseDownload();
OwnedString BINDINGS_EXPORTED Serialize() const;
};
typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr;
+
+class _DownloadableSubscription_Parser : public ref_counted
+{
+ DownloadableSubscriptionPtr mSubscription;
+ Subscription::Filters mFilters;
+ StringMap<OwnedString> mParams;
+public:
+ _DownloadableSubscription_Parser(DownloadableSubscription& sub);
+ void BINDINGS_EXPORTED Process(DependentString& line);
+ // return the expiration interval.
+ int BINDINGS_EXPORTED Finalize();
+ const String& BINDINGS_EXPORTED GetRedirect() const;
+ const String& BINDINGS_EXPORTED GetHomepage() const;
+ const String& BINDINGS_EXPORTED GetVersion() const;
+private:
+ static int ParseExpires(const String& expires);
+};
+

Powered by Google App Engine
This is Rietveld