libktorrent  2.1.1
Public Member Functions | Static Public Attributes | List of all members
bt::TorrentFile Class Reference

#include <torrentfile.h>

Inheritance diagram for bt::TorrentFile:
Inheritance graph
[legend]

Public Member Functions

 TorrentFile (const TorrentFile &tf)
 
 TorrentFile (Torrent *tor, Uint32 index, const QString &path, Uint64 off, Uint64 size, Uint64 chunk_size)
 
 TorrentFile (Torrent *tor=0)
 
bool doNotDownload () const override
 Check if this file doesn't have to be downloaded.
 
void emitDownloadStatusChanged () override
 emits signal.
 
Uint64 fileOffset (Uint32 cindex, Uint64 chunk_size) const
 
Uint64 getCacheOffset () const
 Get the offset into the torrent.
 
Uint64 getFirstChunkOffset () const
 Get the offset at which the file starts in the first chunk.
 
Uint64 getLastChunkSize () const
 Get how many bytes the files takes up of the last chunk.
 
Priority getOldPriority () const
 Get the previous priority value.
 
Priority getPriority () const override
 Gets the priority of the file.
 
bool isMissing () const
 See if the file is missing.
 
bool isMultimedia () const override
 Checks if this file is multimedial.
 
TorrentFileoperator= (const TorrentFile &tf)
 
void setDoNotDownload (bool dnd) override
 Set whether we have to not download this file.
 
void setEmitDownloadStatusChanged (bool show) override
 Wheather to emit signal when dl status changes or not.
 
void setMissing (bool m)
 Set the file to be missing or not.
 
void setPriority (Priority newpriority=NORMAL_PRIORITY) override
 Sets the priority of the file.
 
void updateNumDownloadedChunks (ChunkManager &cman)
 
- Public Member Functions inherited from bt::TorrentFileInterface
 TorrentFileInterface (Uint32 index, const QString &path, Uint64 size)
 
void changeTextCodec (QTextCodec *codec)
 Change the text codec.
 
float getDownloadPercentage () const
 Get the % of the file which is downloaded.
 
Uint32 getFirstChunk () const
 Get the index of the first chunk in which this file lies.
 
Uint64 getFirstChunkOffset () const
 Get the offset at which the file starts in the first chunk.
 
Uint32 getIndex () const
 Get the index of the file.
 
Uint32 getLastChunk () const
 Get the last chunk of the file.
 
Uint64 getLastChunkSize () const
 Get how many bytes the files takes up of the last chunk.
 
QString getMountPoint () const
 Get the mount point of the file on disk.
 
QString getPath () const
 Get the path of the file.
 
QString getPathOnDisk () const
 Get the path of a file on disk.
 
Uint64 getSize () const
 Get the size of the file.
 
QString getUserModifiedPath () const
 Get user modified path (if isn't changed, the normal path is returned)
 
bool isAudio () const
 Is this an audio file.
 
bool isNull () const
 See if the TorrentFile is null.
 
bool isPreExistingFile () const
 Did this file exist before the torrent was loaded by KT.
 
bool isPreviewAvailable () const
 See if preview is available.
 
bool isVideo () const
 Is this a video.
 
void setMountPoint (const QString &path)
 Set the mount point.
 
void setPathOnDisk (const QString &p)
 
void setPreExisting (bool pe)
 Set whether this file is preexisting.
 
void setUnencodedPath (const QList< QByteArray > up)
 Set the unencoded path.
 
void setUserModifiedPath (const QString &p)
 Set the user modified path.
 

Static Public Attributes

static TorrentFile null
 

Additional Inherited Members

- Public Types inherited from bt::TorrentFileInterface
enum  FileType { UNKNOWN, AUDIO, VIDEO, NORMAL }
 
- Protected Attributes inherited from bt::TorrentFileInterface
bool emit_status_changed
 
FileType filetype
 
Uint32 first_chunk
 
Uint64 first_chunk_off
 
Uint32 index
 
Uint32 last_chunk
 
Uint64 last_chunk_size
 
QString mount_point
 
Uint32 num_chunks_downloaded
 
QString path
 
QString path_on_disk
 
bool preexisting
 
bool preview
 
Priority priority
 
Uint64 size
 
QList< QByteArray > unencoded_path
 
QString user_modified_path
 

Detailed Description

Author
Joris Guisson

File in a multi file torrent. Keeps track of the path of the file, it's size, offset into the cache and between which chunks it lies.

Definition at line 60 of file torrentfile.h.

Constructor & Destructor Documentation

◆ TorrentFile() [1/3]

bt::TorrentFile::TorrentFile ( Torrent tor = 0)

Default constructor. Creates a null TorrentFile.

◆ TorrentFile() [2/3]

bt::TorrentFile::TorrentFile ( Torrent tor,
Uint32  index,
const QString &  path,
Uint64  off,
Uint64  size,
Uint64  chunk_size 
)

Constructor.

Parameters
indexIndex number of the file
pathPath of the file
offOffset into the torrent (i.e. how many bytes were all the previous files in the torrent combined)
sizeSize of the file
chunk_sizeSize of each chunk

◆ TorrentFile() [3/3]

bt::TorrentFile::TorrentFile ( const TorrentFile tf)

Copy constructor.

Parameters
tfThe TorrentFile to copy

Member Function Documentation

◆ fileOffset()

Uint64 bt::TorrentFile::fileOffset ( Uint32  cindex,
Uint64  chunk_size 
) const

Calculate the offset of a chunk in the file

Parameters
cindexIndex of chunk
chunk_sizeSize of each chunk

◆ operator=()

TorrentFile& bt::TorrentFile::operator= ( const TorrentFile tf)

Assignment operator

Parameters
tfThe file to copy
Returns
*this

◆ updateNumDownloadedChunks()

void bt::TorrentFile::updateNumDownloadedChunks ( ChunkManager cman)

Update the number of downloaded chunks for this file.

Parameters
cmanThe ChunkManager

The documentation for this class was generated from the following file: