summaryrefslogtreecommitdiff
path: root/src/FileEntry.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-22 23:05:06 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-22 23:05:06 +0900
commitf7aeb86ccc321889c0695556448c23715fe3686b (patch)
tree9b80a89bf13e10af41430aa1f85bd6c79d8f0a0f /src/FileEntry.h
parent205afd20fdcf19784546cd49b718a69cb3d03ba2 (diff)
Added --download-result option.
Added --download-result=OPT option. This option changes the way "Download Results" is formatted. If OPT is 'default', print GID, status, average download speed and path/URI. If multiple files are involved, path/URI of first requested file is printed and remaining ones are omitted. If OPT is 'full', print GID, status, average download speed, percentage of progress and path/URI. The percentage of progress and path/URI are printed for each requested file in each row.
Diffstat (limited to 'src/FileEntry.h')
-rw-r--r--src/FileEntry.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/FileEntry.h b/src/FileEntry.h
index f7d23f38..029bd3e1 100644
--- a/src/FileEntry.h
+++ b/src/FileEntry.h
@@ -294,6 +294,14 @@ bool isUriSuppliedForRequsetFileEntry(InputIterator first, InputIterator last)
return false;
}
+// Writes filename to given o. If memory is true, the output is
+// "[MEMORY]" plus the basename of the filename. If there is no
+// FileEntry, writes "n/a" to o.
+void writeFilePath
+(std::ostream& o,
+ const SharedHandle<FileEntry>& entry,
+ bool memory);
+
// Writes first filename to given o. If memory is true, the output is
// "[MEMORY]" plus the basename of the first filename. If there is no
// FileEntry, writes "n/a" to o. If more than 1 FileEntry are in the
@@ -307,20 +315,8 @@ void writeFilePath
if(!e) {
o << "n/a";
} else {
- if(e->getPath().empty()) {
- std::vector<std::string> uris;
- e->getUris(uris);
- if(uris.empty()) {
- o << "n/a";
- } else {
- o << uris.front();
- }
- } else {
- if(memory) {
- o << "[MEMORY]" << File(e->getPath()).getBasename();
- } else {
- o << e->getPath();
- }
+ writeFilePath(o, e, memory);
+ if(!e->getPath().empty()) {
size_t count = countRequestedFileEntry(first, last);
if(count > 1) {
o << " (" << count-1 << "more)";