diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-08-09 09:59:56 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-08-09 09:59:56 +0000 |
| commit | 26690f692b3c242208740b7befade9898fe63e39 (patch) | |
| tree | 28a0c69b87e7fdc35e99fcf0403b4d794364e630 /src/ServerStatMan.cc | |
| parent | 70b457da0192695754fb1e95f3f81a15dbb0fa78 (diff) | |
2008-08-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented ServerStatMan::save(...) function and its test case.
* src/ServerStat.cc
* src/ServerStat.h
* src/ServerStatMan.cc
* src/ServerStatMan.h
* test/ServerStatManTest.cc
Diffstat (limited to 'src/ServerStatMan.cc')
| -rw-r--r-- | src/ServerStatMan.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/ServerStatMan.cc b/src/ServerStatMan.cc index a4719029..bd02bc57 100644 --- a/src/ServerStatMan.cc +++ b/src/ServerStatMan.cc @@ -36,6 +36,7 @@ #include "ServerStat.h" #include <algorithm> #include <ostream> +#include <iterator> namespace aria2 { @@ -70,14 +71,10 @@ bool ServerStatMan::add(const SharedHandle<ServerStat>& serverStat) } } -//bool save(const std::string& filepath) const; - -void ServerStatMan::print(std::ostream& o) const +void ServerStatMan::save(std::ostream& out) const { - for(std::deque<SharedHandle<ServerStat> >::const_iterator i = - _serverStats.begin(); i != _serverStats.end(); ++i) { - o << *i; - } + std::copy(_serverStats.begin(), _serverStats.end(), + std::ostream_iterator<SharedHandle<ServerStat> >(out, "\n")); } } // namespace aria2 |
