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

Unified Diff: compiled/subscription/DownloadableSubscription.cpp

Issue 29548581: Issue 4128, 5138 - Add Parser and Serializer implemented in C++ Base URL: https://github.com/adblockplus/adblockpluscore.git
Patch Set: rebase Created March 7, 2018, 12:01 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.cpp
diff --git a/compiled/subscription/DownloadableSubscription.cpp b/compiled/subscription/DownloadableSubscription.cpp
index e61b9b62ed03edba1d54729951c63ab59a766097..11a92e74d3199cd5a7a6e4545ef2215224203b71 100644
--- a/compiled/subscription/DownloadableSubscription.cpp
+++ b/compiled/subscription/DownloadableSubscription.cpp
@@ -19,17 +19,30 @@
ABP_NS_USING
-DownloadableSubscription::DownloadableSubscription(const String& id)
- : Subscription(classType, id), mFixedTitle(false), mLastCheck(0),
+DownloadableSubscription::DownloadableSubscription(const String& id, const KeyValues& properties)
+ : Subscription(classType, id, properties), mFixedTitle(false), mLastCheck(0),
mHardExpiration(0), mSoftExpiration(0), mLastDownload(0), mLastSuccess(0),
mErrorCount(0), mDataRevision(0), mDownloadCount(0)
{
- SetTitle(id);
+ const auto* titleProp = findPropertyValue(properties, u"title"_str);
+ SetTitle(titleProp ? *titleProp : id);
+ parseProperty(properties, mFixedTitle, u"fixedTitle"_str);
+ parseProperty(properties, mHomepage, u"homepage"_str);
+ parseProperty(properties, mLastCheck, u"lastCheck"_str);
+ parseProperty(properties, mHardExpiration, u"expires"_str);
+ parseProperty(properties, mSoftExpiration, u"softExpiration"_str);
+ parseProperty(properties, mLastDownload, u"lastDownload"_str);
+ parseProperty(properties, mDownloadStatus, u"downloadStatus"_str);
+ parseProperty(properties, mLastSuccess, u"lastSuccess"_str);
+ parseProperty(properties, mErrorCount, u"errors"_str);
+ parseProperty(properties, mDataRevision, u"version"_str);
+ parseProperty(properties, mRequiredVersion, u"requiredVersion"_str);
+ parseProperty(properties, mDownloadCount, u"downloadCount"_str);
}
-OwnedString DownloadableSubscription::Serialize() const
+OwnedString DownloadableSubscription::SerializeProperties() const
{
- OwnedString result(Subscription::Serialize());
+ OwnedString result(Subscription::DoSerializeProperties());
if (mFixedTitle)
result.append(u"fixedTitle=true\n"_str);
if (!mHomepage.empty())

Powered by Google App Engine
This is Rietveld