/* */ #ifndef D_SINGLE_FILE_ALLOCATION_ITERATOR_H #define D_SINGLE_FILE_ALLOCATION_ITERATOR_H #include "FileAllocationIterator.h" namespace aria2 { class BinaryStream; class SingleFileAllocationIterator : public FileAllocationIterator { private: BinaryStream* stream_; int64_t offset_; int64_t totalLength_; unsigned char* buffer_; public: SingleFileAllocationIterator(BinaryStream* stream, int64_t offset, int64_t totalLength); virtual ~SingleFileAllocationIterator(); virtual void allocateChunk() CXX11_OVERRIDE; virtual bool finished() CXX11_OVERRIDE; virtual int64_t getCurrentLength() CXX11_OVERRIDE { return offset_; } virtual int64_t getTotalLength() CXX11_OVERRIDE { return totalLength_; } /** * Must be called only once, before calling allocateChunk() */ void init(); }; } // namespace aria2 #endif // D_SINGLE_FILE_ALLOCATION_ITERATOR_H