Cupt
manager.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_MANAGER_SEEN
19#define CUPT_DOWNLOAD_MANAGER_SEEN
20
22
23#include <functional>
24
25#include <cupt/common.hpp>
26#include <cupt/fwd.hpp>
27#include <cupt/download/uri.hpp>
28
29namespace cupt {
30
31namespace internal {
32
33class ManagerImpl;
34
35}
36
37namespace download {
38
40class CUPT_API Manager
41{
42 internal::ManagerImpl* __impl;
43 public:
46 {
48 string shortAlias;
49 string longAlias;
50
52
57 ExtendedUri(const Uri& uri_, const string& shortAlias_, const string& longAlias_)
58 : uri(uri_), shortAlias(shortAlias_), longAlias(longAlias_)
59 {}
60 };
63 {
64 vector< ExtendedUri > extendedUris;
65 string targetPath;
66 size_t size;
68
73 std::function< string () > postAction;
74 bool optional;
75
77 };
78
80
84 Manager(const shared_ptr< const Config >& config, const shared_ptr< Progress >& progress);
87
89
94 string download(const vector< DownloadEntity >& entities);
95};
96
97}
98}
99
100#endif
101
performs downloads
Definition: manager.hpp:41
string download(const vector< DownloadEntity > &entities)
downloads entities in parallel
Manager(const shared_ptr< const Config > &config, const shared_ptr< Progress > &progress)
constructor
uniform resource indentifier, "download path"
Definition: uri.hpp:38
downloadable element
Definition: manager.hpp:63
bool optional
true if failure to download this is not an error
Definition: manager.hpp:74
string targetPath
path where to place downloaded file
Definition: manager.hpp:65
std::function< string() > postAction
post-download callback
Definition: manager.hpp:73
vector< ExtendedUri > extendedUris
list of alternative uris
Definition: manager.hpp:64
size_t size
Definition: manager.hpp:66
uri with aliases
Definition: manager.hpp:46
ExtendedUri(const Uri &uri_, const string &shortAlias_, const string &longAlias_)
trivial constructor
Definition: manager.hpp:57
string shortAlias
short alias
Definition: manager.hpp:48
string longAlias
long alias (full description)
Definition: manager.hpp:49
Uri uri
uri
Definition: manager.hpp:47