|
libktorrent
2.1.1
|
#include <piecedata.h>

Public Types | |
| typedef QExplicitlySharedDataPointer< PieceData > | Ptr |
Public Member Functions | |
| PieceData (Chunk *chunk, Uint32 off, Uint32 len, Uint8 *ptr, CacheFile::Ptr cache_file, bool read_only) | |
| Uint8 * | data () |
| Get a pointer to the data. | |
| SHA1Hash | generateHash () const |
| bool | inUse () const |
| Is the piece in use by somebody else then the cache. | |
| Uint32 | length () const |
| Get the length of the piece. | |
| bool | mapped () const |
| Is it a mapped into memory. | |
| Uint32 | offset () const |
| Get the offset of the piece in the chunk. | |
| bool | ok () const |
| Check if the data pointer is OK. | |
| Chunk * | parentChunk () |
| Get the parent chunk of the piece. | |
| Uint32 | read (Uint8 *buf, Uint32 to_read, Uint32 off=0) |
| Uint32 | readFromFile (File &file, Uint32 size, Uint32 off=0) |
| void | setData (Uint8 *p) |
| Set the data pointer. | |
| void | unload () |
| Unload the piece. | |
| void | updateHash (SHA1HashGen &hg) |
| Uint32 | write (const Uint8 *buf, Uint32 buf_size, Uint32 off=0) |
| bool | writeable () const |
| Is this writeable. | |
| Uint32 | writeToFile (File &file, Uint32 size, Uint32 off=0) |
Class which holds the data of a piece of a chunk. It has a reference counter.
Definition at line 64 of file piecedata.h.
| SHA1Hash bt::PieceData::generateHash | ( | ) | const |
| Uint32 bt::PieceData::read | ( | Uint8 * | buf, |
| Uint32 | to_read, | ||
| Uint32 | off = 0 |
||
| ) |
Read data from the PieceData. This function should always be used for reading from a PieceData object, as it protects against bus errors.
| buf | The buffer to read into |
| to_read | Amount of bytes to read |
| off | Offset in the PieceData to start reading from |
| BusError | When reading results in a SIGBUS |
| Uint32 bt::PieceData::readFromFile | ( | File & | file, |
| Uint32 | size, | ||
| Uint32 | off = 0 |
||
| ) |
| void bt::PieceData::updateHash | ( | SHA1HashGen & | hg | ) |
Update a SHA1HashGen with this PieceData. This function protects against bus errors.
| hg | The SHA1HashGen to update |
| BusError | When reading results in a SIGBUS |
| Uint32 bt::PieceData::write | ( | const Uint8 * | buf, |
| Uint32 | buf_size, | ||
| Uint32 | off = 0 |
||
| ) |
Write data into the PieceData. This function should always be used for writing into a PieceData object, as it protects against bus errors.
| buf | The buffer to write |
| size | Size of the buffer |
| off | Offset to write |
| BusError | When writing results in a SIGBUS |
| Uint32 bt::PieceData::writeToFile | ( | File & | file, |
| Uint32 | size, | ||
| Uint32 | off = 0 |
||
| ) |
1.8.18