27 lines
561 B
C++
27 lines
561 B
C++
#pragma once
|
|
|
|
#include "HTTPClient.h"
|
|
#include "IDownloader.h"
|
|
|
|
#include <boost/filesystem.hpp>
|
|
#include <map>
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <iostream>
|
|
|
|
class CachedDownloader : public IDownloader
|
|
{
|
|
public:
|
|
CachedDownloader(const boost::filesystem::path& cacheDir, HTTPClient& httpClient);
|
|
|
|
public:
|
|
boost::filesystem::path download(const std::string& url) override;
|
|
void clearCache();
|
|
|
|
private:
|
|
boost::filesystem::path m_cacheDir;
|
|
std::map<std::string, std::string> m_cache;
|
|
HTTPClient& m_httpClient;
|
|
};
|