Package diagram model. More...
#include <diagram.h>
Public Member Functions | |
diagram ()=default | |
diagram (const diagram &)=delete | |
diagram (diagram &&)=default | |
diagram & | operator= (const diagram &)=delete |
diagram & | operator= (diagram &&)=default |
common::model::diagram_t | type () const override |
Get the diagram model type - in this case package. | |
const common::reference_vector< package > & | packages () const |
Get list of references to packages in the diagram model. | |
opt_ref< diagram_element > | get (const std::string &full_name) const override |
Search for element in the diagram by fully qualified name. | |
opt_ref< diagram_element > | get (eid_t id) const override |
Search for element in the diagram by id. | |
template<typename ElementT > | |
opt_ref< ElementT > | find (const std::string &name) const |
Find an element in the diagram by name. | |
template<typename ElementT > | |
opt_ref< ElementT > | find (eid_t id) const |
Find an element in the diagram by id. | |
template<typename ElementT > | |
std::vector< opt_ref< ElementT > > | find (const clanguml::common::string_or_regex &pattern) const |
Find elements in the diagram by regex pattern. | |
template<typename ElementT > | |
bool | add (const path &parent_path, std::unique_ptr< ElementT > &&e) |
Add diagram element at nested path. | |
std::string | to_alias (eid_t id) const |
Get alias of existing diagram element. | |
bool | is_empty () const override |
Check whether the diagram is empty. | |
void | apply_filter () override |
template<typename ElementT > | |
const common::reference_vector< ElementT > & | elements () const |
Get reference to vector of elements of specific type. | |
Public Member Functions inherited from clanguml::common::model::diagram | |
diagram () | |
diagram (const diagram &)=delete | |
diagram (diagram &&) noexcept | |
diagram & | operator= (const diagram &)=delete |
diagram & | operator= (diagram &&) noexcept |
virtual | ~diagram () |
virtual diagram_t | type () const =0 |
Return type of the diagram. | |
virtual opt_ref< clanguml::common::model::diagram_element > | get (const std::string &full_name) const =0 |
virtual common::optional_ref< clanguml::common::model::diagram_element > | get (eid_t id) const =0 |
virtual common::optional_ref< clanguml::common::model::diagram_element > | get_with_namespace (const std::string &name, const namespace_ &ns) const |
void | set_name (const std::string &name) |
std::string | name () const |
void | set_filter (std::unique_ptr< diagram_filter > filter) |
const diagram_filter & | filter () const |
void | set_complete (bool complete) |
Set diagram in a complete state. | |
bool | complete () const |
Whether the diagram is complete. | |
virtual void | finalize () |
Once the diagram is complete, run any final processing. | |
bool | should_include (const element &e) const |
bool | should_include (const namespace_ &ns) const |
bool | should_include (const source_file &path) const |
bool | should_include (relationship r) const |
bool | should_include (relationship_t r) const |
bool | should_include (access_t s) const |
bool | should_include (const std::string &s) const =delete |
virtual bool | has_element (const eid_t) const |
virtual bool | should_include (const namespace_ &ns, const std::string &name) const |
virtual bool | is_empty () const =0 |
Check whether the diagram is empty. | |
virtual void | apply_filter () |
Public Member Functions inherited from clanguml::common::model::element_views< package > | |
void | for_all_elements (F &&f) |
void | for_all_elements (F &&f) const |
const element_view< T > & | view () const |
void | dynamic_apply (T *e, F &&f) const |
Calls f function on e if it can be dynamically casted to any type in the element_views. | |
Public Member Functions inherited from clanguml::common::model::element_view< Ts > | |
void | add (std::reference_wrapper< Ts > element) |
Add reference to diagram element. | |
const reference_vector< Ts > & | view () const |
Get collection of reference to diagram elements. | |
reference_vector< Ts > & | view () |
Get collection of reference to diagram elements. | |
common::optional_ref< Ts > | get (eid_t id) const |
Get typed diagram element by id. | |
bool | is_empty () const |
Check whether the element view is empty. | |
void | remove (const std::set< eid_t > &element_ids) |
void | for_each (F &&f) const |
Public Member Functions inherited from clanguml::common::model::nested_trait< T, Path > | |
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 > p) |
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 | begin () |
auto | end () |
auto | cbegin () const |
auto | cend () const |
auto | begin () const |
auto | end () const |
void | print_tree (const int level) const |
void | remove (const std::set< eid_t > &element_ids) |
Private Member Functions | |
template<typename ElementT > | |
bool | add_with_module_path (const common::model::path &parent_path, std::unique_ptr< ElementT > &&e) |
Add element using module as diagram path. | |
template<typename ElementT > | |
bool | add_with_namespace_path (std::unique_ptr< ElementT > &&e) |
Add element using namespace as diagram path. | |
template<typename ElementT > | |
bool | add_with_filesystem_path (const common::model::path &parent_path, std::unique_ptr< ElementT > &&e) |
Add element using relative filesystem path as diagram path. | |
|
default |
|
delete |
|
default |
|
inline |
Add diagram element at nested path.
This method handled both diagrams where packages are created from namespaces, as well as those were packages are created from project subdirectories.
ElementT | Type of diagram element to add |
parent_path | Package nested path where the element should be added |
e | Diagram element to add |
Definition at line 135 of file diagram.h.
|
private |
Add element using relative filesystem path as diagram path.
ElementT | Element type |
parent_path | Path to diagram elements parent package |
e | Element to add |
Definition at line 311 of file diagram.h.
|
private |
Add element using module as diagram path.
ElementT | Element type |
e | Element to add |
Definition at line 268 of file diagram.h.
|
private |
Add element using namespace as diagram path.
ElementT | Element type |
e | Element to add |
Definition at line 252 of file diagram.h.
|
overridevirtual |
Reimplemented from clanguml::common::model::diagram.
Definition at line 61 of file diagram.cc.
const common::reference_vector< ElementT > & clanguml::package_diagram::model::diagram::elements |
std::vector< opt_ref< ElementT > > clanguml::package_diagram::model::diagram::find | ( | const clanguml::common::string_or_regex & | pattern | ) | const |
Find elements in the diagram by regex pattern.
This method allows for typed search, where the type of searched for element is determined from template specialization.
ElementT | Type of element (e.g. class_) |
name | String or regex pattern |
Definition at line 235 of file diagram.h.
opt_ref< ElementT > clanguml::package_diagram::model::diagram::find | ( | const std::string & | name | ) | const |
Find an element in the diagram by name.
This method allows for typed search, where the type of searched for element is determined from template specialization.
ElementT | Type of element (e.g. package) |
name | Fully qualified name of the element |
opt_ref< ElementT > clanguml::package_diagram::model::diagram::find | ( | eid_t | id | ) | const |
Find an element in the diagram by id.
This method allows for typed search, where the type of searched for element is determined from template specialization.
ElementT | Type of element (e.g. package) |
id | Id of the element |
Definition at line 223 of file diagram.h.
|
overridevirtual |
Search for element in the diagram by fully qualified name.
full_name | Fully qualified element name. |
Implements clanguml::common::model::diagram.
Definition at line 38 of file diagram.cc.
|
overridevirtual |
Search for element in the diagram by id.
id | Element id. |
Implements clanguml::common::model::diagram.
Definition at line 44 of file diagram.cc.
|
overridevirtual |
Check whether the diagram is empty.
Implements clanguml::common::model::diagram.
Definition at line 91 of file diagram.cc.
const common::reference_vector< clanguml::common::model::package > & clanguml::package_diagram::model::diagram::packages | ( | ) | const |
Get list of references to packages in the diagram model.
Definition at line 33 of file diagram.cc.
std::string clanguml::package_diagram::model::diagram::to_alias | ( | eid_t | id | ) | const |
Get alias of existing diagram element.
id | Id of a package in the diagram |
Definition at line 50 of file diagram.cc.
|
overridevirtual |
Get the diagram model type - in this case package.
Implements clanguml::common::model::diagram.
Definition at line 27 of file diagram.cc.