cpp-bencoding
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
bencoding::BItem Class Referenceabstract

Base class for all items (integers, strings, etc.). More...

#include <BItem.h>

Inheritance diagram for bencoding::BItem:
bencoding::BDictionary bencoding::BInteger bencoding::BList bencoding::BString

Public Member Functions

virtual ~BItem ()=0
 Destructs the item. More...
 
template<typename T >
std::shared_ptr< T > as ()
 Casts the item to the given subclass of BItem. More...
 
BItemVisitor Support
virtual void accept (BItemVisitor *visitor)=0
 Accepts the item by the given visitor. More...
 

Protected Member Functions

 BItem ()
 Constructs the item. More...
 

Private Member Functions

 BItem (const BItem &)=delete
 
BItemoperator= (const BItem &)=delete
 

Detailed Description

Base class for all items (integers, strings, etc.).

Constructor & Destructor Documentation

◆ ~BItem()

bencoding::BItem::~BItem ( )
pure virtualdefault

Destructs the item.

◆ BItem() [1/2]

bencoding::BItem::BItem ( )
protecteddefault

Constructs the item.

◆ BItem() [2/2]

bencoding::BItem::BItem ( const BItem )
privatedelete

Member Function Documentation

◆ accept()

virtual void bencoding::BItem::accept ( BItemVisitor visitor)
pure virtual

Accepts the item by the given visitor.

Subclasses should implement this function in this way:

void Subclass::accept(BItemVisitor *visitor) {
visitor->visit(this);
}

Implemented in bencoding::BDictionary, bencoding::BList, bencoding::BString, and bencoding::BInteger.

◆ as()

template<typename T >
std::shared_ptr<T> bencoding::BItem::as ( )
inline

Casts the item to the given subclass of BItem.

Template Parameters
TSubclass of BItem.

◆ operator=()

BItem& bencoding::BItem::operator= ( const BItem )
privatedelete

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