cpp-bencoding
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
bencoding::Encoder Class Reference

Data encoder. More...

#include <Encoder.h>

Inheritance diagram for bencoding::Encoder:
bencoding::BItemVisitor

Public Member Functions

std::string encode (std::shared_ptr< BItem > data)
 Encodes the given data and returns them. More...
 

Static Public Member Functions

static std::unique_ptr< Encodercreate ()
 Creates a new encoder. More...
 

Private Member Functions

 Encoder ()
 Constructs an encoder. More...
 
BItemVisitor Interface
virtual void visit (BDictionary *bDictionary) override
 
virtual void visit (BInteger *bInteger) override
 
virtual void visit (BList *bList) override
 
virtual void visit (BString *bString) override
 
- Private Member Functions inherited from bencoding::BItemVisitor
virtual ~BItemVisitor ()
 Destructs the visitor. More...
 
 BItemVisitor ()
 Constructs the visitor. More...
 

Private Attributes

std::string encodedData
 Encoded items. More...
 

Detailed Description

Data encoder.

The format is based on the BitTorrent specification.

Use create() to create instances.

Constructor & Destructor Documentation

◆ Encoder()

bencoding::Encoder::Encoder ( )
private

Constructs an encoder.

Member Function Documentation

◆ create()

std::unique_ptr< Encoder > bencoding::Encoder::create ( )
static

Creates a new encoder.

◆ encode()

std::string bencoding::Encoder::encode ( std::shared_ptr< BItem data)

Encodes the given data and returns them.

◆ visit() [1/4]

void bencoding::Encoder::visit ( BDictionary bDictionary)
overrideprivatevirtual

◆ visit() [2/4]

void bencoding::Encoder::visit ( BInteger bInteger)
overrideprivatevirtual

◆ visit() [3/4]

void bencoding::Encoder::visit ( BList bList)
overrideprivatevirtual

◆ visit() [4/4]

void bencoding::Encoder::visit ( BString bString)
overrideprivatevirtual

Member Data Documentation

◆ encodedData

std::string bencoding::Encoder::encodedData
private

Encoded items.


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