Downloader::Options typedef

This commit is contained in:
Veloman Yunkan 2024-02-27 19:09:27 +04:00
parent ff88430227
commit 4ab6215046
2 changed files with 7 additions and 4 deletions

View File

@ -168,7 +168,10 @@ class Download {
*/
class Downloader
{
public:
public: // types
typedef std::vector<std::pair<std::string, std::string>> Options;
public: // functions
Downloader();
virtual ~Downloader();
@ -193,7 +196,7 @@ class Downloader
* @param options: A series of pair <option_name, option_value> to pass to aria.
* @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)
@ -215,7 +218,7 @@ class Downloader
*/
std::vector<std::string> getDownloadIds() const;
private:
private: // data
mutable std::mutex m_lock;
std::map<std::string, std::shared_ptr<Download>> m_knownDownloads;
std::shared_ptr<Aria2> mp_aria;

View File

@ -166,7 +166,7 @@ std::vector<std::string> Downloader::getDownloadIds() const {
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);
for (auto& p: m_knownDownloads) {