/* */ #ifndef _D_FILE_ENTRY_H_ #define _D_FILE_ENTRY_H_ #include "common.h" #include "SharedHandle.h" #include "File.h" #include #include namespace aria2 { class FileEntry { private: std::string path; std::deque _uris; uint64_t length; off_t offset; bool extracted; bool requested; public: FileEntry():length(0), offset(0), extracted(false), requested(false) {} FileEntry(const std::string& path, uint64_t length, off_t offset, const std::deque& uris = std::deque()); ~FileEntry(); FileEntry& operator=(const FileEntry& entry); std::string getBasename() const { return File(path).getBasename(); } std::string getDirname() const { return File(path).getDirname(); } const std::string& getPath() const { return path; } void setPath(const std::string& path) { this->path = path; } uint64_t getLength() const { return length; } void setLength(uint64_t length) { this->length = length; } off_t getOffset() const { return offset; } void setOffset(off_t offset) { this->offset = offset; } bool isExtracted() const { return extracted; } void setExtracted(bool flag) { this->extracted = flag; } bool isRequested() const { return requested; } void setRequested(bool flag) { this->requested = flag; } void setupDir(const std::string& parentDir); const std::deque& getAssociatedUris() const { return _uris; } bool operator<(const FileEntry& fileEntry) const; }; typedef SharedHandle FileEntryHandle; typedef std::deque FileEntries; } #endif // _D_FILE_ENTRY_H_