Downloader using the libcurl library to download a URL in an extra thread.
More...
#include <Downloader.hpp>
|
| | Downloader (const std::string &url, const std::string &proxy=std::string{}) |
| | Constructor starting to download a URL using a specific proxy server. More...
|
| |
| | ~Downloader () |
| | Destructor. More...
|
| |
|
| bool | isRunning () const noexcept |
| | Returns whether the download is still in progress. More...
|
| |
| std::string | getContent () const |
| | Returns the downloaded content, if successfully downloaded. More...
|
| |
| std::string | getError () const |
| | Returns the download error, if one occured. More...
|
| |
Downloader using the libcurl library to download a URL in an extra thread.
◆ Downloader()
| crawlservpp::Network::Downloader::Downloader |
( |
const std::string & |
url, |
|
|
const std::string & |
proxy = std::string{} |
|
) |
| |
|
inline |
Constructor starting to download a URL using a specific proxy server.
- Parameters
-
| url | The URL to download. |
| proxy | The proxy server used for the download. No specific proxy server is used if the string is empty. |
◆ ~Downloader()
| crawlservpp::Network::Downloader::~Downloader |
( |
| ) |
|
|
inline |
Destructor.
Joins the download with the main thread.
◆ getContent()
| std::string crawlservpp::Network::Downloader::getContent |
( |
| ) |
const |
|
inline |
Returns the downloaded content, if successfully downloaded.
- Note
- This function is thread-safe.
- Returns
- The content of the downloaded file or an empty string, if the download is still in progress or has failed.
- See also
- getError
◆ getError()
| std::string crawlservpp::Network::Downloader::getError |
( |
| ) |
const |
|
inline |
◆ isRunning()
| bool crawlservpp::Network::Downloader::isRunning |
( |
| ) |
const |
|
inlinenoexcept |
Returns whether the download is still in progress.
- Note
- This function is thread-safe.
- Returns
- True, if the download is still in progress. False otherwise.
The documentation for this class was generated from the following file: