Sequence diagram JSON generator. More...
Sequence diagram JSON generator.
Definition at line 46 of file sequence_diagram_generator.h.
#include <sequence_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_call (const sequence_diagram::model::message &m, nlohmann::json &parent) const |
Generate sequence diagram message. | |
std::optional< eid_t > | generate_participant (nlohmann::json &parent, eid_t id, bool force=false) const |
Generate sequence diagram participant. | |
void | generate_participant (nlohmann::json &parent, const std::string &name) const |
Generate sequence diagram participant by name. | |
void | generate_activity (const sequence_diagram::model::activity &a, std::vector< eid_t > &visited) const |
Generate sequence diagram activity. | |
nlohmann::json & | current_block_statement () const |
Get reference to the current block statement. | |
std::string | make_display_name (const std::string &full_name) const |
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. | |
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. | |
void | process_call_message (const model::message &m, std::vector< eid_t > &visited) const |
Process call message. | |
void | process_if_message (const model::message &m) const |
Process if statement message. | |
void | process_else_if_message () const |
Process else if statement message. | |
void | process_end_if_message () const |
Process end if statement message. | |
void | process_conditional_message (const model::message &m) const |
Process :? statement message. | |
void | process_end_conditional_message () const |
Process end of conditional statement message. | |
void | process_conditional_else_message (const model::message &m) const |
Process conditional else statement message. | |
void | process_switch_message (const model::message &m) const |
Process switch statement message. | |
void | process_end_switch_message () const |
Process switch end statement message. | |
void | process_case_message (const model::message &m) const |
Process switch case statement message. | |
void | process_try_message (const model::message &m) const |
Process try statement message. | |
void | process_end_try_message () const |
Process try end statement message. | |
void | process_catch_message () const |
Process catch statement message. | |
void | process_do_message (const model::message &m) const |
Process do loop statement message. | |
void | process_end_do_message () const |
Process do end statement message. | |
void | process_for_message (const model::message &m) const |
Process for loop statement message. | |
void | process_end_for_message () const |
Process for end statement message. | |
void | process_while_message (const model::message &m) const |
Process while loop message. | |
void | process_end_while_message () const |
Process while end loop message. | |
void | generate_from_to_sequences (nlohmann::json &parent) const |
void | generate_to_sequences (nlohmann::json &parent) const |
void | generate_from_sequences (nlohmann::json &parent) const |
std::vector< eid_t > | find_from_activities () const |
Private Attributes | |
std::set< eid_t > | generated_participants_ |
nlohmann::json | json_ |
std::vector< std::reference_wrapper< nlohmann::json > > | block_statements_stack_ |
std::vector< model::message > | already_generated_in_static_context_ |
Additional Inherited Members | |
Protected Attributes inherited from clanguml::common::generators::generator< ConfigType, DiagramType > | |
inja::json | m_context |
inja::Environment | m_env |
clanguml::sequence_diagram::generators::json::generator::generator | ( | diagram_config & | config, |
diagram_model & | model | ||
) |
Definition at line 69 of file sequence_diagram_generator.cc.
nlohmann::json & clanguml::sequence_diagram::generators::json::generator::current_block_statement | ( | ) | const |
Get reference to the current block statement.
This method returns a reference to the last block statement (e.g if statement or for loop) in the call stack.
Definition at line 277 of file sequence_diagram_generator.cc.
|
private |
Definition at line 959 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::json::generator::generate_activity | ( | const sequence_diagram::model::activity & | a, |
std::vector< eid_t > & | visited | ||
) | const |
Generate sequence diagram activity.
a | Activity model |
visited | List of already visited participants, this is necessary for breaking infinite recursion on recursive calls |
Definition at line 207 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::json::generator::generate_call | ( | const sequence_diagram::model::message & | m, |
nlohmann::json & | parent | ||
) | const |
Generate sequence diagram message.
m | Message model |
parent | JSON node |
Definition at line 75 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::json::generator< ConfigType, DiagramType >.
Definition at line 752 of file sequence_diagram_generator.cc.
|
private |
Definition at line 782 of file sequence_diagram_generator.cc.
|
private |
Definition at line 875 of file sequence_diagram_generator.cc.
void clanguml::sequence_diagram::generators::json::generator::generate_participant | ( | nlohmann::json & | parent, |
const std::string & | name | ||
) | const |
Generate sequence diagram participant by name.
This is convienience wrapper over generate_participant()
by id.
parent | JSON node |
name | Full participant name |
Definition at line 549 of file sequence_diagram_generator.cc.
std::optional< eid_t > clanguml::sequence_diagram::generators::json::generator::generate_participant | ( | nlohmann::json & | parent, |
eid_t | id, | ||
bool | force = false |
||
) | const |
Generate sequence diagram participant.
parent | JSON node |
id | Participant id |
force | If true, generate the participant even if its not in the set of active participants |
Definition at line 563 of file sequence_diagram_generator.cc.
|
private |
Definition at line 824 of file sequence_diagram_generator.cc.
|
private |
Check if specified participant has already been generated.
id | Participant id. |
Definition at line 745 of file sequence_diagram_generator.cc.
std::string clanguml::sequence_diagram::generators::json::generator::make_display_name | ( | const std::string & | full_name | ) | const |
Definition at line 990 of file sequence_diagram_generator.cc.
|
private |
Process call message.
m | Message model |
visited | List of already visited participants |
Definition at line 284 of file sequence_diagram_generator.cc.
|
private |
Process switch
case
statement message.
m | Message model |
Definition at line 437 of file sequence_diagram_generator.cc.
|
private |
Process catch
statement message.
Definition at line 402 of file sequence_diagram_generator.cc.
|
private |
Process conditional else statement message.
m | Message model |
Definition at line 481 of file sequence_diagram_generator.cc.
|
private |
Process :?
statement message.
m | Message model |
Definition at line 459 of file sequence_diagram_generator.cc.
|
private |
Process do
loop statement message.
m | Message model |
Definition at line 361 of file sequence_diagram_generator.cc.
|
private |
Process else if
statement message.
Definition at line 514 of file sequence_diagram_generator.cc.
|
private |
Process end of conditional statement message.
Definition at line 496 of file sequence_diagram_generator.cc.
|
private |
Process do
end statement message.
Definition at line 376 of file sequence_diagram_generator.cc.
|
private |
Process for
end statement message.
Definition at line 355 of file sequence_diagram_generator.cc.
|
private |
Process end if
statement message.
Definition at line 505 of file sequence_diagram_generator.cc.
|
private |
Process switch end statement message.
Definition at line 451 of file sequence_diagram_generator.cc.
|
private |
Process try
end statement message.
Definition at line 415 of file sequence_diagram_generator.cc.
|
private |
Process while
end loop message.
Definition at line 334 of file sequence_diagram_generator.cc.
|
private |
Process for
loop statement message.
m | Message model |
Definition at line 340 of file sequence_diagram_generator.cc.
|
private |
Process if
statement message.
m | Message model |
Definition at line 527 of file sequence_diagram_generator.cc.
|
private |
Process switch
statement message.
m | Message model |
Definition at line 424 of file sequence_diagram_generator.cc.
|
private |
Process try
statement message.
m | Message model |
Definition at line 382 of file sequence_diagram_generator.cc.
|
private |
Process while
loop message.
m | Message model |
Definition at line 319 of file sequence_diagram_generator.cc.
|
mutableprivate |
Definition at line 259 of file sequence_diagram_generator.h.
|
mutableprivate |
Definition at line 257 of file sequence_diagram_generator.h.
|
mutableprivate |
Definition at line 250 of file sequence_diagram_generator.h.
|
mutableprivate |
Definition at line 254 of file sequence_diagram_generator.h.