[content] Change sort mode
[platform/framework/native/content.git] / src / FCnt_ContentDownloadUserData.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                FCnt_ContentDownloadUserData.cpp
18  * @brief               This is the implementation file for the %_ContentDownloadUserData class.
19  *
20  * This file contains implementation of the %_ContentDownloadUserData class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FCntTypes.h>
25 #include "FCnt_ContentDownloadUserData.h"
26
27 using namespace Tizen;
28 using namespace Tizen::Base;
29
30 namespace Tizen { namespace Content
31 {
32
33 _ContentDownloadUserData::_ContentDownloadUserData(void)
34         : __reqId(INVALID_REQUEST_ID)
35         , __contentId(UuId::GetInvalidUuId())
36         , __slot(-1)
37         , __downloadCount(-1)
38         , __maxDownloadCount(-1)
39         , __percent(-1)
40         , __totalSize(-1)
41         , __prevDownloadData(0)
42         , __isBuffer(false)
43         , __slotFlag(false)
44         , __pCheckDownloading(null)
45         , __pContentTransferEvent(null)
46         , __pContentTransferInfo(null)
47         , __url(L"")
48         , __destPath(L"")
49 {
50 }
51
52 _ContentDownloadUserData::~_ContentDownloadUserData(void)
53 {
54
55 }
56
57 RequestId
58 _ContentDownloadUserData::GetRequestId(void) const
59 {
60         return __reqId;
61 }
62
63 ContentId
64 _ContentDownloadUserData::GetContentId(void) const
65 {
66         return __contentId;
67 }
68
69 String
70 _ContentDownloadUserData::GetUrl(void) const
71 {
72         return __url;
73 }
74
75 String
76 _ContentDownloadUserData::GetDestPath(void) const
77 {
78         return __destPath;
79 }
80
81 bool
82 _ContentDownloadUserData::GetDownloadBufferFlag(void) const
83 {
84         return __isBuffer;
85 }
86
87 bool
88 _ContentDownloadUserData::GetSlotFlag(void) const
89 {
90         return __slotFlag;
91 }
92
93 int
94 _ContentDownloadUserData::GetSlot(void) const
95 {
96         return __slot;
97 }
98
99 int
100 _ContentDownloadUserData::GetDownloadCount(void) const
101 {
102         return __downloadCount;
103 }
104
105 int
106 _ContentDownloadUserData::GetPercent(void) const
107 {
108         return __percent;
109 }
110
111 _ContentTransferEvent*
112 _ContentDownloadUserData::GetContentTransferEvent(void) const
113 {
114         return __pContentTransferEvent;
115 }
116
117 ContentTransferInfo*
118 _ContentDownloadUserData::GetContentTransferInfo(void) const
119 {
120         return __pContentTransferInfo;
121 }
122
123 bool
124 _ContentDownloadUserData::GetCheckDownloading(int slot) const
125 {
126         return (__pCheckDownloading.get())[slot];
127 }
128
129 long long
130 _ContentDownloadUserData::GetTotalSize(void) const
131 {
132         return __totalSize;
133 }
134
135 long long
136 _ContentDownloadUserData::GetPrevData(void) const
137 {
138         return __prevDownloadData;
139 }
140
141 void
142 _ContentDownloadUserData::SetRequestId(RequestId reqId)
143 {
144         __reqId = reqId;
145 }
146
147 void
148 _ContentDownloadUserData::SetContentId(const ContentId& contentId)
149 {
150         __contentId = contentId;
151 }
152
153 void
154 _ContentDownloadUserData::SetUrl(String& url)
155 {
156         __url = url;
157 }
158
159 void
160 _ContentDownloadUserData::SetDestPath(String& destPath)
161 {
162         __destPath = destPath;
163 }
164
165 void
166 _ContentDownloadUserData::SetDownloadBufferFlag(bool isBuffer)
167 {
168         __isBuffer = isBuffer;
169 }
170
171 void
172 _ContentDownloadUserData::SetSlotFlag(bool slotFlag)
173 {
174         __slotFlag = slotFlag;
175 }
176
177 void
178 _ContentDownloadUserData::SetSlot(int slot)
179 {
180         __slot = slot;
181 }
182
183 void
184 _ContentDownloadUserData::SetDownloadCount(int downloadCount)
185 {
186         __downloadCount = downloadCount;
187 }
188
189 void
190 _ContentDownloadUserData::SetMaxCount(int maxDownloadCount)
191 {
192         __maxDownloadCount = maxDownloadCount;
193         std::unique_ptr<bool[]> pCheckDownloading(new (std::nothrow) bool[__maxDownloadCount]);
194         SysTryLog(NID_CNT, pCheckDownloading != null, "[E_OUT_OF_MEMORY] Failed to construct bool on SetMaxCount().");
195
196         __pCheckDownloading = std::move(pCheckDownloading);
197 }
198
199 void
200 _ContentDownloadUserData::SetPercent(int percent)
201 {
202         __percent = percent;
203 }
204
205 void
206 _ContentDownloadUserData::SetContentTransferEvent(_ContentTransferEvent* transferEvent)
207 {
208         __pContentTransferEvent = transferEvent;
209 }
210
211 void
212 _ContentDownloadUserData::SetContentTransferInfo(ContentTransferInfo* transferInfo)
213 {
214         __pContentTransferInfo = transferInfo;
215 }
216
217 void
218 _ContentDownloadUserData::SetCheckDownloading(int slot, bool check)
219 {
220         (__pCheckDownloading.get())[slot] = check;
221 }
222
223 void
224 _ContentDownloadUserData::SetTotalSize(long long totalSize)
225 {
226         __totalSize = totalSize;
227 }
228
229 void
230 _ContentDownloadUserData::SetPrevData(long long data)
231 {
232         __prevDownloadData = data;
233 }
234
235 }}