21 #ifndef BT_TORRENTFILESTREAM_H
22 #define BT_TORRENTFILESTREAM_H
25 #include <QWeakPointer>
26 #include <QSharedPointer>
27 #include <ktorrent_export.h>
28 #include <util/constants.h>
35 class TorrentInterface;
52 bool open(QIODevice::OpenMode mode)
override;
58 qint64
pos()
const override;
61 qint64
size()
const override;
64 bool seek(qint64 pos)
override;
87 typedef QSharedPointer<TorrentFileStream> Ptr;
88 typedef QWeakPointer<TorrentFileStream> WPtr;
91 qint64 writeData(
const char* data, qint64 len)
override;
92 qint64 readData(
char* data, qint64 maxlen)
override;
93 void emitReadChannelFinished();
105 #endif // BT_TORRENTFILESTREAM_H
Simple implementation of a BitSet.
bool open(QIODevice::OpenMode mode) override
Open the device (only readonly access will be allowed)
bool atEnd() const override
Are we at the end of the file.
qint64 bytesAvailable() const override
How many bytes are there available.
Uint32 currentChunk() const
Get the current chunk relative to the first chunk of the file.
void close() override
Close the device.
QString path() const
Get the path of the file.
const BitSet & chunksBitSet() const
Get a BitSet of all the chunks of this TorrentFileStream.
bool seek(qint64 pos) override
Seek, will fail if attempting to seek to a point which is not downloaded yet.
Controls just about everything.
bool reset() override
Reset the stream.
qint64 size() const override
Get the total size.
bool isSequential() const override
The stream is not sequential.
qint64 pos() const override
Get the current stream position.
Interface for an object which controls one torrent.