8 #ifndef BENCODING_BLIST_H 9 #define BENCODING_BLIST_H 11 #include <initializer_list> 29 using BItemList = std::list<std::shared_ptr<BItem>>;
51 static std::unique_ptr<BList>
create();
52 static std::unique_ptr<BList>
create(std::initializer_list<value_type> items);
91 explicit BList(std::initializer_list<value_type> items);
reference front()
Returns a reference to the first item in the list.
Definition: BList.cpp:89
static std::unique_ptr< BList > create()
Creates and returns a new list.
Definition: BList.cpp:30
std::list< std::shared_ptr< BItem > > BItemList
List of items.
Definition: BList.h:29
Base class for all items (integers, strings, etc.).
Definition: BItem.h:20
void push_back(const value_type &bItem)
Appends the given item to the end of the list.
Definition: BList.cpp:63
size_type size() const
Returns the number of items in the list.
Definition: BList.cpp:44
reference back()
Returns a reference to the last item in the list.
Definition: BList.cpp:113
Base class for all visitors of the BItem subclasses.
Definition: BItemVisitor.h:25
iterator begin()
Returns an iterator to the beginning of the list.
Definition: BList.cpp:134
bool empty() const
Checks if the list is empty.
Definition: BList.cpp:53
BList()
Constructs an empty list.
const_iterator cbegin() const
Returns a constant iterator to the beginning of the list.
Definition: BList.cpp:162
BItemList::iterator iterator
Iterator (BidirectionalIterator).
Definition: BList.h:45
BItemList itemList
Underlying list of items.
Definition: BList.h:95
BItemList::const_iterator const_iterator
Constant iterator (constant BidirectionalIterator).
Definition: BList.h:48
Main namespace of the bencoding library.
const_iterator cend() const
Returns a constant iterator to the end of the list.
Definition: BList.cpp:169
BItemList::value_type value_type
Value type.
Definition: BList.h:33
Base class for all items (integers, strings, etc.).
virtual void accept(BItemVisitor *visitor) override
Accepts the item by the given visitor.
Definition: BList.cpp:173
BItemList::size_type size_type
Size type.
Definition: BList.h:36
iterator end()
Returns an iterator to the end of the list.
Definition: BList.cpp:141
void pop_back()
Removes the last element of the list.
Definition: BList.cpp:77
BItemList::const_reference const_reference
Constant reference.
Definition: BList.h:42
BItemList::reference reference
Reference.
Definition: BList.h:39
Representation of a list.
Definition: BList.h:26