Base class for diagram generators. More...
Base class for diagram generators.
ConfigType | Configuration type |
DiagramType | Diagram model type |
Definition at line 54 of file generator.h.
#include <generator.h>
Public Member Functions | |
generator (ConfigType &config, DiagramType &model) | |
Constructor. | |
~generator () override=default | |
void | generate (std::ostream &ostr) const override |
Generate diagram. | |
virtual void | generate_diagram (std::ostream &ostr) const =0 |
Generate diagram specific part. | |
void | generate_config_layout_hints (std::ostream &ostr) const |
Generate diagram layout hints. | |
void | generate_plantuml_directives (std::ostream &ostr, const std::vector< std::string > &directives) const |
Generate PlantUML directives from config file. | |
void | generate_notes (std::ostream &ostr, const model::element &element) const |
Generate diagram notes. | |
void | generate_style (std::ostream &ostr, const std::string &element_type, const model::stylable_element &el) const |
Generate diagram element PlantUML style. | |
void | generate_metadata (std::ostream &ostr) const |
Generate comment with diagram metadata. | |
void | generate_title (std::ostream &ostr) const |
Generate diagram title. | |
template<typename E > | |
void | generate_link (std::ostream &ostr, const E &e) const |
Generate hyper link to element. | |
void | generate_link (std::ostream &ostr, const relationship &e) const |
generate_link specialization for relationship | |
void | print_debug (const common::model::source_location &e, std::ostream &ostr) const |
Print debug information in diagram comments. | |
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 Attributes | |
std::set< std::string > | m_generated_aliases |
Protected Attributes inherited from clanguml::common::generators::generator< ConfigType, DiagramType > | |
inja::json | m_context |
inja::Environment | m_env |
Private Member Functions | |
void | generate_row_column_hints (std::ostream &ostr, const std::string &entity_name, const config::layout_hint &hint) const |
void | generate_position_hints (std::ostream &ostr, const std::string &entity_name, const config::layout_hint &hint) const |
|
inline |
Constructor.
config | Reference to instance of model Reference to instance of clanguml::model::diagram |
Definition at line 63 of file generator.h.
|
overridevirtualdefault |
Reimplemented from clanguml::common::generators::generator< ConfigType, DiagramType >.
|
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 200 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::generate_config_layout_hints | ( | std::ostream & | ostr | ) | const |
Generate diagram layout hints.
This method adds to the diagram any layout hints that were provided in the configuration file.
ostr | Output stream |
Definition at line 231 of file generator.h.
|
pure virtual |
Generate diagram specific part.
This method must be implemented in subclasses for specific diagram types.
ostr | Output stream |
Implemented in clanguml::class_diagram::generators::plantuml::generator, clanguml::include_diagram::generators::plantuml::generator, clanguml::package_diagram::generators::plantuml::generator, and clanguml::sequence_diagram::generators::plantuml::generator.
void clanguml::common::generators::plantuml::generator< C, D >::generate_link | ( | std::ostream & | ostr, |
const E & | e | ||
) | const |
Generate hyper link to element.
This method renders links to URL's based on templates provided in the configuration file (e.g. Git browser with specific line and column offset)
ostr | Output stream |
e | Reference to diagram element |
E | Diagram element type |
Definition at line 412 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::generate_link | ( | std::ostream & | ostr, |
const relationship & | e | ||
) | const |
generate_link specialization for relationship
ostr | Output stream |
e | Reference to diagram relationship |
Definition at line 431 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::generate_metadata | ( | std::ostream & | ostr | ) | const |
Generate comment with diagram metadata.
ostr | Output stream |
Definition at line 388 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::generate_notes | ( | std::ostream & | ostr, |
const model::element & | element | ||
) | const |
Generate diagram notes.
This method adds any notes in the diagram, which were declared in the code using inline directives
ostr | Output stream |
element | Element to which the note should be attached |
Definition at line 372 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::generate_plantuml_directives | ( | std::ostream & | ostr, |
const std::vector< std::string > & | directives | ||
) | const |
Generate PlantUML directives from config file.
This method renders the PlantUML directives provided in the configuration file, including resolving any element aliases and Jinja templates.
ostr | Output stream |
directives | List of directives from the configuration file |
Definition at line 340 of file generator.h.
|
private |
Definition at line 309 of file generator.h.
|
private |
Definition at line 262 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::generate_style | ( | std::ostream & | ostr, |
const std::string & | element_type, | ||
const model::stylable_element & | el | ||
) | const |
Generate diagram element PlantUML style.
This method renders a style for a specific el
element if specified in the config file or inline comment directive.
ostr | Output stream |
element_type | Name of the element type (e.g. "class") |
el | Reference to a stylable diagram element |
Definition at line 356 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::generate_title | ( | std::ostream & | ostr | ) | const |
Generate diagram title.
Generates a PlantUML diagram title directive if diagram title is provided in the diagram configuration.
ostr | Output stream |
Definition at line 401 of file generator.h.
void clanguml::common::generators::plantuml::generator< C, D >::print_debug | ( | const common::model::source_location & | e, |
std::ostream & | ostr | ||
) | const |
Print debug information in diagram comments.
m | Diagram element to describe |
ostr | Output stream |
Definition at line 451 of file generator.h.
|
mutableprotected |
Definition at line 196 of file generator.h.