forked from mapsme/omim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_map_files_downloader.hpp
40 lines (34 loc) · 1.44 KB
/
http_map_files_downloader.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include "storage/map_files_downloader.hpp"
#include "platform/http_request.hpp"
#include "base/thread_checker.hpp"
#include "std/unique_ptr.hpp"
namespace storage
{
/// This class encapsulates HTTP requests for receiving server lists
/// and file downloading.
//
// *NOTE*, this class is not thread-safe.
class HttpMapFilesDownloader : public MapFilesDownloader
{
public:
virtual ~HttpMapFilesDownloader();
// MapFilesDownloader overrides:
void GetServersList(int64_t const mapVersion, string const & mapFileName, TServersListCallback const & callback) override;
void DownloadMapFile(vector<string> const & urls, string const & path, int64_t size,
TFileDownloadedCallback const & onDownloaded,
TDownloadingProgressCallback const & onProgress) override;
TProgress GetDownloadingProgress() override;
bool IsIdle() override;
void Reset() override;
private:
void OnServersListDownloaded(TServersListCallback const & callback,
downloader::HttpRequest & request);
void OnMapFileDownloaded(TFileDownloadedCallback const & onDownloaded,
downloader::HttpRequest & request);
void OnMapFileDownloadingProgress(TDownloadingProgressCallback const & onProgress,
downloader::HttpRequest & request);
unique_ptr<downloader::HttpRequest> m_request;
DECLARE_THREAD_CHECKER(m_checker);
};
} // namespace storage