Base class for diagram generators. More...
Base class for diagram generators.
ConfigType | Configuration type |
DiagramType | Diagram model type |
Definition at line 61 of file generator.h.
#include <generator.h>
Public Member Functions | |
~generator () override=default | |
void | generate (std::ostream &ostr) const override |
Generate diagram. | |
virtual void | generate_diagram (nlohmann::json &parent) const =0 |
Generate diagram model. | |
void | generate_metadata (nlohmann::json &parent) const |
Generate metadata element with diagram metadata. | |
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 |
Additional Inherited Members | |
Protected Attributes inherited from clanguml::common::generators::generator< ConfigType, DiagramType > | |
inja::json | m_context |
inja::Environment | m_env |
|
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 108 of file generator.h.
|
pure virtual |
Generate diagram model.
This method must be implemented in subclasses for specific diagram types.
ostr | Output stream |
Implemented in clanguml::class_diagram::generators::json::generator, clanguml::include_diagram::generators::json::generator, clanguml::package_diagram::generators::json::generator, and clanguml::sequence_diagram::generators::json::generator.
void clanguml::common::generators::json::generator< C, D >::generate_metadata | ( | nlohmann::json & | parent | ) | const |
Generate metadata element with diagram metadata.
parent | Root JSON object |
Definition at line 133 of file generator.h.