Base class for elements nested in the diagram. More...
Base class for elements nested in the diagram.
This class provides a common trait for diagram elements which can contain other nested elements, e.g. packages.
T | Type of element |
Path | Type of nested path (e.g. namespace or directory path) |
Definition at line 43 of file nested_trait.h.
#include <nested_trait.h>
Public Member Functions | |
nested_trait ()=default | |
nested_trait (const nested_trait &)=delete | |
nested_trait (nested_trait &&) noexcept=default | |
nested_trait & | operator= (const nested_trait &)=delete |
nested_trait & | operator= (nested_trait &&) noexcept=default |
virtual | ~nested_trait ()=default |
bool | is_root () const |
void | is_root (bool a) |
template<typename V = T> | |
bool | add_element (std::unique_ptr< V > element) |
template<typename V = T> | |
bool | add_element (const Path &path, std::unique_ptr< V > p) |
template<typename V = T> | |
auto | get_element (const Path &path) const |
template<typename V = T> | |
auto | get_element (const std::string &name, bool is_root=false) const |
template<typename F > | |
bool | all_of (F &&f) const |
bool | is_empty (bool include_inner_packages=false) const |
auto | cbegin () const |
auto | cend () const |
auto | begin () const |
auto | end () const |
void | print_tree (const int level) const |
template<typename V = T> | |
std::unique_ptr< V > | get_and_remove (eid_t id) |
void | remove (const std::set< eid_t > &element_ids) |
Private Types | |
using | element_iterator_t = typename std::list< std::unique_ptr< T > >::iterator |
Private Member Functions | |
bool | has_element (const std::string &name) const |
Private Attributes | |
bool | is_root_ {false} |
std::list< std::unique_ptr< T > > | elements_ |
std::map< eid_t, element_iterator_t > | elements_by_id_ |
std::multimap< std::string, element_iterator_t > | elements_by_name_ |
|
private |
Definition at line 344 of file nested_trait.h.
|
default |
|
delete |
|
defaultnoexcept |
|
virtualdefault |
|
inline |
Add element at a nested path.
V | Type of element |
path | Nested path (e.g. list of namespaces) |
p | Element |
Definition at line 99 of file nested_trait.h.
|
inline |
Add element at the current nested level.
V | Type of element |
p | Element |
Definition at line 67 of file nested_trait.h.
|
inline |
Return result of functor f applied to all_of elements.
F | Functor type |
f | Functor value |
Definition at line 207 of file nested_trait.h.
|
inline |
Definition at line 246 of file nested_trait.h.
|
inline |
Definition at line 243 of file nested_trait.h.
|
inline |
Definition at line 244 of file nested_trait.h.
|
inline |
Definition at line 247 of file nested_trait.h.
|
inline |
Definition at line 277 of file nested_trait.h.
|
inline |
Get element at path, if exists.
V | Element type. |
path | Path to the element. |
Definition at line 135 of file nested_trait.h.
|
inline |
Get element by name at the current nested level.
V | Type of element. |
name | Name of the element (cannot contain namespace or path) |
Definition at line 166 of file nested_trait.h.
|
inlineprivate |
Returns true of this nested level contains an element with specified name.
name | Name of the element. |
Definition at line 336 of file nested_trait.h.
|
inline |
Check if nested element is empty.
Definition at line 226 of file nested_trait.h.
|
inline |
Definition at line 55 of file nested_trait.h.
|
inline |
Definition at line 57 of file nested_trait.h.
|
delete |
|
defaultnoexcept |
|
inline |
Print the nested trait in the form of a tree.
This method is used for debugging only.
level | Tree level |
Definition at line 256 of file nested_trait.h.
|
inline |
Definition at line 321 of file nested_trait.h.
|
private |
Definition at line 343 of file nested_trait.h.
|
private |
Definition at line 346 of file nested_trait.h.
|
private |
Definition at line 347 of file nested_trait.h.
|
private |
Definition at line 341 of file nested_trait.h.