VLC 4.0.0-dev
Loading...
Searching...
No Matches

This provides convenience helpers for using the C linked lists extension from C++ files. More...

Include dependency graph for vlc_list.hpp:

Go to the source code of this file.

Data Structures

class  vlc::list_iterator_base< NodeType, ListType >
 Base class for iterators on the vlc::list's vlc_list wrapper. More...
 
class  vlc::list_reverse_iterator< NodeType, ListType >
 
class  vlc::list_base< NodeType, ListType, Iterator, ConstIterator >
 Wrapper around any type matching with vlc_list, exposing C++ iterator operations. More...
 
struct  vlc::const_list< NodeType >
 Public type-safe wrapper around const vlc_list, providing const iterator and iteration functions. More...
 
struct  vlc::list< NodeType >
 Public type-safe wrapper around mutable vlc_list, providing iterators, iteration functions and mutation on the list itself. More...
 

Namespaces

namespace  vlc
 

Typedefs

template<typename NodeType >
using vlc::list_iterator = list_iterator_base< NodeType, vlc_list >
 Iterator on vlc_list with mutable capabilities.
 
template<typename NodeType >
using vlc::list_const_iterator = list_iterator_base< NodeType, const vlc_list >
 Iterator on vlc_list with immutable capabilities.
 

Functions

bool vlc::operator== (const ::vlc_list &a, const ::vlc_list &b)
 Compare two vlc_list node and check whether they represent the same element.
 
bool vlc::operator!= (const ::vlc_list &a, const ::vlc_list &b)
 Compare two vlc_list node and check whether they representthe same element.
 
template<typename NodeType >
::vlc::list< NodeType > vlc::from (vlc_list &list, vlc_list NodeType::*node_ptr)
 Construct a vlc::list (mutable list) object from a mutable vlc_list reference.
 
template<typename NodeType >
::vlc::const_list< NodeType > vlc::from (const vlc_list &list, vlc_list NodeType::*node_ptr)
 Construct a vlc::const_list (immutable list) object from a const vlc_list reference.
 

Detailed Description

This provides convenience helpers for using the C linked lists extension from C++ files.

A list wrapper should be used on an existing list:

struct item {
// ...
vlc_list node;
}
struct vlc_list c_list;
vlc_list_init(&c_list);
// ...
auto list = vlc::from(&list, &item::node);
struct vlc_param ** list
Definition core.c:402
::vlc::list< NodeType > from(vlc_list &list, vlc_list NodeType::*node_ptr)
Construct a vlc::list (mutable list) object from a mutable vlc_list reference.
Definition vlc_list.hpp:436
static void vlc_list_init(struct vlc_list *restrict head)
Initializes an empty list head.
Definition vlc_list.h:57
Doubly-linked list node.
Definition vlc_list.h:44

Using vlc::from will automatically select the correct variant for the list depending on the constness of the vlc_list list, and it can allow only iteration if the list is const.

Iteration includes standard iterators and for range-based loops, as well as reversed list.

for (auto it = list.begin(); it != list.end(); ++it)
{
// (*it) is of type `struct item`
}
for (auto &elem : vlc::from(&c_list, &item::node))
{
// `elem` type is `struct item`
// ...
}
for (auto &elem : vlc::from(&c_list, &item::node).as_reverse())
{
// `elem` type is `struct item`
// ...
}
Definition vlc_cxx_helpers.hpp:46