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

Unified Diff: compiled/subscription/DownloadableSubscription.cpp

Issue 29384812: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 1 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created March 15, 2017, 3:05 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
« no previous file with comments | « compiled/subscription/DownloadableSubscription.h ('k') | compiled/subscription/Subscription.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/subscription/DownloadableSubscription.cpp
===================================================================
new file mode 100644
--- /dev/null
+++ b/compiled/subscription/DownloadableSubscription.cpp
@@ -0,0 +1,92 @@
+#include "DownloadableSubscription.h"
+
+DownloadableSubscription::DownloadableSubscription(const String& id)
+ : Subscription(Type::DOWNLOADABLE, id), mFixedTitle(false), mLastCheck(0),
+ mHardExpiration(0), mSoftExpiration(0), mLastDownload(0), mLastSuccess(0),
+ mErrorCount(0), mDataRevision(0), mDownloadCount(0)
+{
+ SetTitle(id);
+}
+
+OwnedString DownloadableSubscription::Serialize() const
+{
+ OwnedString result(Subscription::Serialize());
+ char buffer[32];
+ if (mFixedTitle)
+ result.append(u"fixedTitle=true\n"_str);
+ if (!mHomepage.empty())
+ {
+ result.append(u"homepage="_str);
+ result.append(mHomepage);
+ result.append(u'\n');
+ }
+ if (mLastCheck)
+ {
+ result.append(u"lastCheck="_str);
+ int len = sprintf(buffer, "%.0f", mLastCheck);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ if (mHardExpiration)
+ {
+ result.append(u"expires="_str);
+ int len = sprintf(buffer, "%.0f", mHardExpiration);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ if (mSoftExpiration)
+ {
+ result.append(u"softExpiration="_str);
+ int len = sprintf(buffer, "%.0f", mSoftExpiration);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ if (mLastDownload)
+ {
+ result.append(u"lastDownload="_str);
+ int len = sprintf(buffer, "%.0f", mLastDownload);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ if (!mDownloadStatus.empty())
+ {
+ result.append(u"downloadStatus="_str);
+ result.append(mDownloadStatus);
+ result.append(u'\n');
+ }
+ if (mLastSuccess)
+ {
+ result.append(u"lastSuccess="_str);
+ int len = sprintf(buffer, "%.0f", mLastSuccess);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ if (mErrorCount)
+ {
+ result.append(u"errors="_str);
+ int len = sprintf(buffer, "%i", mErrorCount);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ if (mDataRevision)
+ {
+ result.append(u"version="_str);
+ int len = sprintf(buffer, "%.0f", mDataRevision);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ if (!mRequiredVersion.empty())
+ {
+ result.append(u"requiredVersion="_str);
+ result.append(mRequiredVersion);
+ result.append(u'\n');
+ }
+ if (mDownloadCount)
+ {
+ result.append(u"downloadCount="_str);
+ int len = sprintf(buffer, "%i", mDownloadCount);
+ result.append(buffer, len);
+ result.append(u'\n');
+ }
+ return result;
+}
« no previous file with comments | « compiled/subscription/DownloadableSubscription.h ('k') | compiled/subscription/Subscription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld