2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FCntContentTransferInfo.cpp
18 * @brief This is the implementation file for the %ContentTransferInfo class.
20 * This file contains implementation of the %ContentTransferInfo class.
23 #include <FBaseSysLog.h>
24 #include <FCntContentTransferInfo.h>
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Utility;
29 namespace Tizen { namespace Content
32 static const int HASH_CODE_INITIAL_VALUE = 17;
33 static const int HASH_CODE_COEFFICIENT_VALUE = 37;
35 ContentTransferInfo::ContentTransferInfo(void)
37 , __requestId(INVALID_REQUEST_ID)
38 , __restRequestId(INVALID_REQUEST_ID)
39 , __status(CONTENT_TRANSFER_STATUS_NONE)
43 , __sourceFileSize(-1)
54 ContentTransferInfo::~ContentTransferInfo(void)
60 ContentTransferInfo::GetUri(void) const
66 ContentTransferInfo::GetRequestId(void) const
72 ContentTransferInfo::GetDestPath(void) const
78 ContentTransferInfo::GetContentTransferStatus(void) const
84 ContentTransferInfo::SetAllInfo(RequestId reqId, const Uri& uri, const String& destPath, const String& sourcePath,
85 int sourceFileSize, ContentTransferStatus status)
89 __destPath = destPath;
90 __sourcePath = sourcePath;
92 __sourceFileSize = sourceFileSize;
96 ContentTransferInfo::SetRestRequestId(RequestId reqId)
98 __restRequestId = reqId;
102 ContentTransferInfo::GetRestRequestId(void) const
104 return __restRequestId;
108 ContentTransferInfo::GetSourceFileSize(void) const
110 return __sourceFileSize;
114 ContentTransferInfo::SetSlotId(int slot)
120 ContentTransferInfo::GetSlotId(void) const
126 ContentTransferInfo::SetTimeout(int sec)
132 ContentTransferInfo::GetTimeout(void) const
139 ContentTransferInfo::SetListener(IContentTransferListener* pListener)
141 __pListener = pListener;
145 ContentTransferInfo::CopyN(void)
148 result r = E_SUCCESS;
149 ContentTransferInfo* pContentTransferInfoCopy = null;
150 pContentTransferInfoCopy = new (std::nothrow) ContentTransferInfo;
151 SysTryCatch(NID_CNT, pContentTransferInfoCopy != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
152 "[E_OUT_OF_MEMORY] Propagating.");
154 pContentTransferInfoCopy->SetAllInfo(__requestId, __uri, __destPath, __sourcePath, __sourceFileSize, __status);
157 return pContentTransferInfoCopy;
161 ContentTransferInfo::SetIsBuffer(bool isBuffer)
163 __isBuffer = isBuffer;
167 ContentTransferInfo::GetIsBuffer(void) const
173 ContentTransferInfo::SetProgressInterval(int intervalValue)
175 __intervalValue = intervalValue;
179 ContentTransferInfo::GetProgressInterval(void) const
181 return __intervalValue;
185 ContentTransferInfo::SetDownloadStatus(ContentTransferStatus status)