libktorrent  2.2.0
Public Member Functions | List of all members
bt::BEncoder Class Reference

Helper class to b-encode stuff. More...

#include <bencoder.h>

Public Member Functions

 BEncoder (BEncoderOutput *out)
 
 BEncoder (File *fptr)
 
 BEncoder (QIODevice *dev)
 
void beginDict ()
 
void beginList ()
 
void end ()
 
void write (bool val)
 
void write (const QByteArray &data)
 
template<class T >
void write (const QByteArray &key, T val)
 
void write (const Uint8 *data, Uint32 size)
 
void write (float val)
 
void write (Uint32 val)
 
void write (Uint64 val)
 

Detailed Description

Author
Joris Guisson This class b-encodes data. For more details about b-encoding, see the BitTorrent protocol docs. The data gets written to a BEncoderOutput thing.

Definition at line 91 of file bencoder.h.

Constructor & Destructor Documentation

◆ BEncoder() [1/3]

bt::BEncoder::BEncoder ( File fptr)

Constructor, output gets written to a file.

Parameters
fptrThe File to write to

◆ BEncoder() [2/3]

bt::BEncoder::BEncoder ( BEncoderOutput out)

Constructor, output gets written to a BEncoderOutput object.

Parameters
outThe BEncoderOutput

◆ BEncoder() [3/3]

bt::BEncoder::BEncoder ( QIODevice *  dev)

Constructor, output gets written to a QIODevice object.

Parameters
devThe QIODevice

Member Function Documentation

◆ beginDict()

void bt::BEncoder::beginDict ( )

Begin a dictionary.Should have a corresponding end call.

◆ beginList()

void bt::BEncoder::beginList ( )

Begin a list. Should have a corresponding end call.

◆ end()

void bt::BEncoder::end ( )

End a beginDict or beginList call.

◆ write() [1/6]

void bt::BEncoder::write ( bool  val)

Write a boolean (is encoded as an intà

Parameters
val

◆ write() [2/6]

void bt::BEncoder::write ( const QByteArray &  data)

Write a QByteArray

Parameters
data

◆ write() [3/6]

void bt::BEncoder::write ( const Uint8 *  data,
Uint32  size 
)

Write a data array

Parameters
data
sizeof data

◆ write() [4/6]

void bt::BEncoder::write ( float  val)

Write a float

Parameters
val

◆ write() [5/6]

void bt::BEncoder::write ( Uint32  val)

Write an int

Parameters
val

◆ write() [6/6]

void bt::BEncoder::write ( Uint64  val)

Write an int64

Parameters
val

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