Sequence diagram MermaidJS generator. More...
Sequence diagram MermaidJS generator.
Definition at line 49 of file sequence_diagram_generator.h.
#include <sequence_diagram_generator.h>
Public Member Functions | |
generator (diagram_config &config, diagram_model &model) | |
void | generate_diagram (std::ostream &ostr) const override |
Main generator method. | |
void | generate_diagram_type (std::ostream &ostr) const override |
Generate the diagram type. | |
void | generate_call (const clanguml::sequence_diagram::model::message &m, std::ostream &ostr) const |
Generate sequence diagram message. | |
void | generate_return (const clanguml::sequence_diagram::model::message &m, std::ostream &ostr) const |
Generate sequence diagram return message. | |
void | generate_participant (std::ostream &ostr, eid_t id, bool force=false) const |
Generate sequence diagram participant. | |
void | generate_participant (std::ostream &ostr, const std::string &name) const |
Generate sequence diagram participant by name. | |
void | generate_activity (eid_t activity_id, std::ostream &ostr, std::vector< eid_t > &visited) const |
Generate sequence diagram activity. | |
Public Member Functions inherited from clanguml::common::generators::mermaid::generator< ConfigType, DiagramType > | |
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_mermaid_directives (std::ostream &ostr, const std::vector< std::string > &directives) const |
Generate MermaidJS directives from config file. | |
virtual void | generate_diagram_type (std::ostream &ostr) const =0 |
Generate the diagram type. | |
virtual void | generate_notes (std::ostream &ostr, const model::diagram_element &element) const |
Generate diagram notes. | |
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 | 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 |
Private Member Functions | |
bool | is_participant_generated (eid_t id) const |
Check if specified participant has already been generated. | |
std::string | generate_alias (const model::participant &participant) const |
Generate MermaidJS alias for participant. | |
void | generate_message_comment (std::ostream &ostr, const model::message &m) const |
Generate message call note. | |
model::function::message_render_mode | select_method_arguments_render_mode () const |
Convert config to model message render mode. | |
void | generate_from_to_sequences (std::ostream &ostr, bool star_participant_generated) const |
void | generate_to_sequences (std::ostream &ostr) const |
void | generate_from_sequences (std::ostream &ostr) const |
std::vector< eid_t > | find_from_activities () const |
std::vector< model::message_chain_t > | find_to_message_chains () const |
Private Attributes | |
std::set< eid_t > | generated_participants_ |
std::set< unsigned int > | generated_comment_ids_ |
std::vector< model::message > | already_generated_in_static_context_ |
std::set< eid_t > | generated_activities_ |
Additional Inherited Members | |
Protected Attributes inherited from clanguml::common::generators::mermaid::generator< ConfigType, DiagramType > | |
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 |
clanguml::sequence_diagram::generators::mermaid::generator::generator | ( | diagram_config & | config, |
diagram_model & | model | ||
) |
Definition at line 39 of file sequence_diagram_generator.cc.
|
private |
Definition at line 737 of file sequence_diagram_generator.cc.
|
private |
Definition at line 609 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::mermaid::generator::generate_activity | ( | eid_t | activity_id, |
std::ostream & | ostr, | ||
std::vector< eid_t > & | visited | ||
) | const |
Generate sequence diagram activity.
activity_id | Activity id |
ostr | Output stream |
visited | List of already visited participants, this is necessary for breaking infinite recursion on recursive calls |
Definition at line 195 of file sequence_diagram_generator.cc.
|
private |
Generate MermaidJS alias for participant.
participant | Sequence diagram participant model |
Definition at line 514 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::mermaid::generator::generate_call | ( | const clanguml::sequence_diagram::model::message & | m, |
std::ostream & | ostr | ||
) | const |
Generate sequence diagram message.
m | Message model |
ostr | Output stream |
Definition at line 93 of file sequence_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::mermaid::generator< ConfigType, DiagramType >.
Definition at line 528 of file sequence_diagram_generator.cc.
|
overridevirtual |
Generate the diagram type.
ostr | Output stream |
Implements clanguml::common::generators::mermaid::generator< ConfigType, DiagramType >.
Definition at line 45 of file sequence_diagram_generator.cc.
|
private |
Definition at line 548 of file sequence_diagram_generator.cc.
|
private |
Definition at line 665 of file sequence_diagram_generator.cc.
|
private |
Generate message call note.
ostr | Output stream |
m | Message |
Definition at line 50 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::mermaid::generator::generate_participant | ( | std::ostream & | ostr, |
const std::string & | name | ||
) | const |
Generate sequence diagram participant by name.
This is convenience wrapper over generate_participant()
by id.
ostr | Output stream |
name | Full participant name |
Definition at line 356 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::mermaid::generator::generate_participant | ( | std::ostream & | ostr, |
eid_t | id, | ||
bool | force = false |
||
) | const |
Generate sequence diagram participant.
ostr | Output stream |
id | Participant id |
force | If true, generate the participant even if its not in the set of active participants |
Definition at line 370 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::mermaid::generator::generate_return | ( | const clanguml::sequence_diagram::model::message & | m, |
std::ostream & | ostr | ||
) | const |
Generate sequence diagram return message.
m | Message model |
ostr | Output stream |
Definition at line 172 of file sequence_diagram_generator.cc.
|
private |
Definition at line 634 of file sequence_diagram_generator.cc.
|
private |
Check if specified participant has already been generated.
id | Participant id. |
Definition at line 507 of file sequence_diagram_generator.cc.
|
private |
Convert config to model message render mode.
Definition at line 769 of file sequence_diagram_generator.cc.
|
mutableprivate |
Definition at line 171 of file sequence_diagram_generator.h.
|
mutableprivate |
Definition at line 172 of file sequence_diagram_generator.h.
|
mutableprivate |
Definition at line 170 of file sequence_diagram_generator.h.
|
mutableprivate |
Definition at line 169 of file sequence_diagram_generator.h.