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