Imported version 0.2-1
[mstardict] / src / lib / httpmanager.cpp
1 #include "httpmanager.h"
2
3 HttpManager::HttpManager()
4 {
5 }
6
7 HttpManager::~HttpManager()
8 {
9         for (std::list<HttpClient *>::iterator i = client_list.begin(); i != client_list.end(); ++i) {
10                 delete *i;
11         }
12 }
13
14 void HttpManager::SendHttpGetRequest(const char* shost, const char* sfile, gpointer userdata)
15 {
16         HttpClient *client = new HttpClient();
17         client_list.push_back(client);
18         client->SendHttpGetRequest(shost, sfile, userdata);
19 }
20
21 void HttpManager::SendHttpGetRequestWithCallback(const char* shost, const char* sfile, get_http_response_func_t callback_func, gpointer userdata)
22 {
23         HttpClient *client = new HttpClient();
24         client_list.push_back(client);
25         client->SendHttpGetRequestWithCallback(shost, sfile, callback_func, userdata);
26 }
27
28 void HttpManager::Remove(HttpClient *http_client)
29 {
30         client_list.remove(http_client);
31         delete http_client;
32 }