Class diagram JSON generator. More...
Class diagram JSON generator.
Definition at line 62 of file class_diagram_generator.h.
#include <class_diagram_generator.h>
Public Member Functions | |
generator (diagram_config &config, diagram_model &model) | |
void | generate_diagram (nlohmann::json &parent) const override |
Main generator method. | |
void | generate (const class_ &c, nlohmann::json &parent) const |
void | generate (const enum_ &c, nlohmann::json &parent) const |
void | generate (const concept_ &c, nlohmann::json &parent) const |
void | generate (const package &p, nlohmann::json &parent) const |
void | generate_top_level_elements (nlohmann::json &parent) const |
In a nested diagram, generate the top level elements. | |
void | generate_relationships (nlohmann::json &parent) const |
Generate all relationships in the diagram. | |
void | generate_relationships (const class_ &c, nlohmann::json &parent) const |
Generate all relationships originating at a class element. | |
void | generate_relationships (const enum_ &c, nlohmann::json &parent) const |
Generate all relationships originating at an enum element. | |
void | generate_relationships (const concept_ &c, nlohmann::json &parent) const |
Generate all relationships originating at a concept element. | |
void | generate_relationships (const package &p, nlohmann::json &parent) const |
Generate all relationships in a package. | |
Public Member Functions inherited from clanguml::common::generators::json::generator< ConfigType, DiagramType > | |
~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. | |
template<typename E > | |
inja::json | element_context (const E &e) const |
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 |
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 |
clanguml::class_diagram::generators::json::generator::generator | ( | diagram_config & | config, |
diagram_model & | model | ||
) |
Definition at line 134 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate | ( | const class_ & | c, |
nlohmann::json & | parent | ||
) | const |
Render class element into a JSON node.
c | class diagram element |
parent | JSON node |
Definition at line 229 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate | ( | const concept_ & | c, |
nlohmann::json & | parent | ||
) | const |
Render concept element into a JSON node.
c | concept diagram element |
parent | JSON node |
Definition at line 268 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate | ( | const enum_ & | c, |
nlohmann::json & | parent | ||
) | const |
Render enum element into a JSON node.
c | enum diagram element |
parent | JSON node |
Definition at line 257 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate | ( | const package & | p, |
nlohmann::json & | parent | ||
) | const |
Render package element into a JSON node.
p | package diagram element |
parent | JSON node |
Definition at line 176 of file class_diagram_generator.cc.
|
overridevirtual |
Main generator method.
This method is called first and coordinates the entire diagram generation.
ostr | Output stream. |
Implements clanguml::common::generators::json::generator< ConfigType, DiagramType >.
Definition at line 139 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate_relationships | ( | const class_ & | c, |
nlohmann::json & | parent | ||
) | const |
Generate all relationships originating at a class element.
c | Class diagram element |
parent | JSON node |
Definition at line 297 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate_relationships | ( | const concept_ & | c, |
nlohmann::json & | parent | ||
) | const |
Generate all relationships originating at a concept element.
c | Concept diagram element |
parent | JSON node |
Definition at line 343 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate_relationships | ( | const enum_ & | c, |
nlohmann::json & | parent | ||
) | const |
Generate all relationships originating at an enum element.
c | Enum diagram element |
parent | JSON node |
Definition at line 325 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate_relationships | ( | const package & | p, |
nlohmann::json & | parent | ||
) | const |
Generate all relationships in a package.
If the diagram is nested, it recursively calls relationship generation for all subelements.
p | Package diagram element |
parent | JSON node |
Definition at line 361 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate_relationships | ( | nlohmann::json & | parent | ) | const |
Generate all relationships in the diagram.
parent | JSON node |
Definition at line 279 of file class_diagram_generator.cc.
void clanguml::class_diagram::generators::json::generator::generate_top_level_elements | ( | nlohmann::json & | parent | ) | const |
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 | JSON node |
Definition at line 157 of file class_diagram_generator.cc.