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.
19 * @file FCntDownloadRequest.cpp
20 * @brief This is the implementation file for the DownloadRequest class.
24 #include <FBaseSysLog.h>
25 #include <FCntDownloadRequest.h>
26 #include "FCnt_DownloadRequestImpl.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
31 namespace Tizen { namespace Content
34 DownloadRequest::DownloadRequest(void)
35 : __pDownloadRequestImpl(null)
37 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl();
38 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
41 DownloadRequest::DownloadRequest(const String& url)
43 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(url);
44 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
47 DownloadRequest::DownloadRequest(const String& url, const String& dirPath)
49 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(url, dirPath);
50 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
53 DownloadRequest::DownloadRequest(const DownloadRequest& rhs)
55 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(*rhs.__pDownloadRequestImpl);
56 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
59 DownloadRequest::~DownloadRequest(void)
61 delete __pDownloadRequestImpl;
66 DownloadRequest::operator =(const DownloadRequest& rhs)
70 delete __pDownloadRequestImpl;
72 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(*rhs.__pDownloadRequestImpl);
74 SysTryReturn(NID_CNT, __pDownloadRequestImpl != null, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
81 DownloadRequest::Equals(const Object& obj) const
88 const DownloadRequest* pOther = dynamic_cast< const DownloadRequest* >(&obj);
94 return __pDownloadRequestImpl->Equals(*pOther->__pDownloadRequestImpl);
98 DownloadRequest::GetHashCode(void) const
100 return __pDownloadRequestImpl->GetHashCode();
104 DownloadRequest::SetDirectoryPath(const String& dirPath)
106 __pDownloadRequestImpl->SetDirectoryPath(dirPath);
110 DownloadRequest::SetFileName(const String& fileName)
112 __pDownloadRequestImpl->SetFileName(fileName);
116 DownloadRequest::GetUrl(void) const
118 return __pDownloadRequestImpl->GetUrl();
122 DownloadRequest::GetDirectoryPath(void) const
124 return __pDownloadRequestImpl->GetDirectoryPath();
128 DownloadRequest::GetFileName(void) const
130 return __pDownloadRequestImpl->GetFileName();
134 DownloadRequest::SetNotification(bool enable)
136 __pDownloadRequestImpl->SetNotification(enable);
140 DownloadRequest::SetNotificationExtraData(const IMap *pExtraData)
142 SysTryReturnResult(NID_CNT, pExtraData != null, E_INVALID_ARG, "pExtraData is null.");
143 return __pDownloadRequestImpl->SetNotificationExtraData(pExtraData);
147 DownloadRequest::SetNetworkType(DownloadNetworkType type)
149 __pDownloadRequestImpl->SetNetworkType(type);
153 DownloadRequest::IsNotificationEnabled(void) const
155 return __pDownloadRequestImpl->IsNotificationEnabled();
159 DownloadRequest::GetNotificationExtraData(void) const
161 return __pDownloadRequestImpl->GetNotificationExtraData();
165 DownloadRequest::GetNetworkType(void) const
167 return __pDownloadRequestImpl->GetNetworkType();
171 DownloadRequest::AddRequestHeader(const String& field, const String& value)
173 return __pDownloadRequestImpl->AddRequestHeader(field, value);
177 DownloadRequest::SetRequestHeader(const String& field, const String& value)
179 return __pDownloadRequestImpl->SetRequestHeader(field, value);
183 DownloadRequest::RemoveRequestHeader(const String& field)
185 return __pDownloadRequestImpl->RemoveRequestHeader(field);
189 DownloadRequest::GetRequestHeaderN(const String& field)
191 return __pDownloadRequestImpl->GetRequestHeaderN(field);
194 } } // Tizen::Content