download progress meter More...
#include <cupt/download/progress.hpp>
Classes | |
| struct | DownloadRecord |
| download element More... | |
Public Member Functions | |
| Progress () | |
| constructor | |
| void | setShortAliasForUri (const string &uri, const string &alias) |
| sets a short alias for URI | |
| void | setLongAliasForUri (const string &uri, const string &alias) |
| sets a long alias for URI | |
| void | setTotalEstimatedSize (uint64_t size) |
| sets total download size for the all download progress lifetime | |
| virtual | ~Progress () |
Static Public Attributes | |
| static float | speedCalculatingAccuracy |
| amount of seconds considered while calculating a download speed | |
Protected Member Functions | |
| string | getLongAliasForUri (const string &uri) const |
| string | getShortAliasForUri (const string &uri) const |
| const std::map< string, DownloadRecord > & | getDownloadRecords () const |
| uint64_t | getOverallDownloadedSize () const |
| uint64_t | getOverallEstimatedSize () const |
| uint64_t | getOverallFetchedSize () const |
| size_t | getOverallDownloadTime () const |
| size_t | getOverallEstimatedTime () const |
| size_t | getDownloadSpeed () const |
| virtual void | newDownloadHook (const string &uri, const DownloadRecord &downloadRecord) |
| virtual void | finishedDownloadHook (const string &uri, const string &result) |
| virtual void | updateHook (bool immediate) |
| virtual void | finishHook () |
download progress meter
| virtual cupt::download::Progress::~Progress | ( | ) | [virtual] |
destructor
| virtual void cupt::download::Progress::finishedDownloadHook | ( | const string & | uri, |
| const string & | result | ||
| ) | [protected, virtual] |
This hook is called when some download is finished.
| uri | |
| result | download exit code, empty string is success, non-empty string is human-readable download error message |
Reimplemented in cupt::download::ConsoleProgress.
| virtual void cupt::download::Progress::finishHook | ( | ) | [protected, virtual] |
This hook is called before the end of the download session.
Reimplemented in cupt::download::ConsoleProgress.
| const std::map< string, DownloadRecord >& cupt::download::Progress::getDownloadRecords | ( | ) | const [protected] |
Gets current downloads.
| size_t cupt::download::Progress::getDownloadSpeed | ( | ) | const [protected] |
| string cupt::download::Progress::getLongAliasForUri | ( | const string & | uri | ) | const [protected] |
| uri |
| uint64_t cupt::download::Progress::getOverallDownloadedSize | ( | ) | const [protected] |
| size_t cupt::download::Progress::getOverallDownloadTime | ( | ) | const [protected] |
| uint64_t cupt::download::Progress::getOverallEstimatedSize | ( | ) | const [protected] |
Overall estimated size is guaranteed to be not less than getOverallDownloadedSize.
| size_t cupt::download::Progress::getOverallEstimatedTime | ( | ) | const [protected] |
| uint64_t cupt::download::Progress::getOverallFetchedSize | ( | ) | const [protected] |
| string cupt::download::Progress::getShortAliasForUri | ( | const string & | uri | ) | const [protected] |
| uri |
| virtual void cupt::download::Progress::newDownloadHook | ( | const string & | uri, |
| const DownloadRecord & | downloadRecord | ||
| ) | [protected, virtual] |
This hook is called when new download starts.
| uri | |
| downloadRecord |
Reimplemented in cupt::download::ConsoleProgress.
| void cupt::download::Progress::setLongAliasForUri | ( | const string & | uri, |
| const string & | alias | ||
| ) |
sets a long alias for URI
| uri | |
| alias | long alias |
| void cupt::download::Progress::setShortAliasForUri | ( | const string & | uri, |
| const string & | alias | ||
| ) |
sets a short alias for URI
| uri | |
| alias | short alias |
| void cupt::download::Progress::setTotalEstimatedSize | ( | uint64_t | size | ) |
sets total download size for the all download progress lifetime
This method should be called if this amount is known beforehand to get better overall progress indication.
| size | number of bytes |
| virtual void cupt::download::Progress::updateHook | ( | bool | immediate | ) | [protected, virtual] |
This hook is called whenever some download information is updated (including being called after newDownloadHook and finishedDownloadHook).
| immediate | is update important or not; examples of important updates: new download, finished download, changes of a download state; examples of unimportant updates: number of download bytes changes for some download |
Reimplemented in cupt::download::ConsoleProgress.
float cupt::download::Progress::speedCalculatingAccuracy [static] |
amount of seconds considered while calculating a download speed
Default: 16
1.7.6.1