Mercurial > projects > hoofbaby
comparison deps/Platinum/Source/Core/PltDownloader.h @ 0:3425707ddbf6
Initial import (hopefully this mercurial stuff works...)
author | fraserofthenight |
---|---|
date | Mon, 06 Jul 2009 08:06:28 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3425707ddbf6 |
---|---|
1 /***************************************************************** | |
2 | | |
3 || | |
4 | Copyright (c) 2004-2008, Plutinosoft, LLC. | |
5 | All rights reserved. | |
6 | http://www.plutinosoft.com | |
7 | | |
8 | This program is free software; you can redistribute it and/or | |
9 | modify it under the terms of the GNU General Public License | |
10 | as published by the Free Software Foundation; either version 2 | |
11 | of the License, or (at your option) any later version. | |
12 | | |
13 | OEMs, ISVs, VARs and other distributors that combine and | |
14 | distribute commercially licensed software with Platinum software | |
15 | and do not wish to distribute the source code for the commercially | |
16 | licensed software under version 2, or (at your option) any later | |
17 | version, of the GNU General Public License (the "GPL") must enter | |
18 | into a commercial license agreement with Plutinosoft, LLC. | |
19 | | |
20 | This program is distributed in the hope that it will be useful, | |
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | GNU General Public License for more details. | |
24 | | |
25 | You should have received a copy of the GNU General Public License | |
26 | along with this program; see the file LICENSE.txt. If not, write to | |
27 | the Free Software Foundation, Inc., | |
28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
29 | http://www.gnu.org/licenses/gpl-2.0.html | |
30 | | |
31 ****************************************************************/ | |
32 | |
33 #ifndef _PLT_DOWNLOADER_H_ | |
34 #define _PLT_DOWNLOADER_H_ | |
35 | |
36 /*---------------------------------------------------------------------- | |
37 | Includes | |
38 +---------------------------------------------------------------------*/ | |
39 #include "Neptune.h" | |
40 #include "PltHttpClientTask.h" | |
41 | |
42 /*---------------------------------------------------------------------- | |
43 | forward declarations | |
44 +---------------------------------------------------------------------*/ | |
45 class PLT_Downloader; | |
46 | |
47 /*---------------------------------------------------------------------- | |
48 | types | |
49 +---------------------------------------------------------------------*/ | |
50 typedef PLT_HttpClientTask<PLT_Downloader> PLT_HttpDownloadTask; | |
51 | |
52 typedef enum { | |
53 PLT_DOWNLOADER_IDLE, | |
54 PLT_DOWNLOADER_STARTED, | |
55 PLT_DOWNLOADER_DOWNLOADING, | |
56 PLT_DOWNLOADER_ERROR, | |
57 PLT_DOWNLOADER_SUCCESS | |
58 } Plt_DowloaderState; | |
59 | |
60 /*---------------------------------------------------------------------- | |
61 | PLT_Downloader class | |
62 +---------------------------------------------------------------------*/ | |
63 class PLT_Downloader | |
64 { | |
65 public: | |
66 PLT_Downloader(PLT_TaskManager* task_manager, | |
67 const char* url, | |
68 NPT_OutputStreamReference& output); | |
69 virtual ~PLT_Downloader(); | |
70 | |
71 NPT_Result Start(); | |
72 NPT_Result Stop(); | |
73 Plt_DowloaderState GetState() { return m_State; } | |
74 | |
75 // PLT_HttpClientTask method | |
76 NPT_Result ProcessResponse(NPT_Result res, | |
77 NPT_HttpRequest* request, | |
78 const NPT_HttpRequestContext& context, | |
79 NPT_HttpResponse* response); | |
80 | |
81 | |
82 private: | |
83 // members | |
84 NPT_String m_URL; | |
85 NPT_OutputStreamReference m_Output; | |
86 PLT_TaskManager* m_TaskManager; | |
87 PLT_HttpDownloadTask* m_Task; | |
88 Plt_DowloaderState m_State; | |
89 }; | |
90 | |
91 #endif /* _PLT_DOWNLOADER_H_ */ |