summaryrefslogtreecommitdiff
path: root/src/FileEntry.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-06-30 09:52:39 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-06-30 09:52:39 +0000
commite36a3de0f458a9267f4d4907e78e706400b7a18c (patch)
tree2802fa3d5bf59eed3e07368764a18904b11f05ab /src/FileEntry.h
parent50b4cf67e04f4253891c53c1b1b97168fdc1aa76 (diff)
2007-06-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made -S option work with metalink file and provided selective download to metalink. * src/MetalinkEntry.h, src/MetalinkEntry.cc (filename): Removed. (file): New variable. (size): Removed. (operator=): Updated. (getPath): New function. (getLength): New function. (toFileEntry): New function. * src/TorrentRequestInfo.h, src/TorrentRequestInfo.cc (execute): Use toStream. (showFileEntry): Removed. * src/MetalinkRequestInfo.h (targetFiles): New variable. (setTargetFiles): New variable. * src/MetalinkRequestInfo.cc (execute): Added the ability to print file information included in a metalink file. Added selective download mode to metalink. * src/main.cc (showUsage): Updated to denote that -S and --select-file options are applicable to metalink. * src/FileEntry.h (operator=): New function. (getBasename): New function. (getDirname): New function. * src/Util.h, src/Util.cc (toStream): New function. * src/Xml2MetalinkProcessor.cc: Updated. Made aria2 work with metalink with directory structure. * src/File.h, src/File.cc (getBasename): New function. (getDirname): New function. * src/RequestGroup.h, src/RequestGroup.cc (_topDir): New variable. (setTopDir): New function. (initSegmentMan): A directory structure is added to _segmentMan->dir. Rewrote HTTP header parsing with stringstream. * src/HttpConnection.h, src/HttpConnection.cc (HttpRequestEntry): New class. (headerBuf): Removed. (headerBufLength): Removed. (outstandingHttpRequests): Now its element type is HttpRequestEntryHandle. (findEndOfHeader): Removed. (receiveResponse): Rewritten. Updated doc for -j option to notice that it should be used with -i option. * src/main.cc (showUsage) Removed unused classes. * src/RequestInfo.h (FileInfo): Removed. (checksum): Removed. (fileInfo): Removed. (setChecksum): Removed. (getChecksum): Removed. (getFileInfo): Removed. Use ISO units. * src/ConsoleDownloadEngine.cc * src/TorrentConsoleDownloadEngine.cc * src/Util.cc (abbrevSize)
Diffstat (limited to 'src/FileEntry.h')
-rw-r--r--src/FileEntry.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/FileEntry.h b/src/FileEntry.h
index 0113921a..eb162bfe 100644
--- a/src/FileEntry.h
+++ b/src/FileEntry.h
@@ -36,24 +36,49 @@
#define _D_FILE_ENTRY_H_
#include "common.h"
+#include "File.h"
class FileEntry {
private:
string path;
- long long int length;
- long long int offset;
+ int64_t length;
+ int64_t offset;
bool extracted;
bool requested;
public:
+ FileEntry():length(0), offset(0), extracted(false), requested(false) {}
+
FileEntry(const string& path, long long int length, long long int offset);
+ FileEntry& operator=(const FileEntry& entry)
+ {
+ if(this != &entry) {
+ path = entry.path;
+ length = entry.length;
+ offset = entry.offset;
+ extracted = entry.extracted;
+ requested = entry.requested;
+ }
+ return *this;
+ }
+
~FileEntry();
+ string getBasename() const
+ {
+ return File(path).getBasename();
+ }
+
+ string getDirname() const
+ {
+ return File(path).getDirname();
+ }
+
const string& getPath() const { return path; }
void setPath(const string& path) { this->path = path; }
- long long int getLength() const { return length; }
+ int64_t getLength() const { return length; }
void setLength(long long int length) { this->length = length; }