Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUPT_DOWNLOAD_PROGRESS_SEEN
00019 #define CUPT_DOWNLOAD_PROGRESS_SEEN
00020
00022
00023 #include <map>
00024
00025 #include <cupt/common.hpp>
00026
00027 namespace cupt {
00028
00029 namespace internal {
00030
00031 class ProgressImpl;
00032
00033 }
00034
00035 namespace download {
00036
00038 class CUPT_API Progress
00039 {
00040 internal::ProgressImpl* __impl;
00041 public:
00043 struct DownloadRecord
00044 {
00045 size_t number;
00046 size_t downloadedSize;
00047 size_t size;
00048 bool beingPostprocessed;
00049 };
00050 protected:
00055 string getLongAliasForUri(const string& uri) const;
00060 string getShortAliasForUri(const string& uri) const;
00066 const std::map< string, DownloadRecord >& getDownloadRecords() const;
00071 uint64_t getOverallDownloadedSize() const;
00079 uint64_t getOverallEstimatedSize() const;
00084 uint64_t getOverallFetchedSize() const;
00088 size_t getOverallDownloadTime() const;
00093 size_t getOverallEstimatedTime() const;
00097 size_t getDownloadSpeed() const;
00098
00105 virtual void newDownloadHook(const string& uri, const DownloadRecord& downloadRecord);
00113 virtual void finishedDownloadHook(const string& uri, const string& result);
00124 virtual void updateHook(bool immediate);
00128 virtual void finishHook();
00129
00130 public:
00132 Progress();
00133
00135
00138 static float speedCalculatingAccuracy;
00139
00141
00145 void setShortAliasForUri(const string& uri, const string& alias);
00147
00151 void setLongAliasForUri(const string& uri, const string& alias);
00153
00159 void setTotalEstimatedSize(uint64_t size);
00160
00162 CUPT_LOCAL void progress(const vector< string >& params);
00164
00166 virtual ~Progress();
00167 };
00168
00169 }
00170 }
00171
00172 #endif
00173