Protocols::BitTorrent::Packets::BitField Class Reference

#include <BitField.h> [code]

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

Inheritance diagram for Protocols::BitTorrent::Packets::BitField:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Implements the packet BitField.

The BitField packet is only ever sent as the first message. Its payload is a bitfield with where each bit indicates where the corresponding piece is available (bit is 1) or is missing (bit is 0).

Todo:
Use a bitfield class instead of QByteArray for the field bitField.

Definition at line 41 of file BitField.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.
 BitField (const QByteArray &bitField=QByteArray())
QByteArray bitField () const
 Getter for the packet field bitField.
void setBitField (const QByteArray &)
 Setter for the packet field bitField.

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
 BitField packet's private data. More...


Constructor & Destructor Documentation

BitField::BitField const QByteArray &  bitField = QByteArray()  ) 
 

Definition at line 40 of file BitField.cpp.


Member Function Documentation

QByteArray Protocols::BitTorrent::Packets::BitField::bitField  )  const [inline]
 

Getter for the packet field bitField.

Definition at line 76 of file BitField.h.

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

Virtual copy constructor.

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

Definition at line 34 of file BitField.cpp.

QString BitField::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 BitField.cpp.

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

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

Reads the packet's payload fields.

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

Definition at line 48 of file BitField.cpp.

void Protocols::BitTorrent::Packets::BitField::setBitField const QByteArray &   )  [inline]
 

Setter for the packet field bitField.

Definition at line 80 of file BitField.h.

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

Writes the packet's payload fields.

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

Definition at line 55 of file BitField.cpp.


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