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

Representation of an integer. More...

#include <BInteger.h>

Inheritance diagram for bencoding::BInteger:
bencoding::BItem

Public Types

using ValueType = int64_t
 Type of the underlying integral value. More...
 

Public Member Functions

ValueType value () const
 Returns the integer's value. More...
 
void setValue (ValueType value)
 Sets a new value. More...
 
BItemVisitor Support
virtual void accept (BItemVisitor *visitor) override
 Accepts the item by the given visitor. More...
 
- Public Member Functions inherited from bencoding::BItem
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...
 

Static Public Member Functions

static std::unique_ptr< BIntegercreate (ValueType value)
 Creates and returns a new integer. More...
 

Private Member Functions

 BInteger (ValueType value)
 Constructs the integer with the given value. More...
 

Private Attributes

ValueType _value
 

Additional Inherited Members

- Protected Member Functions inherited from bencoding::BItem
 BItem ()
 Constructs the item. More...
 

Detailed Description

Representation of an integer.

Use create() to create instances of the class.

Member Typedef Documentation

◆ ValueType

Type of the underlying integral value.

Constructor & Destructor Documentation

◆ BInteger()

bencoding::BInteger::BInteger ( ValueType  value)
explicitprivate

Constructs the integer with the given value.

Member Function Documentation

◆ accept()

void bencoding::BInteger::accept ( BItemVisitor visitor)
overridevirtual

Accepts the item by the given visitor.

Subclasses should implement this function in this way:

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

Implements bencoding::BItem.

◆ create()

std::unique_ptr< BInteger > bencoding::BInteger::create ( ValueType  value)
static

Creates and returns a new integer.

◆ setValue()

void bencoding::BInteger::setValue ( ValueType  value)

Sets a new value.

◆ value()

auto bencoding::BInteger::value ( ) const

Returns the integer's value.

Member Data Documentation

◆ _value

ValueType bencoding::BInteger::_value
private

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