Protocols::BitTorrent::Packets::Piece Class Reference

#include <Piece.h> [code]

Inherits Protocols::BitTorrent::Packets::PacketBase.

Inheritance diagram for Protocols::BitTorrent::Packets::Piece:

Inheritance graph
[legend]
Collaboration diagram for Protocols::BitTorrent::Packets::Piece:

Collaboration graph
[legend]
List of all members.

Detailed Description

Implements the packet Piece.

The Piece packet is used to transmit a piece from a file.

Definition at line 37 of file Piece.h.

Public Member Functions

QString name () const
 Returns the name of the PacketBase type the dynamic object belongs to.
auto_ptr< DataBasecopy () const
 Virtual copy constructor.
 Piece (quint32 pieceIndex=0, quint32 startOffset=0, const QByteArray &pieceBytes=QByteArray())
quint32 pieceIndex () const
 Getter for the packet field pieceIndex.
void setPieceIndex (quint32)
 Setter for the packet field pieceIndex.
quint32 startOffset () const
 Getter for the packet field startOffset.
void setStartOffset (quint32)
 Setter for the packet field startOffset.
QByteArray pieceBytes () const
 Getter for the packet field pieceBytes.
void setPieceBytes (const QByteArray &)
 Setter for the packet field pieceBytes.

Protected Member Functions

void readPayload (BinaryReader &)
 Reads the packet's payload fields.
void writePayload (BinaryWriter &) const
 Writes the packet's payload fields.
 Q_DECLARE_SHARED_DATA (Data)

Classes

class  Data
 Piece packet's private data. More...


Constructor & Destructor Documentation

Piece::Piece quint32  pieceIndex = 0,
quint32  startOffset = 0,
const QByteArray &  pieceBytes = QByteArray()
 

Definition at line 40 of file Piece.cpp.


Member Function Documentation

auto_ptr< DataBase > Piece::copy  )  const [virtual]
 

Virtual copy constructor.

Implements Protocols::BitTorrent::Packets::PacketBase.

Definition at line 34 of file Piece.cpp.

QString Piece::name  )  const [virtual]
 

Returns the name of the PacketBase type the dynamic object belongs to.

Todo:
Better use PacketId (which possibly contains the ProtocolId)?

Implements Protocols::BitTorrent::Packets::PacketBase.

Definition at line 28 of file Piece.cpp.

QByteArray Protocols::BitTorrent::Packets::Piece::pieceBytes  )  const [inline]
 

Getter for the packet field pieceBytes.

Definition at line 96 of file Piece.h.

quint32 Protocols::BitTorrent::Packets::Piece::pieceIndex  )  const [inline]
 

Getter for the packet field pieceIndex.

Definition at line 80 of file Piece.h.

Protocols::BitTorrent::Packets::Piece::Q_DECLARE_SHARED_DATA Data   )  [protected]
 

void Piece::readPayload BinaryReader  )  [protected, virtual]
 

Reads the packet's payload fields.

Implements Protocols::BitTorrent::Packets::PacketBase.

Definition at line 50 of file Piece.cpp.

void Protocols::BitTorrent::Packets::Piece::setPieceBytes const QByteArray &   )  [inline]
 

Setter for the packet field pieceBytes.

Definition at line 100 of file Piece.h.

void Protocols::BitTorrent::Packets::Piece::setPieceIndex quint32   )  [inline]
 

Setter for the packet field pieceIndex.

Definition at line 84 of file Piece.h.

void Protocols::BitTorrent::Packets::Piece::setStartOffset quint32   )  [inline]
 

Setter for the packet field startOffset.

Definition at line 92 of file Piece.h.

quint32 Protocols::BitTorrent::Packets::Piece::startOffset  )  const [inline]
 

Getter for the packet field startOffset.

Definition at line 88 of file Piece.h.

void Piece::writePayload BinaryWriter  )  const [protected, virtual]
 

Writes the packet's payload fields.

Implements Protocols::BitTorrent::Packets::PacketBase.

Definition at line 59 of file Piece.cpp.


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