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.
18 * @file FCntDownloadRequest.cpp
19 * @brief This is the implementation file for the DownloadRequest class.
23 #include <FBaseSysLog.h>
24 #include <FCntDownloadRequest.h>
25 #include "FCnt_DownloadRequestImpl.h"
27 using namespace Tizen::Base;
28 using namespace Tizen::Base::Collection;
30 namespace Tizen { namespace Content
33 DownloadRequest::DownloadRequest(void)
34 : __pDownloadRequestImpl(null)
36 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl();
37 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
40 DownloadRequest::DownloadRequest(const String& url)
42 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(url);
43 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
46 DownloadRequest::DownloadRequest(const String& url, const String& dirPath)
48 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(url, dirPath);
49 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
52 DownloadRequest::DownloadRequest(const DownloadRequest& rhs)
54 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(*rhs.__pDownloadRequestImpl);
55 SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
58 DownloadRequest::~DownloadRequest(void)
60 delete __pDownloadRequestImpl;
65 DownloadRequest::operator =(const DownloadRequest& rhs)
69 delete __pDownloadRequestImpl;
71 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(*rhs.__pDownloadRequestImpl);
73 SysTryReturn(NID_CNT, __pDownloadRequestImpl != null, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
80 DownloadRequest::Equals(const Object& obj) const
87 const DownloadRequest* pOther = dynamic_cast< const DownloadRequest* >(&obj);
93 return __pDownloadRequestImpl->Equals(*pOther->__pDownloadRequestImpl);
97 DownloadRequest::GetHashCode(void) const
99 return __pDownloadRequestImpl->GetHashCode();
103 DownloadRequest::SetDirectoryPath(const String& dirPath)
105 __pDownloadRequestImpl->SetDirectoryPath(dirPath);
109 DownloadRequest::SetFileName(const String& fileName)
111 __pDownloadRequestImpl->SetFileName(fileName);
115 DownloadRequest::GetUrl(void) const
117 return __pDownloadRequestImpl->GetUrl();
121 DownloadRequest::GetDirectoryPath(void) const
123 return __pDownloadRequestImpl->GetDirectoryPath();
127 DownloadRequest::GetFileName(void) const
129 return __pDownloadRequestImpl->GetFileName();
133 DownloadRequest::SetNotification(bool enable)
135 __pDownloadRequestImpl->SetNotification(enable);
139 DownloadRequest::SetNotificationExtraData(const IMap *pExtraData)
141 SysTryReturnResult(NID_CNT, pExtraData != null, E_INVALID_ARG, "pExtraData is null.");
142 return __pDownloadRequestImpl->SetNotificationExtraData(pExtraData);
146 DownloadRequest::SetNetworkType(DownloadNetworkType type)
148 __pDownloadRequestImpl->SetNetworkType(type);
152 DownloadRequest::IsNotificationEnabled(void) const
154 return __pDownloadRequestImpl->IsNotificationEnabled();
158 DownloadRequest::GetNotificationExtraData(void) const
160 return __pDownloadRequestImpl->GetNotificationExtraData();
164 DownloadRequest::GetNetworkType(void) const
166 return __pDownloadRequestImpl->GetNetworkType();
170 DownloadRequest::AddRequestHeader(const String& field, const String& value)
172 return __pDownloadRequestImpl->AddRequestHeader(field, value);
176 DownloadRequest::SetRequestHeader(const String& field, const String& value)
178 return __pDownloadRequestImpl->SetRequestHeader(field, value);
182 DownloadRequest::RemoveRequestHeader(const String& field)
184 return __pDownloadRequestImpl->RemoveRequestHeader(field);
188 DownloadRequest::GetRequestHeaderN(const String& field)
190 return __pDownloadRequestImpl->GetRequestHeaderN(field);
193 } } // Tizen::Content