1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef COMMON_DOWNLOADMANAGER_H_
- #define COMMON_DOWNLOADMANAGER_H_
- #include <list>
- typedef void* TaskID;
- #define TaskIDNULL NULL
- enum HttpMethod
- {
- HM_GET = 0,
- HM_POST,
- HM_END,
- };
- struct DownloadProgress
- {
- double fNow;
- double fTotal;
- };
- struct DownloadData{
- void* ptr;
- unsigned int nLen;
- };
- struct TaskInitData
- {
- typedef std::list<std::pair<std::string, std::string>> ParamList;
- std::string strRequestURL;
- std::string strFilename;
- HttpMethod hm;
- std::string strParam;
- //ParamList lsParams;
- };
- struct DownloadManager
- {
- virtual TaskID CreateTask(TaskInitData* pInit) = 0;
- virtual bool StartTask(TaskID taskID) = 0;
- virtual bool StopTask(TaskID taskID) = 0;
- };
- struct ParamConstructor
- {
- virtual void ParamAlloc(
- unsigned int nEvent,
- unsigned int nSubEvent,
- void** param1,
- void** param2
- ) = 0;
- virtual void ParamFree(
- unsigned int nEvent,
- unsigned int nSubEvent,
- void* param1,
- void* param2
- ) = 0;
- };
- #endif // COMMON_DOWNLOADMANAGER_H_
|