diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-06 19:26:30 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-06 19:26:30 +0900 |
| commit | f83b0fcfa38cf80b15b275d48c131fa691d3006b (patch) | |
| tree | 464a9467114deb7dd3382ff92f1db6183ecd50bc /src/Context.cc | |
| parent | 162c138362955eede9ca8ec2e4b5e804688eda32 (diff) | |
Refactor MultiUrlRequestInfo ctor
StatCalc creation is moved to MultiUrlRequestInfo. The summary output
is done only when PREF_QUIET is false and it is always to
global::cout(), so remove summaryOut_ and just use global::cout() in
that case. Also use std::unique_ptr for statCalc_ in DownloadEngine.
Diffstat (limited to 'src/Context.cc')
| -rw-r--r-- | src/Context.cc | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/src/Context.cc b/src/Context.cc index bef22e54..1d1bb315 100644 --- a/src/Context.cc +++ b/src/Context.cc @@ -57,8 +57,6 @@ #include "Platform.h" #include "FileEntry.h" #include "RequestGroup.h" -#include "ConsoleStatCalc.h" -#include "NullStatCalc.h" #include "download_helper.h" #include "Exception.h" #include "ProtocolDetector.h" @@ -66,7 +64,6 @@ #include "SocketCore.h" #include "DownloadContext.h" #include "fmt.h" -#include "NullOutputFile.h" #include "console.h" #include "UriListParser.h" #ifdef ENABLE_BITTORRENT @@ -85,31 +82,6 @@ extern int optind, opterr, optopt; namespace aria2 { -std::shared_ptr<StatCalc> getStatCalc(const std::shared_ptr<Option>& op) -{ - std::shared_ptr<StatCalc> statCalc; - if(op->getAsBool(PREF_QUIET)) { - statCalc.reset(new NullStatCalc()); - } else { - std::shared_ptr<ConsoleStatCalc> impl - (new ConsoleStatCalc(op->getAsInt(PREF_SUMMARY_INTERVAL), - op->getAsBool(PREF_HUMAN_READABLE))); - impl->setReadoutVisibility(op->getAsBool(PREF_SHOW_CONSOLE_READOUT)); - impl->setTruncate(op->getAsBool(PREF_TRUNCATE_CONSOLE_READOUT)); - statCalc = impl; - } - return statCalc; -} - -std::shared_ptr<OutputFile> getSummaryOut(const std::shared_ptr<Option>& op) -{ - if(op->getAsBool(PREF_QUIET)) { - return std::shared_ptr<OutputFile>(new NullOutputFile()); - } else { - return global::cout(); - } -} - #ifdef ENABLE_BITTORRENT namespace { void showTorrentFile(const std::string& uri) @@ -281,8 +253,7 @@ Context::Context(bool standalone, global::cout()->printf("%s\n", MSG_NO_FILES_TO_DOWNLOAD); } else { reqinfo.reset(new MultiUrlRequestInfo(std::move(requestGroups), - op, getStatCalc(op), - getSummaryOut(op), + op, uriListParser)); } } |
