update header for Doxygen
[platform/framework/native/content.git] / inc / FCntDownloadRequest.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16 /**
17  * @file                FCntDownloadRequest.h
18  * @brief               This is the header file for the %DownloadRequest class.
19  *
20  * This header file contains the declarations of the %DownloadRequest class.
21  */
22 #ifndef _FCNT_DOWNLOAD_REQUEST_H_
23 #define _FCNT_DOWNLOAD_REQUEST_H_
24
25 #include <FBaseResult.h>
26 #include <FBaseString.h>
27 #include <FBaseColIMap.h>
28 #include <FCntTypes.h>
29
30 namespace Tizen { namespace Content
31 {
32
33 /**
34 * @class    DownloadRequest
35 * @brief    This class provides information of a download request.
36 *
37 * @since 2.0
38 *
39 * @final        This class is not intended for extension.
40 *
41 * The %DownloadRequest class provides information of a download request. It provides the URL of a download request, which is mandatory information. It also provides the destination directory path and the file name. The destination directory path and file name can be set by the SetDirectoryPath() and SetFileName() methods. @n
42 * If the download path is not specified, the data will be downloaded to the default download directory returned by Tizen::System::Environment::GetDefaultDownloadPath().
43 *
44 */
45
46 class _OSP_EXPORT_ DownloadRequest
47         : public Tizen::Base::Object
48 {
49 public:
50         /**
51         * Initializes this instance of %DownloadRequest with the specified URL. @n
52         * The downloaded path is set to a default download directory returned by Tizen::System::Environment::GetDefaultDownloadPath().
53         *
54         * @since 2.0
55         *
56         * @param[in]  url               The URL of the download request
57         */
58         DownloadRequest(const Tizen::Base::String& url);
59
60         /**
61         * Initializes this instance of %DownloadRequest with the specified URL and directory path.
62         *
63         * @since 2.0
64         *
65         * @param[in]  url               The URL of the download request
66         * @param[in]  dirPath   The directory path of the data that will be downloaded
67         */
68         DownloadRequest(const Tizen::Base::String& url, const Tizen::Base::String& dirPath);
69
70         /**
71         * Copying of objects using this copy constructor is allowed.
72         *
73         * @since 2.0
74         *
75         * @param[in]  rhs               An instance of %DownloadRequest to copy
76         */
77         DownloadRequest(const DownloadRequest& rhs);
78
79         /**
80         * This destructor overrides Tizen::Base::Object::~Object().
81         *
82         * @since 2.0
83         */
84         virtual ~DownloadRequest(void);
85
86         /**
87         * Copying of objects using this copy assignment operator is allowed.
88         *
89         * @return               A reference to this instance
90         * @param[in]    rhs             An instance of %DownloadRequest
91         */
92         DownloadRequest& operator =(const DownloadRequest& rhs);
93
94         /**
95          *      Checks whether the specified instance of Tizen::Base::Object is equivalent to the current instance of %DownloadRequest.
96          *
97          *      @since 2.0
98          *
99          *      @return         @c true if the specified instance of Tizen::Base::Object is equivalent to the current instance of %DownloadRequest, @n
100          *              else @c false
101          *      @param[in]      obj The object to compare with the current instance of %DownloadRequest
102          */
103         virtual bool Equals(const Tizen::Base::Object& obj) const;
104
105         /**
106          *      Gets the hash value of the current instance.
107          *
108          *      @since 2.0
109          *
110          *      @return         The hash value of the current instance
111          */
112         virtual int GetHashCode(void) const;
113
114         /**
115         * Sets the directory path of the data that will be downloaded.
116         *
117         * @since 2.0
118         *
119         * @param[in]  dirPath   The directory path
120         */
121         void SetDirectoryPath(const Tizen::Base::String& dirPath); 
122
123         /**
124         * Sets the file name of the data to be downloaded.
125         *
126         * @since 2.0
127         *
128         * @param[in]  fileName  The file name
129         */
130         void SetFileName(const Tizen::Base::String& fileName); 
131
132         /**
133         * Gets the URL of a download request.
134         *
135         * @since 2.0
136         *
137         * @return               The URL of this download request
138         */
139         Tizen::Base::String GetUrl(void) const;
140
141         /**
142         * Gets the directory path of the data that will be downloaded.
143         *
144         * @since 2.0
145         *
146         * @return               The directory path
147         */
148         Tizen::Base::String GetDirectoryPath(void) const;
149
150         /**
151         * Gets the file name of the data to be downloaded.
152         *
153         * @since 2.0
154         *
155         * @return               The file name
156         */
157         Tizen::Base::String GetFileName(void) const;
158
159         /**
160         * Determines whether the system should show the download notification or not. @n
161         * If @c true, the system posts notifications about this download request through the Tizen::Shell::NotificationManager. @n
162         * By default, this value sets to @c true.
163         *
164         * @since 2.1
165         *
166         * @param[in] enable Set to @c true if the system shows a notification for this download request, @n
167         *                                       else @c false
168         * @see Tizen::Shell::NotificationManager
169         */
170         void SetNotification(bool enable);
171
172         /**
173         * Sets extra data that is delivered to the application when the notification message is selected. @n
174         * The extra data will be passed to the application through the
175         * Tizen::App::IAppControlProviderEventListener::OnAppControlRequestReceived() method.
176         *
177         * @since 2.1
178         *
179         * @return An error code
180         * @param[in] pExtraData A pointer to an argument map of the Tizen::Base::String key and the Tizen::Base::String value pair
181         * @exception E_SUCCESS The method is successful.
182         * @exception E_INVALID_ARG Either of the following conditions has occurred:
183         * - The argument is @c null.
184         * - The argument is not a map of the Tizen::Base::String key and the Tizen::Base::String value pair.
185         * @see Tizen::Shell::NotificationManager
186         * @see Tizen::App::IAppControlProviderEventListener::OnAppControlRequestReceived()
187         */
188         result SetNotificationExtraData(const Tizen::Base::Collection::IMap *pExtraData);
189
190         /**
191         * Sets to an allowed network type. @n
192         * By default, all network types are allowed.
193         *
194         * @since 2.1
195         *
196         * @param[in] type The download network type
197         */
198         void SetNetworkType(DownloadNetworkType type);
199
200         /**
201         * Checks whether the system should show a notification for this download request.
202         *
203         * @since 2.1
204         *
205         * @return @c true if the system should show a notification for this download request, @n
206         * else @c false
207         */
208         bool IsNotificationEnabled(void) const;
209
210         /**
211         * Gets extra data that is delivered to the application when the notification message is selected.
212         *
213         * @since 2.1
214         *
215         * @return The extra data map that consists of the Tizen::Base::String key and the Tizen::Base::String value pair
216         */
217         const Tizen::Base::Collection::IMap* GetNotificationExtraData(void) const;
218
219         /**
220         * Gets an allowed network type.
221         *
222         * @since 2.1
223         *
224         * @return The network type
225         */
226         DownloadNetworkType GetNetworkType(void) const;
227
228         /**
229         * Adds an HTTP header field.
230         *
231         * @since 2.1
232         *
233         * @return An error code
234         * @param[in] field The HTTP header field
235         * @param[in] value The value of the header field
236         * @exception E_SUCCESS The method is successful.
237         * @exception E_INVALID_ARG Either the field is empty or it already exists.
238         */
239         result AddRequestHeader(const Tizen::Base::String& field, const Tizen::Base::String& value);
240
241         /**
242         * Sets an HTTP header field.
243         *
244         * @since 2.1
245         *
246         * @return An error code
247         * @param[in] field The HTTP header field
248         * @param[in] value The value of the header field
249         * @exception E_SUCCESS The method is successful.
250         * @exception E_INVALID_ARG Either the field is empty or it does not exist.
251         */
252         result SetRequestHeader(const Tizen::Base::String& field, const Tizen::Base::String& value);
253
254         /**
255         * Removes an HTTP header field.
256         *
257         * @since 2.1
258         *
259         * @return An error code
260         * @param[in] field The HTTP header field
261         * @exception E_SUCCESS The method is successful.
262         * @exception E_INVALID_ARG Either the field is empty or it does not exist.
263         */
264         result RemoveRequestHeader(const Tizen::Base::String& field);
265
266         /**
267         * Gets the value of an HTTP header field.
268         *
269         * @since 2.1
270         *
271         * @return The value of the HTTP header field if successful, @n
272         * else @c null if there is no HTTP header field
273         * @param[in] field The HTTP header field
274         */
275         Tizen::Base::String* GetRequestHeaderN(const Tizen::Base::String& field);
276
277 private:
278         /**
279         * This default constructor is intentionally declared as private so that only the platform can create an instance.
280         */
281         DownloadRequest(void);
282
283         friend class _DownloadRequestImpl;
284         class _DownloadRequestImpl * __pDownloadRequestImpl;
285
286 }; // DownloadRequest
287
288 } } // Tizen::Content
289
290 #endif //_FCNT_DOWNLOAD_MANAGER_H_
291