Base class for standalone diagram elements. More...
Base class for standalone diagram elements.
This is a base cass of any standalone elements such as classes, structs, concepts, packages and so on participants and so on.
Definition at line 47 of file diagram_element.h.
#include <diagram_element.h>
Public Member Functions | |
diagram_element () | |
~diagram_element () override=default | |
const eid_t & | id () const |
Returns diagram element id. | |
void | set_id (eid_t id) |
std::optional< eid_t > | parent_element_id () const |
void | set_parent_element_id (eid_t id) |
virtual std::string | alias () const |
Return elements' diagram alias. | |
void | set_name (const std::string &name) |
void | set_name (const std::string &parent, const std::string &name) |
std::string | name () const |
virtual std::string | type_name () const |
std::string | full_name (bool relative) const |
Return the elements fully qualified name. | |
std::vector< relationship > & | relationships () |
const std::vector< relationship > & | relationships () const |
void | add_relationship (relationship &&cr) |
void | append (const decorated_element &e) |
bool | is_nested () const |
void | nested (bool nested) |
bool | complete () const |
void | complete (bool completed) |
void | remove_duplicate_relationships () |
virtual void | apply_filter (const diagram_filter &filter, const std::set< eid_t > &removed) |
Public Member Functions inherited from clanguml::common::model::decorated_element | |
virtual | ~decorated_element ()=default |
bool | skip () const |
bool | skip_relationship () const |
std::pair< relationship_t, std::string > | get_relationship () const |
std::string | style_spec () const |
const std::vector< std::shared_ptr< decorators::decorator > > & | decorators () const |
void | add_decorators (const std::vector< std::shared_ptr< decorators::decorator > > &decorators) |
void | append (const decorated_element &de) |
std::optional< comment_t > | comment () const |
void | set_comment (const comment_t &c) |
virtual std::optional< std::string > | doxygen_link () const |
Public Member Functions inherited from clanguml::common::model::source_location | |
source_location ()=default | |
source_location (std::string f, unsigned int l) | |
const std::string & | file () const |
void | set_file (const std::string &file) |
const std::string & | file_relative () const |
void | set_file_relative (const std::string &file) |
const std::string & | translation_unit () const |
void | set_translation_unit (const std::string &translation_unit) |
unsigned int | line () const |
void | set_line (const unsigned line) |
unsigned int | column () const |
void | set_column (const unsigned column) |
unsigned int | location_id () const |
void | set_location_id (unsigned int h) |
Public Member Functions inherited from clanguml::util::memoized< full_name_tag_t, std::string, bool > | |
auto | memoize (bool is_complete, F &&f, Args... args) const |
void | invalidate (Args... args) const |
Public Member Functions inherited from clanguml::util::memoized< name_and_ns_tag, std::string > | |
auto | memoize (bool is_complete, F &&f, Args... args) const |
void | invalidate (Args... args) const |
Protected Member Functions | |
virtual std::string | full_name_impl (bool) const |
Private Attributes | |
eid_t | id_ {} |
std::optional< eid_t > | parent_element_id_ {} |
std::string | name_ |
std::vector< relationship > | relationships_ |
bool | nested_ {false} |
bool | complete_ {false} |
Friends | |
bool | operator== (const diagram_element &l, const diagram_element &r) |
std::ostream & | operator<< (std::ostream &out, const diagram_element &rhs) |
Additional Inherited Members | |
Public Types inherited from clanguml::util::memoized< full_name_tag_t, std::string, bool > | |
using | key_t = std::tuple< Args... > |
using | value_t = std::string |
Public Types inherited from clanguml::util::memoized< name_and_ns_tag, std::string > | |
using | key_t = std::tuple< Args... > |
using | value_t = std::string |
|
default |
|
overridedefault |
void clanguml::common::model::diagram_element::add_relationship | ( | relationship && | cr | ) |
Add relationships, whose source is this element.
cr | Relationship to another diagram element. |
Definition at line 52 of file diagram_element.cc.
|
virtual |
Return elements' diagram alias.
Reimplemented in clanguml::sequence_diagram::model::method, and clanguml::sequence_diagram::model::objc_method.
Definition at line 44 of file diagram_element.cc.
void clanguml::common::model::diagram_element::append | ( | const decorated_element & | e | ) |
Add element to the diagram.
e | Diagram element. |
Definition at line 79 of file diagram_element.cc.
|
virtual |
Reimplemented in clanguml::class_diagram::model::class_.
Definition at line 105 of file diagram_element.cc.
bool clanguml::common::model::diagram_element::complete | ( | ) | const |
Returns the diagrams completion status.
Definition at line 88 of file diagram_element.cc.
void clanguml::common::model::diagram_element::complete | ( | bool | completed | ) |
Set the diagrams completion status.
completed |
Definition at line 90 of file diagram_element.cc.
|
inline |
Return the elements fully qualified name.
This method should be implemented in each subclass, and ensure that for instance it includes fully qualified namespace, template params, etc.
Definition at line 143 of file diagram_element.h.
|
inlineprotectedvirtual |
Reimplemented in clanguml::common::model::element, clanguml::common::model::package, clanguml::sequence_diagram::model::method, clanguml::sequence_diagram::model::objc_method, clanguml::class_diagram::model::class_, clanguml::class_diagram::model::concept_, clanguml::class_diagram::model::enum_, clanguml::class_diagram::model::objc_interface, clanguml::sequence_diagram::model::class_, clanguml::sequence_diagram::model::function, clanguml::sequence_diagram::model::function_template, and clanguml::common::model::source_file.
Definition at line 223 of file diagram_element.h.
const eid_t & clanguml::common::model::diagram_element::id | ( | ) | const |
Returns diagram element id.
Each element in the diagram is uniquely identified by id. The id is currently calculated from the full string representation of the element, in order to be uniquely identifiable among multiple translation units.
Definition at line 30 of file diagram_element.cc.
bool clanguml::common::model::diagram_element::is_nested | ( | ) | const |
Whether this element is nested in another element.
Definition at line 84 of file diagram_element.cc.
|
inline |
Return diagram element name.
Definition at line 126 of file diagram_element.h.
void clanguml::common::model::diagram_element::nested | ( | bool | nested | ) |
std::optional< eid_t > clanguml::common::model::diagram_element::parent_element_id | ( | ) | const |
Get elements parent package id.
Definition at line 34 of file diagram_element.cc.
std::vector< relationship > & clanguml::common::model::diagram_element::relationships | ( | ) |
Return all relationships outgoing from this element.
Definition at line 69 of file diagram_element.cc.
const std::vector< relationship > & clanguml::common::model::diagram_element::relationships | ( | ) | const |
Return all relationships outgoing from this element.
Definition at line 74 of file diagram_element.cc.
void clanguml::common::model::diagram_element::remove_duplicate_relationships | ( | ) |
Due to the fact that a relationship to the same element can be added once with local TU id and other time with global id, the relationship set can contain duplicates.
Definition at line 92 of file diagram_element.cc.
void clanguml::common::model::diagram_element::set_id | ( | eid_t | id | ) |
|
inline |
Set diagram elements name.
name | Elements name. |
Definition at line 104 of file diagram_element.h.
|
inline |
Set diagram elements name for nested elements.
parent | Parents name. |
name | Elements name. |
Definition at line 116 of file diagram_element.h.
void clanguml::common::model::diagram_element::set_parent_element_id | ( | eid_t | id | ) |
Set elements parent package id.
id | Id of parent package. |
Definition at line 39 of file diagram_element.cc.
|
inlinevirtual |
Return the type name of the diagram element.
Reimplemented in clanguml::class_diagram::model::class_, clanguml::class_diagram::model::concept_, clanguml::class_diagram::model::enum_, clanguml::class_diagram::model::objc_interface, clanguml::common::model::package, clanguml::sequence_diagram::model::participant, clanguml::sequence_diagram::model::class_, clanguml::sequence_diagram::model::function, clanguml::sequence_diagram::model::method, clanguml::sequence_diagram::model::objc_method, and clanguml::sequence_diagram::model::function_template.
Definition at line 133 of file diagram_element.h.
|
friend |
Definition at line 123 of file diagram_element.cc.
|
friend |
Definition at line 118 of file diagram_element.cc.
|
private |
Definition at line 234 of file diagram_element.h.
|
private |
Definition at line 229 of file diagram_element.h.
|
private |
Definition at line 231 of file diagram_element.h.
|
private |
Definition at line 233 of file diagram_element.h.
|
private |
Definition at line 230 of file diagram_element.h.
|
private |
Definition at line 232 of file diagram_element.h.