You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
678 B

#ifndef TILE_DOWNLOADER_H
#define TILE_DOWNLOADER_H TILE_DOWNLOADER_H
#include <list>
#include <string>
#include <curl/curl.h>
#include "tile.h"
struct MemoryStruct {
char *memory;
size_t size;
MemoryStruct();
~MemoryStruct();
int append(void *contents, int len);
static size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp);
};
class TileDownloader{
struct Transfer{
CURL *curl;
Tile *tile;
MemoryStruct chunk;
Transfer(CURL *curl, Tile *tile);
void finish();
};
std::list<Transfer *> transfers;
int still_running;
public:
CURLM *multi_handle;
TileDownloader();
int active();
void queue(Tile *tile);
int work();
};
#endif