|
cpp-bencoding
|
Representation of a list. More...
#include <BList.h>
Public Types | |
| using | value_type = BItemList::value_type |
| Value type. More... | |
| using | size_type = BItemList::size_type |
| Size type. More... | |
| using | reference = BItemList::reference |
| Reference. More... | |
| using | const_reference = BItemList::const_reference |
| Constant reference. More... | |
| using | iterator = BItemList::iterator |
Iterator (BidirectionalIterator). More... | |
| using | const_iterator = BItemList::const_iterator |
Constant iterator (constant BidirectionalIterator). More... | |
Public Member Functions | |
Capacity | |
| size_type | size () const |
| Returns the number of items in the list. More... | |
| bool | empty () const |
| Checks if the list is empty. More... | |
Modifiers | |
| void | push_back (const value_type &bItem) |
| Appends the given item to the end of the list. More... | |
| void | pop_back () |
| Removes the last element of the list. More... | |
Element Access | |
| reference | front () |
| Returns a reference to the first item in the list. More... | |
| const_reference | front () const |
| Returns a constant reference to the first item in the list. More... | |
| reference | back () |
| Returns a reference to the last item in the list. More... | |
| const_reference | back () const |
| Returns a constant reference to the last item in the list. More... | |
Iterators | |
| iterator | begin () |
| Returns an iterator to the beginning of the list. More... | |
| iterator | end () |
| Returns an iterator to the end of the list. More... | |
| const_iterator | begin () const |
| Returns a constant iterator to the beginning of the list. More... | |
| const_iterator | end () const |
| Returns a constant iterator to the end of the list. More... | |
| const_iterator | cbegin () const |
| Returns a constant iterator to the beginning of the list. More... | |
| const_iterator | cend () const |
| Returns a constant iterator to the end of the list. 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< BList > | create () |
| Creates and returns a new list. More... | |
| static std::unique_ptr< BList > | create (std::initializer_list< value_type > items) |
| Creates a returns a new list containing the given items. More... | |
Private Types | |
| using | BItemList = std::list< std::shared_ptr< BItem > > |
| List of items. More... | |
Private Member Functions | |
| BList () | |
| Constructs an empty list. More... | |
| BList (std::initializer_list< value_type > items) | |
| Constructs a list containing the given items. More... | |
Private Attributes | |
| BItemList | itemList |
| Underlying list of items. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from bencoding::BItem | |
| BItem () | |
| Constructs the item. More... | |
Representation of a list.
The interface models the interface of std::list.
Use create() to create instances of the class.
|
private |
List of items.
| using bencoding::BList::const_iterator = BItemList::const_iterator |
Constant iterator (constant BidirectionalIterator).
| using bencoding::BList::const_reference = BItemList::const_reference |
Constant reference.
| using bencoding::BList::iterator = BItemList::iterator |
Iterator (BidirectionalIterator).
| using bencoding::BList::reference = BItemList::reference |
Reference.
| using bencoding::BList::size_type = BItemList::size_type |
Size type.
| using bencoding::BList::value_type = BItemList::value_type |
Value type.
|
privatedefault |
Constructs an empty list.
|
explicitprivate |
Constructs a list containing the given items.
|
overridevirtual |
Accepts the item by the given visitor.
Subclasses should implement this function in this way:
Implements bencoding::BItem.
| BList::reference bencoding::BList::back | ( | ) |
Returns a reference to the last item in the list.
| BList::const_reference bencoding::BList::back | ( | ) | const |
Returns a constant reference to the last item in the list.
| BList::iterator bencoding::BList::begin | ( | ) |
Returns an iterator to the beginning of the list.
| BList::const_iterator bencoding::BList::begin | ( | ) | const |
Returns a constant iterator to the beginning of the list.
| BList::const_iterator bencoding::BList::cbegin | ( | ) | const |
Returns a constant iterator to the beginning of the list.
| BList::const_iterator bencoding::BList::cend | ( | ) | const |
Returns a constant iterator to the end of the list.
|
static |
Creates and returns a new list.
|
static |
Creates a returns a new list containing the given items.
| bool bencoding::BList::empty | ( | ) | const |
Checks if the list is empty.
true if the list is empty, false otherwise. | BList::iterator bencoding::BList::end | ( | ) |
Returns an iterator to the end of the list.
| BList::const_iterator bencoding::BList::end | ( | ) | const |
Returns a constant iterator to the end of the list.
| BList::reference bencoding::BList::front | ( | ) |
Returns a reference to the first item in the list.
| BList::const_reference bencoding::BList::front | ( | ) | const |
Returns a constant reference to the first item in the list.
| void bencoding::BList::pop_back | ( | ) |
Removes the last element of the list.
References and iterators to the erased element are invalidated.
| void bencoding::BList::push_back | ( | const value_type & | bItem | ) |
Appends the given item to the end of the list.
| BList::size_type bencoding::BList::size | ( | ) | const |
Returns the number of items in the list.
|
private |
Underlying list of items.
1.8.14