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; |
+} |