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

Side by Side 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: Fixed method names according to convention Created March 16, 2017, 6:26 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
« no previous file with comments | « compiled/subscription/DownloadableSubscription.h ('k') | compiled/subscription/Subscription.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "DownloadableSubscription.h"
2
3 DownloadableSubscription::DownloadableSubscription(const String& id)
4 : Subscription(Type::DOWNLOADABLE, id), mFixedTitle(false), mLastCheck(0),
5 mHardExpiration(0), mSoftExpiration(0), mLastDownload(0), mLastSuccess(0),
6 mErrorCount(0), mDataRevision(0), mDownloadCount(0)
7 {
8 SetTitle(id);
9 }
10
11 OwnedString DownloadableSubscription::Serialize() const
12 {
13 OwnedString result(Subscription::Serialize());
14 char buffer[32];
15 if (mFixedTitle)
16 result.append(u"fixedTitle=true\n"_str);
17 if (!mHomepage.empty())
18 {
19 result.append(u"homepage="_str);
20 result.append(mHomepage);
21 result.append(u'\n');
22 }
23 if (mLastCheck)
24 {
25 result.append(u"lastCheck="_str);
26 int len = sprintf(buffer, "%.0f", mLastCheck);
27 result.append(buffer, len);
28 result.append(u'\n');
29 }
30 if (mHardExpiration)
31 {
32 result.append(u"expires="_str);
33 int len = sprintf(buffer, "%.0f", mHardExpiration);
34 result.append(buffer, len);
35 result.append(u'\n');
36 }
37 if (mSoftExpiration)
38 {
39 result.append(u"softExpiration="_str);
40 int len = sprintf(buffer, "%.0f", mSoftExpiration);
41 result.append(buffer, len);
42 result.append(u'\n');
43 }
44 if (mLastDownload)
45 {
46 result.append(u"lastDownload="_str);
47 int len = sprintf(buffer, "%.0f", mLastDownload);
48 result.append(buffer, len);
49 result.append(u'\n');
50 }
51 if (!mDownloadStatus.empty())
52 {
53 result.append(u"downloadStatus="_str);
54 result.append(mDownloadStatus);
55 result.append(u'\n');
56 }
57 if (mLastSuccess)
58 {
59 result.append(u"lastSuccess="_str);
60 int len = sprintf(buffer, "%.0f", mLastSuccess);
61 result.append(buffer, len);
62 result.append(u'\n');
63 }
64 if (mErrorCount)
65 {
66 result.append(u"errors="_str);
67 int len = sprintf(buffer, "%i", mErrorCount);
68 result.append(buffer, len);
69 result.append(u'\n');
70 }
71 if (mDataRevision)
72 {
73 result.append(u"version="_str);
74 int len = sprintf(buffer, "%.0f", mDataRevision);
75 result.append(buffer, len);
76 result.append(u'\n');
77 }
78 if (!mRequiredVersion.empty())
79 {
80 result.append(u"requiredVersion="_str);
81 result.append(mRequiredVersion);
82 result.append(u'\n');
83 }
84 if (mDownloadCount)
85 {
86 result.append(u"downloadCount="_str);
87 int len = sprintf(buffer, "%i", mDownloadCount);
88 result.append(buffer, len);
89 result.append(u'\n');
90 }
91 return result;
92 }
OLDNEW
« 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