mirror of https://github.com/kiwix/libkiwix.git
Downloader::Options typedef
This commit is contained in:
parent
ff88430227
commit
4ab6215046
|
@ -168,7 +168,10 @@ class Download {
|
||||||
*/
|
*/
|
||||||
class Downloader
|
class Downloader
|
||||||
{
|
{
|
||||||
public:
|
public: // types
|
||||||
|
typedef std::vector<std::pair<std::string, std::string>> Options;
|
||||||
|
|
||||||
|
public: // functions
|
||||||
Downloader();
|
Downloader();
|
||||||
virtual ~Downloader();
|
virtual ~Downloader();
|
||||||
|
|
||||||
|
@ -193,7 +196,7 @@ class Downloader
|
||||||
* @param options: A series of pair <option_name, option_value> to pass to aria.
|
* @param options: A series of pair <option_name, option_value> to pass to aria.
|
||||||
* @return: The newly created Download.
|
* @return: The newly created Download.
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<Download> startDownload(const std::string& uri, const std::vector<std::pair<std::string, std::string>>& options = {});
|
std::shared_ptr<Download> startDownload(const std::string& uri, const Options& options = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a download corrsponding to a download id (did)
|
* Get a download corrsponding to a download id (did)
|
||||||
|
@ -215,7 +218,7 @@ class Downloader
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getDownloadIds() const;
|
std::vector<std::string> getDownloadIds() const;
|
||||||
|
|
||||||
private:
|
private: // data
|
||||||
mutable std::mutex m_lock;
|
mutable std::mutex m_lock;
|
||||||
std::map<std::string, std::shared_ptr<Download>> m_knownDownloads;
|
std::map<std::string, std::shared_ptr<Download>> m_knownDownloads;
|
||||||
std::shared_ptr<Aria2> mp_aria;
|
std::shared_ptr<Aria2> mp_aria;
|
||||||
|
|
|
@ -166,7 +166,7 @@ std::vector<std::string> Downloader::getDownloadIds() const {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Download> Downloader::startDownload(const std::string& uri, const std::vector<std::pair<std::string, std::string>>& options)
|
std::shared_ptr<Download> Downloader::startDownload(const std::string& uri, const Options& options)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_lock);
|
std::unique_lock<std::mutex> lock(m_lock);
|
||||||
for (auto& p: m_knownDownloads) {
|
for (auto& p: m_knownDownloads) {
|
||||||
|
|
Loading…
Reference in New Issue