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

Detailed Description

Mapping of diagram elements to their GraphML node ids. Each type of node has a different prefix. With parser attribute set to canonical, the nodes must have a n prefix and edges must have a e prefix.

Definition at line 91 of file generator.h.

#include <generator.h>

Public Member Functions

 graphml_node_map_t (std::string prefix)
 
std::string add (const std::string &name)
 
std::optional< std::string > get (const std::string &name) const
 

Private Attributes

uint64_t next_node_id_ {0}
 
std::string prefix_
 
std::map< std::string, std::string > map_
 

Constructor & Destructor Documentation

◆ graphml_node_map_t()

clanguml::common::generators::graphml::graphml_node_map_t::graphml_node_map_t ( std::string  prefix)

Definition at line 65 of file generator.cc.

66 : prefix_{std::move(prefix)}
67{
68}

Member Function Documentation

◆ add()

std::string clanguml::common::generators::graphml::graphml_node_map_t::add ( const std::string &  name)

Definition at line 70 of file generator.cc.

71{
72 map_[name] = fmt::format("{}{}", prefix_, next_node_id_++);
73 return map_[name];
74}

◆ get()

std::optional< std::string > clanguml::common::generators::graphml::graphml_node_map_t::get ( const std::string &  name) const

Definition at line 76 of file generator.cc.

78{
79 if (map_.count(name) == 0)
80 return {};
81
82 return map_.at(name);
83}

Member Data Documentation

◆ map_

std::map<std::string, std::string> clanguml::common::generators::graphml::graphml_node_map_t::map_
private

Definition at line 103 of file generator.h.

◆ next_node_id_

uint64_t clanguml::common::generators::graphml::graphml_node_map_t::next_node_id_ {0}
private

Definition at line 100 of file generator.h.

◆ prefix_

std::string clanguml::common::generators::graphml::graphml_node_map_t::prefix_
private

Definition at line 102 of file generator.h.


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