diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
| commit | 048a2cf59737f761876e81a77e8d064c45c752d7 (patch) | |
| tree | 65c9d5498aafe6a8c8e640ddfcc43c7013504d0d /src/FileAllocationEntry.h | |
| parent | e26bbbb9eee140ba24402fe872a752b42f0077de (diff) | |
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented BitTorrent/http/ftp integrated download.
I've rewritten lots of files and now some headers have forward
class declarations to reduce compile time.
The implementation is extremely alpha stage, I recommend to use this
for testing purpose only.
Diffstat (limited to 'src/FileAllocationEntry.h')
| -rw-r--r-- | src/FileAllocationEntry.h | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/FileAllocationEntry.h b/src/FileAllocationEntry.h index 6108f41a..02843c03 100644 --- a/src/FileAllocationEntry.h +++ b/src/FileAllocationEntry.h @@ -37,32 +37,29 @@ #include "RequestGroupEntry.h" -class FileAllocationEntry : public RequestGroupEntry { +class FileAllocationIterator; +extern typedef SharedHandle<FileAllocationIterator> FileAllocationIteratorHandle; +class Command; +extern typedef deque<Command*> Commands; +class DownloadEngine; + +class FileAllocationEntry : public RequestGroupEntry, public ProgressAwareEntry { private: - int64_t _offset; + FileAllocationIteratorHandle _fileAllocationIterator; public: - FileAllocationEntry(int cuid, - const RequestHandle& currentRequest, - RequestGroup* requestGroup, - DownloadCommand* nextDownloadCommand = 0, - int64_t offset = 0): - RequestGroupEntry(cuid, currentRequest, requestGroup, nextDownloadCommand), - _offset(offset) - {} + FileAllocationEntry(RequestGroup* requestGroup, Command* nextCommand = 0); + + ~FileAllocationEntry(); - virtual ~FileAllocationEntry() {} + virtual int64_t getCurrentLength(); - virtual int64_t getCurrentLength() const - { - return _offset; - } + virtual int64_t getTotalLength(); - virtual bool finished() const - { - return _requestGroup->getTotalLength() <= _offset; - } + virtual bool finished(); void allocateChunk(); + + virtual Commands prepareForNextAction(DownloadEngine* e) = 0; }; typedef SharedHandle<FileAllocationEntry> FileAllocationEntryHandle; |
