[content] Change secure log
[platform/framework/native/content.git] / src / FCntContentTransferInfo.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                FCntContentTransferInfo.cpp
19  * @brief               This is the implementation file for the %ContentTransferInfo class.
20  *
21  * This file contains implementation of the %ContentTransferInfo class.
22  */
23
24 #include <FBaseSysLog.h>
25 #include <FCntContentTransferInfo.h>
26
27 using namespace Tizen::Base;
28 using namespace Tizen::Base::Utility;
29
30 namespace Tizen { namespace Content
31 {
32
33 static const int HASH_CODE_INITIAL_VALUE = 17;
34 static const int HASH_CODE_COEFFICIENT_VALUE = 37;
35
36 ContentTransferInfo::ContentTransferInfo(void)
37         : Object()
38         , __requestId(INVALID_REQUEST_ID)
39         , __restRequestId(INVALID_REQUEST_ID)
40         , __status(CONTENT_TRANSFER_STATUS_NONE)
41         , __destPath(L"")
42         , __uri()
43         , __sourcePath(L"")
44         , __sourceFileSize(-1)
45         , __slotId(-1)
46         , __pListener(null)
47         , __timeout(-1)
48         , __isBuffer(false)
49         , __intervalValue(-1)
50         , __pImpl(null)
51 {
52
53 }
54
55 ContentTransferInfo::~ContentTransferInfo(void)
56 {
57
58 }
59
60 Utility::Uri
61 ContentTransferInfo::GetUri(void) const
62 {
63         return __uri;
64 }
65
66 RequestId
67 ContentTransferInfo::GetRequestId(void) const
68 {
69         return __requestId;
70 }
71
72 String
73 ContentTransferInfo::GetDestPath(void) const
74 {
75         return __destPath;
76 }
77
78 ContentTransferStatus
79 ContentTransferInfo::GetContentTransferStatus(void) const
80 {
81         return __status;
82 }
83
84 void
85 ContentTransferInfo::SetAllInfo(RequestId reqId, const Uri& uri, const String& destPath, const String& sourcePath,
86                                                                 int sourceFileSize, ContentTransferStatus status)
87 {
88         __requestId = reqId;
89         __uri = uri;
90         __destPath = destPath;
91         __sourcePath = sourcePath;
92         __status = status;
93         __sourceFileSize = sourceFileSize;
94 }
95
96 void
97 ContentTransferInfo::SetRestRequestId(RequestId reqId)
98 {
99         __restRequestId = reqId;
100 }
101
102 RequestId
103 ContentTransferInfo::GetRestRequestId(void) const
104 {
105         return __restRequestId;
106 }
107
108 int
109 ContentTransferInfo::GetSourceFileSize(void) const
110 {
111         return __sourceFileSize;
112 }
113
114 void
115 ContentTransferInfo::SetSlotId(int slot)
116 {
117         __slotId = slot;
118 }
119
120 int
121 ContentTransferInfo::GetSlotId(void) const
122 {
123         return __slotId;
124 }
125
126 void
127 ContentTransferInfo::SetTimeout(int sec)
128 {
129         __timeout = sec;
130 }
131
132 int
133 ContentTransferInfo::GetTimeout(void) const
134 {
135         return __timeout;
136 }
137
138
139 void
140 ContentTransferInfo::SetListener(IContentTransferListener* pListener)
141 {
142         __pListener = pListener;
143 }
144
145 ContentTransferInfo*
146 ContentTransferInfo::CopyN(void)
147 {
148         ClearLastResult();
149         result r = E_SUCCESS;
150         ContentTransferInfo* pContentTransferInfoCopy = null;
151         pContentTransferInfoCopy = new (std::nothrow) ContentTransferInfo;
152         SysTryCatch(NID_CNT, pContentTransferInfoCopy != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
153                            "[E_OUT_OF_MEMORY] Propagating.");
154
155         pContentTransferInfoCopy->SetAllInfo(__requestId, __uri, __destPath, __sourcePath, __sourceFileSize, __status);
156
157 CATCH:
158         return pContentTransferInfoCopy;
159 }
160
161 void
162 ContentTransferInfo::SetIsBuffer(bool isBuffer)
163 {
164         __isBuffer = isBuffer;
165 }
166
167 bool
168 ContentTransferInfo::GetIsBuffer(void) const
169 {
170         return __isBuffer;
171 }
172
173 void
174 ContentTransferInfo::SetProgressInterval(int intervalValue)
175 {
176         __intervalValue = intervalValue;
177 }
178
179 int
180 ContentTransferInfo::GetProgressInterval(void) const
181 {
182         return __intervalValue;
183 }
184
185 void
186 ContentTransferInfo::SetDownloadStatus(ContentTransferStatus status)
187 {
188         __status = status;
189 }
190 }}