24 #include <ktorrent_export.h>
25 #include <QSharedDataPointer>
26 #include <util/constants.h>
28 #include <util/signalcatcher.h>
30 #include <diskio/cachefile.h>
48 PieceData(
Chunk* chunk, Uint32 off, Uint32 len, Uint8* ptr, CacheFile::Ptr cache_file,
bool read_only);
55 bool mapped()
const {
return cache_file != 0;}
67 Uint8*
data() {
return ptr;}
70 bool ok()
const {
return ptr != 0;}
87 Uint32
write(
const Uint8* buf, Uint32 buf_size, Uint32 off = 0);
98 Uint32
read(Uint8* buf, Uint32 to_read, Uint32 off = 0);
134 typedef QExplicitlySharedDataPointer<PieceData> Ptr;
137 bool inUse()
const {
return ref > 1;}
140 void unmapped()
override;
147 CacheFile::Ptr cache_file;