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