Cupt
progress.hpp
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2010 by Eugene V. Lyubimkin *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License *
6 * (version 3 or above) as published by the Free Software Foundation. *
7 * *
8 * This program is distributed in the hope that it will be useful, *
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11 * GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU GPL *
14 * along with this program; if not, write to the *
15 * Free Software Foundation, Inc., *
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
17 **************************************************************************/
18 #ifndef CUPT_DOWNLOAD_PROGRESS_SEEN
19 #define CUPT_DOWNLOAD_PROGRESS_SEEN
20 
22 
23 #include <map>
24 
25 #include <cupt/common.hpp>
26 
27 namespace cupt {
28 
29 namespace internal {
30 
31 class ProgressImpl;
32 
33 }
34 
35 namespace download {
36 
38 class CUPT_API Progress
39 {
40  internal::ProgressImpl* __impl;
41  public:
44  {
45  size_t number;
46  size_t downloadedSize;
47  size_t size;
49  };
50  protected:
55  string getLongAliasForUri(const string& uri) const;
60  string getShortAliasForUri(const string& uri) const;
66  const std::map< string, DownloadRecord >& getDownloadRecords() const;
71  uint64_t getOverallDownloadedSize() const;
79  uint64_t getOverallEstimatedSize() const;
84  uint64_t getOverallFetchedSize() const;
88  size_t getOverallDownloadTime() const;
93  size_t getOverallEstimatedTime() const;
97  size_t getDownloadSpeed() const;
98 
105  virtual void newDownloadHook(const string& uri, const DownloadRecord& downloadRecord);
113  virtual void finishedDownloadHook(const string& uri, const string& result);
124  virtual void updateHook(bool immediate);
128  virtual void finishHook();
129 
130  public:
132  Progress();
133 
135 
139 
141 
145  void setShortAliasForUri(const string& uri, const string& alias);
147 
151  void setLongAliasForUri(const string& uri, const string& alias);
153 
159  void setTotalEstimatedSize(uint64_t size);
160 
162  CUPT_LOCAL void progress(const vector< string >& params);
164 
166  virtual ~Progress();
167 };
168 
169 }
170 }
171 
172 #endif
173