Common diagram generator interface. More...
Common diagram generator interface.
This class defines common interface for all diagram generators.
Definition at line 44 of file generator.h.
#include <generator.h>
Public Member Functions | |
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 Attributes | |
inja::json | m_context |
inja::Environment | m_env |
Private Attributes | |
ConfigType & | config_ |
DiagramType & | model_ |
|
inline |
Constructor.
config | Reference to instance of model Reference to instance of clanguml::model::diagram |
Definition at line 52 of file generator.h.
|
virtualdefault |
Reimplemented in clanguml::common::generators::graphml::generator< ConfigType, DiagramType >, clanguml::common::generators::json::generator< ConfigType, DiagramType >, clanguml::common::generators::mermaid::generator< ConfigType, DiagramType >, and clanguml::common::generators::plantuml::generator< ConfigType, DiagramType >.
|
inline |
const inja::json & clanguml::common::generators::generator< C, D >::context |
Definition at line 152 of file generator.h.
inja::Environment & clanguml::common::generators::generator< C, D >::env |
Definition at line 158 of file generator.h.
|
pure virtual |
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 |
Implemented in clanguml::common::generators::graphml::generator< ConfigType, DiagramType >, clanguml::common::generators::json::generator< ConfigType, DiagramType >, clanguml::common::generators::mermaid::generator< ConfigType, DiagramType >, and clanguml::common::generators::plantuml::generator< ConfigType, DiagramType >.
std::optional< std::pair< std::string, std::string > > clanguml::common::generators::generator< C, D >::get_link_pattern | ( | const common::model::source_location & | sl | ) | const |
Definition at line 274 of file generator.h.
std::optional< std::pair< std::string, std::string > > clanguml::common::generators::generator< C, D >::get_tooltip_pattern | ( | const common::model::source_location & | sl | ) | const |
Definition at line 286 of file generator.h.
void clanguml::common::generators::generator< C, D >::init_context |
Initialize diagram Jinja context.
Definition at line 135 of file generator.h.
void clanguml::common::generators::generator< C, D >::init_env |
Definition at line 163 of file generator.h.
|
inline |
std::optional< std::string > clanguml::common::generators::generator< C, D >::render_link | ( | const common::model::diagram_element & | e | ) | const |
Definition at line 297 of file generator.h.
std::optional< std::string > clanguml::common::generators::generator< C, D >::render_link | ( | const common::model::relationship & | e | ) | const |
Definition at line 323 of file generator.h.
std::optional< std::string > clanguml::common::generators::generator< C, D >::render_tooltip | ( | const common::model::diagram_element & | e | ) | const |
Definition at line 349 of file generator.h.
std::optional< std::string > clanguml::common::generators::generator< C, D >::render_tooltip | ( | const common::model::relationship & | e | ) | const |
Definition at line 376 of file generator.h.
template void clanguml::common::generators::generator< ConfigType, DiagramType >::update_context | ( | ) | const |
Update diagram Jinja context.
This method updates the diagram context with models properties which can be used to render Jinja templates in the diagram (e.g. in notes or links)
Definition at line 10 of file generator.cc.
|
private |
Definition at line 131 of file generator.h.
|
mutableprotected |
Definition at line 127 of file generator.h.
|
mutableprotected |
Definition at line 128 of file generator.h.
|
private |
Definition at line 132 of file generator.h.