Base class for diagram generators. More...
Base class for diagram generators.
ConfigType | Configuration type |
DiagramType | Diagram model type |
Definition at line 113 of file generator.h.
#include <generator.h>
Public Member Functions | |
~generator () override=default | |
virtual std::vector< std::pair< std::string, property_type > > | graph_property_names () const |
virtual std::vector< std::pair< std::string, property_type > > | node_property_names () const |
virtual std::vector< std::pair< std::string, property_type > > | edge_property_names () const |
void | generate (std::ostream &ostr) const override |
Generate diagram. | |
void | generate_diagram (graphml_node_t &parent) const |
Generate diagram model. | |
virtual void | generate_top_level_elements (graphml_node_t &parent) const =0 |
In a nested diagram, generate the top level elements. | |
template<typename T > | |
void | generate_notes (const T &e, graphml_node_t &parent) const |
Generate any notes to be attached to diagram elements. | |
void | generate_metadata (graphml_t &parent) const |
Generate metadata element with diagram metadata. | |
virtual void | generate (const model::package &p, graphml_node_t &parent) const |
Generate diagram package. | |
virtual void | generate_relationships (graphml_node_t &parent) const |
Generate all relationships in the diagram. | |
virtual void | generate_relationships (const model::diagram_element &c, graphml_node_t &parent) const |
Generate all relationships originating at a diagram element. | |
template<typename T > | |
void | generate_link (pugi::xml_node &node, const T &c) const |
const property_keymap_t & | graph_properties () const |
const property_keymap_t & | node_properties () const |
const property_keymap_t & | edge_properties () const |
pugi::xml_node | make_node (graphml_node_t &parent, const std::string &id) const |
pugi::xml_node | make_graph (graphml_node_t &parent, const std::string &id) const |
pugi::xml_node | make_subgraph (graphml_node_t &parent, const std::string &id, const std::string &name="", const std::string &type="") const |
void | add_data (pugi::xml_node &node, const std::string &key, const std::string &value, bool cdata=false) const |
void | add_cdata (pugi::xml_node &node, const std::string &key, const std::string &value) const |
Public Member Functions inherited from clanguml::common::generators::generator< ConfigType, DiagramType > | |
generator (ConfigType &config, DiagramType &model) | |
Constructor. | |
virtual | ~generator ()=default |
virtual void | generate (std::ostream &ostr) const =0 |
Generate diagram. | |
const ConfigType & | config () const |
Get reference to diagram config. | |
const DiagramType & | model () const |
Get reference to diagram model. | |
std::optional< std::pair< std::string, std::string > > | get_link_pattern (const common::model::source_location &sl) const |
std::optional< std::pair< std::string, std::string > > | get_tooltip_pattern (const common::model::source_location &sl) const |
std::optional< std::string > | render_link (const common::model::diagram_element &e) const |
std::optional< std::string > | render_link (const common::model::relationship &e) const |
std::optional< std::string > | render_tooltip (const common::model::diagram_element &e) const |
std::optional< std::string > | render_tooltip (const common::model::relationship &e) const |
void | init_context () |
Initialize diagram Jinja context. | |
void | update_context () const |
Update diagram Jinja context. | |
void | init_env () |
const inja::json & | context () const |
inja::Environment & | env () const |
Protected Member Functions | |
void | generate_key (pugi::xml_node &parent, const std::string &attr_name, const std::string &for_value, const std::string &id_value, const std::string &attr_type="string") const |
property_keymap_t & | graph_properties () |
property_keymap_t & | node_properties () |
property_keymap_t & | edge_properties () |
Protected Attributes | |
graphml_node_map_t | graph_ids_ {"g"} |
graphml_node_map_t | node_ids_ {"n"} |
graphml_node_map_t | edge_ids_ {"e"} |
Protected Attributes inherited from clanguml::common::generators::generator< ConfigType, DiagramType > | |
inja::json | m_context |
inja::Environment | m_env |
Private Member Functions | |
void | generate_keys (graphml_node_t &parent) const |
Private Attributes | |
property_keymap_t | graph_properties_ {"gd"} |
property_keymap_t | node_properties_ {"nd"} |
property_keymap_t | edge_properties_ {"ed"} |
uint64_t | edge_id_ {0} |
uint64_t | note_id_ {0} |
|
overridevirtualdefault |
Reimplemented from clanguml::common::generators::generator< ConfigType, DiagramType >.
void clanguml::common::generators::graphml::generator< C, D >::add_cdata | ( | pugi::xml_node & | node, |
const std::string & | key, | ||
const std::string & | value | ||
) | const |
Definition at line 544 of file generator.h.
void clanguml::common::generators::graphml::generator< C, D >::add_data | ( | pugi::xml_node & | node, |
const std::string & | key, | ||
const std::string & | value, | ||
bool | cdata = false |
||
) | const |
Definition at line 520 of file generator.h.
|
inlineprotected |
Definition at line 279 of file generator.h.
|
inline |
Definition at line 252 of file generator.h.
|
inlinevirtual |
Definition at line 145 of file generator.h.
|
inlinevirtual |
Generate diagram package.
p | Diagram package element |
parent | Parent JSON node |
Definition at line 218 of file generator.h.
|
overridevirtual |
Generate diagram.
This is the main diagram generation entrypoint. It is responsible for calling other methods in appropriate order to generate the diagram into the output stream. It generates diagram elements, that are common to all types of diagrams in a given generator.
ostr | Output stream |
Implements clanguml::common::generators::generator< ConfigType, DiagramType >.
Definition at line 305 of file generator.h.
|
inline |
Generate diagram model.
This method must be implemented in subclasses for specific diagram types.
ostr | Output stream |
Definition at line 174 of file generator.h.
|
protected |
|
private |
Definition at line 579 of file generator.h.
void clanguml::common::generators::graphml::generator< C, D >::generate_link | ( | pugi::xml_node & | node, |
const T & | c | ||
) | const |
Definition at line 552 of file generator.h.
void clanguml::common::generators::graphml::generator< C, D >::generate_metadata | ( | graphml_t & | parent | ) | const |
Generate metadata element with diagram metadata.
parent | Root JSON object |
Definition at line 467 of file generator.h.
void clanguml::common::generators::graphml::generator< C, D >::generate_notes | ( | const T & | e, |
graphml_node_t & | parent | ||
) | const |
Generate any notes to be attached to diagram elements.
e | Diagram element |
parent | Parent GraphML package node to attach the note to |
Definition at line 401 of file generator.h.
|
virtual |
Generate all relationships originating at a diagram element.
T | Type of diagram element |
c | Diagram diagram element |
parent | JSON node |
Definition at line 356 of file generator.h.
|
virtual |
Generate all relationships in the diagram.
parent | GraphML node |
|
pure virtual |
In a nested diagram, generate the top level elements.
This method iterates over the top level elements. In case the diagram is nested (i.e. includes packages), for each package it recursively call generation of elements contained in each package.
parent | GraphML node |
|
inlineprotected |
Definition at line 277 of file generator.h.
|
inline |
Definition at line 242 of file generator.h.
|
inlinevirtual |
Definition at line 121 of file generator.h.
pugi::xml_node clanguml::common::generators::graphml::generator< C, D >::make_graph | ( | graphml_node_t & | parent, |
const std::string & | id | ||
) | const |
Definition at line 490 of file generator.h.
pugi::xml_node clanguml::common::generators::graphml::generator< C, D >::make_node | ( | graphml_node_t & | parent, |
const std::string & | id | ||
) | const |
Definition at line 481 of file generator.h.
pugi::xml_node clanguml::common::generators::graphml::generator< C, D >::make_subgraph | ( | graphml_node_t & | parent, |
const std::string & | id, | ||
const std::string & | name = "" , |
||
const std::string & | type = "" |
||
) | const |
Definition at line 503 of file generator.h.
|
inlineprotected |
Definition at line 278 of file generator.h.
|
inline |
Definition at line 247 of file generator.h.
|
inlinevirtual |
Reimplemented in clanguml::class_diagram::generators::graphml::generator, and clanguml::include_diagram::generators::graphml::generator.
Definition at line 133 of file generator.h.
|
mutableprivate |
Definition at line 292 of file generator.h.
|
mutableprotected |
Definition at line 283 of file generator.h.
|
mutableprivate |
Definition at line 290 of file generator.h.
|
mutableprotected |
Definition at line 281 of file generator.h.
|
mutableprivate |
Definition at line 288 of file generator.h.
|
mutableprotected |
Definition at line 282 of file generator.h.
|
mutableprivate |
Definition at line 289 of file generator.h.
|
mutableprivate |
Definition at line 293 of file generator.h.