0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | List of all members
clanguml::package_diagram::generators::graphml::generator Class Reference

Package diagram GraphML generator. More...

Detailed Description

Package diagram GraphML generator.

Definition at line 52 of file package_diagram_generator.h.

#include <package_diagram_generator.h>

Public Member Functions

 generator (diagram_config &config, diagram_model &model)
 
void generate (const package &p, graphml_node_t &parent) const override
 
void generate_top_level_elements (graphml_node_t &parent) const override
 
- Public Member Functions inherited from clanguml::common::generators::graphml::generator< ConfigType, DiagramType >
 ~generator () override=default
 
virtual std::vector< std::pair< std::string, property_type > > graph_property_names () const
 
virtual std::vector< std::pair< std::string, property_type > > node_property_names () const
 
virtual std::vector< std::pair< std::string, property_type > > edge_property_names () const
 
void generate (std::ostream &ostr) const override
 Generate diagram.
 
void generate_diagram (graphml_node_t &parent) const
 Generate diagram model.
 
virtual void generate_top_level_elements (graphml_node_t &parent) const =0
 In a nested diagram, generate the top level elements.
 
template<typename T >
void generate_notes (const T &e, graphml_node_t &parent) const
 Generate any notes to be attached to diagram elements.
 
void generate_metadata (graphml_t &parent) const
 Generate metadata element with diagram metadata.
 
virtual void generate (const model::package &p, graphml_node_t &parent) const
 Generate diagram package.
 
virtual void generate_relationships (graphml_node_t &parent) const
 Generate all relationships in the diagram.
 
virtual void generate_relationships (const model::diagram_element &c, graphml_node_t &parent) const
 Generate all relationships originating at a diagram element.
 
template<typename T >
void generate_link (pugi::xml_node &node, const T &c) const
 
const property_keymap_tgraph_properties () const
 
const property_keymap_tnode_properties () const
 
const property_keymap_tedge_properties () const
 
pugi::xml_node make_node (graphml_node_t &parent, const std::string &id) const
 
pugi::xml_node make_graph (graphml_node_t &parent, const std::string &id) const
 
pugi::xml_node make_subgraph (graphml_node_t &parent, const std::string &id, const std::string &name="", const std::string &type="") const
 
void add_data (pugi::xml_node &node, const std::string &key, const std::string &value, bool cdata=false) const
 
void add_cdata (pugi::xml_node &node, const std::string &key, const std::string &value) const
 
- 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 Member Functions inherited from clanguml::common::generators::graphml::generator< ConfigType, DiagramType >
void generate_key (pugi::xml_node &parent, const std::string &attr_name, const std::string &for_value, const std::string &id_value, const std::string &attr_type="string") const
 
property_keymap_tgraph_properties ()
 
property_keymap_tnode_properties ()
 
property_keymap_tedge_properties ()
 
- Protected Attributes inherited from clanguml::common::generators::graphml::generator< ConfigType, DiagramType >
graphml_node_map_t graph_ids_ {"g"}
 
graphml_node_map_t node_ids_ {"n"}
 
graphml_node_map_t edge_ids_ {"e"}
 
- Protected Attributes inherited from clanguml::common::generators::generator< ConfigType, DiagramType >
inja::json m_context
 
inja::Environment m_env
 

Constructor & Destructor Documentation

◆ generator()

clanguml::package_diagram::generators::graphml::generator::generator ( diagram_config config,
diagram_model model 
)

Definition at line 25 of file package_diagram_generator.cc.

26 : common_generator<diagram_config, diagram_model>{config, model}
27{
28}

Member Function Documentation

◆ generate()

void clanguml::package_diagram::generators::graphml::generator::generate ( const package p,
graphml_node_t &  parent 
) const
override

Definition at line 41 of file package_diagram_generator.cc.

42{
44
45 LOG_DBG("Generating package {}", p.full_name(false));
46
47 const auto &uns = config().using_namespace();
48
49 if (!uns.starts_with({p.full_name(false)})) {
50 auto package_node = make_subgraph(parent, p.alias(),
51 display_name_adapter(p).with_packages().name(),
52 to_string(config().package_type()));
53
54 generate_link(package_node, p);
55
56 if (p.is_deprecated())
57 add_data(package_node, "stereotype", "deprecated");
58
59 auto graph_node = make_graph(package_node, p.alias());
60
61 for (const auto &subpackage : p) {
62 auto &pkg = dynamic_cast<package &>(*subpackage);
63 generate(pkg, graph_node);
64 }
65
66 generate_notes(p, graph_node);
67 }
68 else {
69 for (const auto &subpackage : p) {
70 auto &pkg = dynamic_cast<package &>(*subpackage);
71 generate(pkg, parent);
72 }
73
74 generate_notes(p, parent);
75 }
76}

◆ generate_top_level_elements()

void clanguml::package_diagram::generators::graphml::generator::generate_top_level_elements ( graphml_node_t &  parent) const
override

Definition at line 30 of file package_diagram_generator.cc.

31{
32 for (const auto &p : model()) {
33 auto &pkg = dynamic_cast<package &>(*p);
34 generate(pkg, parent);
35 }
36
39}

The documentation for this class was generated from the following files: