2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FCntContentTransferInfo.cpp
19 * @brief This is the implementation file for the %ContentTransferInfo class.
21 * This file contains implementation of the %ContentTransferInfo class.
24 #include <FBaseSysLog.h>
25 #include <FCntContentTransferInfo.h>
27 using namespace Tizen::Base;
28 using namespace Tizen::Base::Utility;
30 namespace Tizen { namespace Content
33 static const int HASH_CODE_INITIAL_VALUE = 17;
34 static const int HASH_CODE_COEFFICIENT_VALUE = 37;
36 ContentTransferInfo::ContentTransferInfo(void)
38 , __requestId(INVALID_REQUEST_ID)
39 , __restRequestId(INVALID_REQUEST_ID)
40 , __status(CONTENT_TRANSFER_STATUS_NONE)
44 , __sourceFileSize(-1)
55 ContentTransferInfo::~ContentTransferInfo(void)
61 ContentTransferInfo::GetUri(void) const
67 ContentTransferInfo::GetRequestId(void) const
73 ContentTransferInfo::GetDestPath(void) const
79 ContentTransferInfo::GetContentTransferStatus(void) const
85 ContentTransferInfo::SetAllInfo(RequestId reqId, const Uri& uri, const String& destPath, const String& sourcePath,
86 int sourceFileSize, ContentTransferStatus status)
90 __destPath = destPath;
91 __sourcePath = sourcePath;
93 __sourceFileSize = sourceFileSize;
97 ContentTransferInfo::SetRestRequestId(RequestId reqId)
99 __restRequestId = reqId;
103 ContentTransferInfo::GetRestRequestId(void) const
105 return __restRequestId;
109 ContentTransferInfo::GetSourceFileSize(void) const
111 return __sourceFileSize;
115 ContentTransferInfo::SetSlotId(int slot)
121 ContentTransferInfo::GetSlotId(void) const
127 ContentTransferInfo::SetTimeout(int sec)
133 ContentTransferInfo::GetTimeout(void) const
140 ContentTransferInfo::SetListener(IContentTransferListener* pListener)
142 __pListener = pListener;
146 ContentTransferInfo::CopyN(void)
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.");
155 pContentTransferInfoCopy->SetAllInfo(__requestId, __uri, __destPath, __sourcePath, __sourceFileSize, __status);
158 return pContentTransferInfoCopy;
162 ContentTransferInfo::SetIsBuffer(bool isBuffer)
164 __isBuffer = isBuffer;
168 ContentTransferInfo::GetIsBuffer(void) const
174 ContentTransferInfo::SetProgressInterval(int intervalValue)
176 __intervalValue = intervalValue;
180 ContentTransferInfo::GetProgressInterval(void) const
182 return __intervalValue;
186 ContentTransferInfo::SetDownloadStatus(ContentTransferStatus status)