[content] Change secure log
[platform/framework/native/content.git] / src / FCntDownloadRequest.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 /**
19  * @file        FCntDownloadRequest.cpp
20  * @brief       This is the implementation file for the DownloadRequest class.
21  *
22  */
23
24 #include <FBaseSysLog.h>
25 #include <FCntDownloadRequest.h>
26 #include "FCnt_DownloadRequestImpl.h"
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30
31 namespace Tizen { namespace Content
32 {
33
34 DownloadRequest::DownloadRequest(void)
35         : __pDownloadRequestImpl(null)
36 {
37         __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl();
38         SysTryReturnVoidResult(NID_CNT, __pDownloadRequestImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
39 }
40
41 DownloadRequest::DownloadRequest(const String& url)
42 {
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.");
45 }
46
47 DownloadRequest::DownloadRequest(const String& url, const String& dirPath)
48 {
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.");
51 }
52
53 DownloadRequest::DownloadRequest(const DownloadRequest& rhs)
54 {
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.");
57 }
58
59 DownloadRequest::~DownloadRequest(void)
60 {
61         delete __pDownloadRequestImpl;
62 }
63
64
65 DownloadRequest&
66 DownloadRequest::operator =(const DownloadRequest& rhs)
67 {
68         if (&rhs != this)
69         {
70                 delete __pDownloadRequestImpl;
71
72                 __pDownloadRequestImpl = new (std::nothrow) _DownloadRequestImpl(*rhs.__pDownloadRequestImpl);
73
74                 SysTryReturn(NID_CNT, __pDownloadRequestImpl != null, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
75         }
76
77         return *this;
78 }
79
80 bool
81 DownloadRequest::Equals(const Object& obj) const
82 {
83         if (&obj == this)
84         {
85                 return true;
86         }
87
88         const DownloadRequest* pOther = dynamic_cast< const DownloadRequest* >(&obj);
89         if (pOther == null)
90         {
91                 return false;
92         }
93
94         return __pDownloadRequestImpl->Equals(*pOther->__pDownloadRequestImpl);
95 }
96
97 int
98 DownloadRequest::GetHashCode(void) const
99 {
100         return __pDownloadRequestImpl->GetHashCode();
101 }
102
103 void
104 DownloadRequest::SetDirectoryPath(const String& dirPath)
105 {
106         __pDownloadRequestImpl->SetDirectoryPath(dirPath);
107 }
108
109 void
110 DownloadRequest::SetFileName(const String& fileName)
111 {
112         __pDownloadRequestImpl->SetFileName(fileName);
113 }
114
115 String
116 DownloadRequest::GetUrl(void) const
117 {
118         return __pDownloadRequestImpl->GetUrl();
119 }
120
121 String
122 DownloadRequest::GetDirectoryPath(void) const
123 {
124         return __pDownloadRequestImpl->GetDirectoryPath();
125 }
126
127 String
128 DownloadRequest::GetFileName(void) const
129 {
130         return __pDownloadRequestImpl->GetFileName();
131 }
132
133 void
134 DownloadRequest::SetNotification(bool enable)
135 {
136         __pDownloadRequestImpl->SetNotification(enable);
137 }
138
139 result
140 DownloadRequest::SetNotificationExtraData(const IMap *pExtraData)
141 {
142         SysTryReturnResult(NID_CNT, pExtraData != null, E_INVALID_ARG, "pExtraData is null.");
143         return __pDownloadRequestImpl->SetNotificationExtraData(pExtraData);
144 }
145
146 void
147 DownloadRequest::SetNetworkType(DownloadNetworkType type)
148 {
149         __pDownloadRequestImpl->SetNetworkType(type);
150 }
151
152 bool
153 DownloadRequest::IsNotificationEnabled(void) const
154 {
155         return __pDownloadRequestImpl->IsNotificationEnabled();
156 }
157
158 const IMap*
159 DownloadRequest::GetNotificationExtraData(void) const
160 {
161         return __pDownloadRequestImpl->GetNotificationExtraData();
162 }
163
164 DownloadNetworkType
165 DownloadRequest::GetNetworkType(void) const
166 {
167         return __pDownloadRequestImpl->GetNetworkType();
168 }
169
170 result
171 DownloadRequest::AddRequestHeader(const String& field, const String& value)
172 {
173         return __pDownloadRequestImpl->AddRequestHeader(field, value);
174 }
175
176 result
177 DownloadRequest::SetRequestHeader(const String& field, const String& value)
178 {
179         return __pDownloadRequestImpl->SetRequestHeader(field, value);
180 }
181
182 result
183 DownloadRequest::RemoveRequestHeader(const String& field)
184 {
185         return __pDownloadRequestImpl->RemoveRequestHeader(field);
186 }
187
188 String*
189 DownloadRequest::GetRequestHeaderN(const String& field)
190 {
191         return __pDownloadRequestImpl->GetRequestHeaderN(field);
192 }
193
194 } } // Tizen::Content