/usr/include/libktorrent/torrent/torrentfile.h is in libktorrent-dev 1.3.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | /***************************************************************************
* Copyright (C) 2005 by *
* Joris Guisson <joris.guisson@gmail.com> *
* Ivan Vasic <ivasic@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef BTTORRENTFILE_H
#define BTTORRENTFILE_H
#include <qstring.h>
#include <util/constants.h>
#include <interfaces/torrentfileinterface.h>
namespace bt
{
class ChunkManager;
class Torrent;
/**
* @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.
*/
class KTORRENT_EXPORT TorrentFile : public TorrentFileInterface
{
Q_OBJECT
Torrent* tor;
Uint64 cache_offset;
Priority priority;
Priority old_priority;
bool missing;
public:
/**
* Default constructor. Creates a null TorrentFile.
*/
TorrentFile(Torrent* tor = 0);
/**
* Constructor.
* @param index Index number of the file
* @param path Path of the file
* @param off Offset into the torrent
* (i.e. how many bytes were all the previous files in the torrent combined)
* @param size Size of the file
* @param chunk_size Size of each chunk
*/
TorrentFile(Torrent* tor,Uint32 index,const QString & path,Uint64 off,Uint64 size,Uint64 chunk_size);
/**
* Copy constructor.
* @param tf The TorrentFile to copy
*/
TorrentFile(const TorrentFile & tf);
virtual ~TorrentFile();
/// Get the offset into the torrent
Uint64 getCacheOffset() const {return cache_offset;}
/// Get the offset at which the file starts in the first chunk
Uint64 getFirstChunkOffset() const {return first_chunk_off;}
/// Get how many bytes the files takes up of the last chunk
Uint64 getLastChunkSize() const {return last_chunk_size;}
/// Check if this file doesn't have to be downloaded
bool doNotDownload() const {return (priority == EXCLUDED);}
/// Set whether we have to not download this file
void setDoNotDownload(bool dnd);
/// Checks if this file is multimedial
bool isMultimedia() const;
/// Gets the priority of the file
Priority getPriority() const {return priority;}
/// Sets the priority of the file
void setPriority(Priority newpriority = NORMAL_PRIORITY);
/// Get the previous priority value
Priority getOldPriority() const {return old_priority;}
/// emits signal.
void emitDownloadStatusChanged();
void setEmitDownloadStatusChanged(bool show) { emit_status_changed = show; }
/**
* Assignment operator
* @param tf The file to copy
* @return *this
*/
TorrentFile & operator = (const TorrentFile & tf);
/// See if the file is missing
bool isMissing() const {return missing;}
/// Set the file to be missing or not
void setMissing(bool m) {missing = m;}
/**
* Calculate the offset of a chunk in the file
* @param cindex Index of chunk
* @param chunk_size Size of each chunk
*/
Uint64 fileOffset(Uint32 cindex,Uint64 chunk_size) const;
static TorrentFile null;
/**
* Update the number of downloaded chunks for this file.
* @param cman The ChunkManager
*/
void updateNumDownloadedChunks(ChunkManager & cman);
};
}
#endif
|