#include <Torrent.h> [code]
This class is used to store all needed BitTorrent file properties. It provides value semantics (objects copying allowed) and implicit data sharing.
Torrent structure is made according to these specifications: http://wiki.theory.org/BitTorrentSpecification#Metainfo_File_Structure .
Optional tracker announce list is made according to these specifications: http://home.elp.rr.com/tur/multitracker-spec.txt (this is an extention to the official specification, which is also backwards compatible).
Optional field 'private' is made according to these specifications: http://www.azureuswiki.com/index.php/Secure_Torrents (this field is used in practice but it is not part of the official specification).
Information about stored files (info dictionary) abstracts the difference between single and multiple file mode so there is only a list of file information and if a torrent files info is in the multiple file mode then each file is beginning with the directory name so there is no stand-alone directory saved in the Torrent class. However, if every file in the file info structure begins with the same directory (prefix) you can be sure that this is the original directory name specified in the parsed torrent file.
It does not throw its own exceptions and lets any thrown exceptions through to the user. In case an exception (e.g. bad_alloc) gets thrown, the Torrent object will be left in an unchanged state. Thus the class meets the strong guarantee of exception safety.
Torrent objects can currently only be created using TorrentParser which makes sure that only valid Torrent objects are created.
Definition at line 83 of file Torrent.h.
Public Types | |
| typedef QList< QList< Uri > > | AnnounceList |
| List of tiers of announces (URLs of trackers). | |
| typedef FixedSizeByteArray< 20 > | Piece |
| 20-byte SHA1 hash for storing piece hash. | |
| typedef QList< Piece > | PieceList |
| List of hash values of pieces. | |
| typedef FixedSizeByteArray< 20 > | InfoHash |
| 20-byte SHA1 hash for storing the hashed value of the info key. | |
| typedef QList< FileInfo > | FileInfoList |
| List of files information. | |
Public Member Functions | |
| Torrent (const Torrent &) | |
| Copy constructor. | |
| Torrent & | operator= (const Torrent &) |
| Assignment operator. | |
| bool | operator== (const Torrent &) const |
| Equality comparison. | |
| bool | operator!= (const Torrent &) const |
| Inequality comparison. | |
| Torrent () | |
| Default constructor. | |
| ~Torrent () | |
| Destructor. | |
| Uri | announce () const |
| Returns the announce URL of the tracker. | |
| AnnounceList | announceList () const |
| Returns list of announce URLs of trackers. | |
| QDateTime | creationDate () const |
| Returns the creation date of the torrent. | |
| QString | comment () const |
| Returns the torrent comment. | |
| QString | createdBy () const |
| Returns the name/version of the torrent creator. | |
| int | pieceLength () const |
| Returns number of bytes in each piece. | |
| PieceList | pieces () const |
| Returns concatenation of all hash values. | |
| bool | isPrivate () const |
| Returns true if the private (security) flag is set to true. | |
| FileInfoList | files () const |
| Returns list of files information. | |
| InfoHash | infoHash () const |
| Returns the hashed value of the info key. | |
Private Attributes | |
| QSharedDataPointer< PrivateData > | d |
| Private data with implicit sharing. | |
Friends | |
| class | TorrentParser |
Classes | |
| class | FileInfo |
| Information about a single file. More... | |
| struct | PrivateData |
| Stores the private members of Torrent using implicit sharing. More... | |
|
|
List of tiers of announces (URLs of trackers).
|
|
|
List of files information.
|
|
|
20-byte SHA1 hash for storing the hashed value of the info key.
|
|
|
20-byte SHA1 hash for storing piece hash.
|
|
|
List of hash values of pieces.
|
|
|
Copy constructor. Constructs a copy of the other object. Definition at line 126 of file Torrent.cpp. |
|
|
Default constructor. Constructs an empty Torrent object. Definition at line 107 of file Torrent.cpp. |
|
|
Destructor. Destroys a Torrent object. Definition at line 118 of file Torrent.cpp. |
|
|
Returns the announce URL of the tracker.
|
|
|
Returns list of announce URLs of trackers.
|
|
|
Returns the torrent comment.
|
|
|
Returns the name/version of the torrent creator.
|
|
|
Returns the creation date of the torrent.
|
|
|
Returns list of files information.
|
|
|
Returns the hashed value of the info key.
|
|
|
Returns true if the private (security) flag is set to true.
|
|
|
Inequality comparison. Returns true if this Torrent object is not equal to the other object. Definition at line 164 of file Torrent.cpp. |
|
|
Assignment operator. Assigns the other object to this object and returns a reference to this object. Definition at line 136 of file Torrent.cpp. |
|
|
Equality comparison. Returns true if this Torrent object is equal to the other object. Definition at line 146 of file Torrent.cpp. |
|
|
Returns number of bytes in each piece.
|
|
|
Returns concatenation of all hash values.
|
|
|
|
|
|
Private data with implicit sharing.
|