0.6.1
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
clanguml::common::model Namespace Reference

Detailed Description

src/common/model/diagram_element.h

Copyright (c) 2021-2025 Bartek Kryza bkryz.nosp@m.a@gm.nosp@m.ail.c.nosp@m.om

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This namespace provides common interfaces for diagram model, including various diagram elements and diagram filters.

Namespaces

namespace  detail
 
namespace  tvl
 

Classes

struct  access_filter
 
class  advanced_diagram_filter_initializer
 
struct  allof_filter
 
struct  anyof_filter
 
class  basic_diagram_filter_initializer
 
struct  callee_filter
 
struct  class_member_filter
 
struct  class_method_filter
 
struct  context
 
struct  context_filter
 
class  decorated_element
 Base class for decorated diagram elements. More...
 
class  diagram
 Base class for all diagram models. More...
 
class  diagram_element
 Base class for standalone diagram elements. More...
 
class  diagram_filter
 Composite of all diagrams filters. More...
 
class  diagram_filter_factory
 
class  diagram_filter_initializer
 
struct  edge_traversal_filter
 Common template for filters involving traversing relationship graph. More...
 
class  element
 Base class for any element qualified by namespace. More...
 
struct  element_filter
 
struct  element_type_filter
 
class  element_view
 
struct  element_views
 
class  filter_visitor
 Base class for any diagram filter. More...
 
struct  fs_path_sep
 
struct  full_name_tag_t
 
struct  method_type_filter
 
struct  module_access_filter
 
struct  modules_filter
 
struct  name_and_ns_tag
 
struct  namespace_filter
 
class  nested_trait
 Base class for elements nested in the diagram. More...
 
struct  ns_path_separator
 
class  package
 Diagram element representing namespace or directory package. More...
 
struct  parents_filter
 
class  path
 Diagram path. More...
 
struct  paths_filter
 
class  relationship
 Class representing any relationship other than inheritance. More...
 
struct  relationship_filter
 
class  source_file
 Diagram element representing some file or directory. More...
 
class  source_location
 Base class of all diagram elements that have source location. More...
 
class  stylable_element
 Diagram elements to which style can be applied. More...
 
struct  subclass_filter
 
class  template_element
 Base class for any element qualified by namespace. More...
 
class  template_parameter
 Represents template parameter, template arguments or concept constraints. More...
 
class  template_trait
 Common interface for template diagram elements. More...
 

Typedefs

using comment_t = inja::json
 
using specializations_filter_t = edge_traversal_filter< class_diagram::model::diagram, class_diagram::model::class_, common::string_or_regex >
 
using class_dependants_filter_t = edge_traversal_filter< class_diagram::model::diagram, class_diagram::model::class_, common::string_or_regex >
 
using class_dependencies_filter_t = edge_traversal_filter< class_diagram::model::diagram, class_diagram::model::class_, common::string_or_regex >
 
using package_dependants_filter_t = edge_traversal_filter< package_diagram::model::diagram, common::model::package, common::string_or_regex >
 
using package_dependencies_filter_t = edge_traversal_filter< package_diagram::model::diagram, common::model::package, common::string_or_regex >
 
using source_file_dependency_filter_t = edge_traversal_filter< include_diagram::model::diagram, common::model::source_file, std::string, common::model::source_file >
 
using namespace_ = path
 
using filesystem_path = common::model::path
 

Enumerations

enum class  diagram_t { kClass , kSequence , kPackage , kInclude }
 
enum class  module_access_t { kPublic , kPrivate }
 
enum class  access_t { kPublic , kProtected , kPrivate , kNone }
 
enum class  relationship_t {
  kNone , kExtension , kComposition , kAggregation ,
  kContainment , kOwnership , kAssociation , kInstantiation ,
  kFriendship , kAlias , kDependency , kConstraint
}
 
enum class  message_t {
  kCall , kReturn , kIf , kElse ,
  kElseIf , kIfEnd , kWhile , kWhileEnd ,
  kDo , kDoEnd , kFor , kForEnd ,
  kTry , kCatch , kTryEnd , kSwitch ,
  kCase , kSwitchEnd , kConditional , kConditionalElse ,
  kConditionalEnd , kCoReturn , kCoAwait , kCoYield ,
  kNone
}
 Types of sequence diagram activity elements. More...
 
enum class  message_scope_t { kNormal , kCondition }
 The scope of the call expression represented in the sequence diagram. More...
 
enum class  filter_t { kInclusive , kExclusive }
 
enum class  path_type { kNamespace , kFilesystem , kModule }
 Type of diagram path. More...
 
enum class  source_file_t { kDirectory , kHeader , kImplementation }
 
enum class  template_parameter_kind_t {
  template_type , template_template_type , non_type_template , argument ,
  concept_constraint , empty
}
 
enum class  rpqualifier { kLValueReference , kRValueReference , kPointer , kNone }
 

Functions

template<>
bool check_diagram_type< clanguml::class_diagram::model::diagram > (diagram_t t)
 
template<>
bool check_diagram_type< clanguml::class_diagram::model::diagram > (diagram_t t)
 
void to_json (nlohmann::json &j, const source_location &sl)
 
void to_json (nlohmann::json &j, const element &c)
 
void to_json (nlohmann::json &j, const template_parameter &c)
 
void to_json (nlohmann::json &j, const relationship &c)
 
void to_json (json &j, const source_location &sl)
 
void to_json (json &j, const element &c)
 
void to_json (json &j, const template_parameter &c)
 
void to_json (json &j, const relationship &c)
 
template<typename T >
bool needs_root_prefix (const T &e)
 
template<typename DiagramT >
bool check_diagram_type (diagram_t t)
 
bool operator== (const diagram_element &l, const diagram_element &r)
 
std::ostream & operator<< (std::ostream &out, const diagram_element &rhs)
 
bool operator== (const element &l, const element &r)
 
std::ostream & operator<< (std::ostream &out, const element &rhs)
 
bool is_return (message_t t)
 
std::string to_string (relationship_t r)
 
std::string to_string (access_t a)
 
std::string to_string (module_access_t a)
 
std::string to_string (message_t r)
 
std::string to_string (const diagram_t t)
 
std::string to_string (const message_scope_t t)
 
diagram_t from_string (const std::string &s)
 
template<>
bool diagram_filter::should_include< std::string > (const std::string &name) const
 
template<typename Collection >
void apply_filter (Collection &col, const diagram_filter &filter)
 
template<typename T >
void apply_filter (std::vector< std::reference_wrapper< T > > &col, const diagram_filter &filter)
 
template<>
bool diagram_filter::should_include< std::string > (const std::string &name) const
 
std::string to_string (const path_type pt)
 
bool operator== (const relationship &l, const relationship &r)
 
std::string to_string (source_file_t sf)
 
std::string to_string (template_parameter_kind_t k)
 
int calculate_template_params_specialization_match (const std::vector< template_parameter > &specialization, const std::vector< template_parameter > &base_template)
 Calculate the match between 2 template parameter lists.
 
YAML::Emitter & operator<< (YAML::Emitter &out, const namespace_ &n)
 
YAML::Emitter & operator<< (YAML::Emitter &out, const relationship_t &r)
 
YAML::Emitter & operator<< (YAML::Emitter &out, const access_t &r)
 
YAML::Emitter & operator<< (YAML::Emitter &out, const diagram_t &d)
 
YAML::Emitter & operator<< (YAML::Emitter &out, const module_access_t &a)
 
template<>
bool check_diagram_type< include_diagram::model::diagram > (diagram_t t)
 
template<>
bool check_diagram_type< clanguml::include_diagram::model::diagram > (diagram_t t)
 
template<>
bool check_diagram_type< clanguml::package_diagram::model::diagram > (diagram_t t)
 
template<>
bool check_diagram_type< clanguml::package_diagram::model::diagram > (diagram_t t)
 
template<>
bool check_diagram_type< clanguml::sequence_diagram::model::diagram > (diagram_t t)
 
template<>
bool check_diagram_type< clanguml::sequence_diagram::model::diagram > (diagram_t t)
 

Typedef Documentation

◆ class_dependants_filter_t

Definition at line 28 of file diagram_filter_factory.h.

◆ class_dependencies_filter_t

Definition at line 31 of file diagram_filter_factory.h.

◆ comment_t

using clanguml::common::model::comment_t = typedef inja::json

Definition at line 35 of file decorated_element.h.

◆ filesystem_path

Definition at line 56 of file source_file.h.

◆ namespace_

Definition at line 32 of file namespace.h.

◆ package_dependants_filter_t

Definition at line 35 of file diagram_filter_factory.h.

◆ package_dependencies_filter_t

Definition at line 38 of file diagram_filter_factory.h.

◆ source_file_dependency_filter_t

Definition at line 42 of file diagram_filter_factory.h.

◆ specializations_filter_t

Definition at line 24 of file diagram_filter_factory.h.

Enumeration Type Documentation

◆ access_t

Enumerator
kPublic 
kProtected 
kPrivate 
kNone 

Definition at line 29 of file enums.h.

◆ diagram_t

Enumerator
kClass 
kSequence 
kPackage 
kInclude 

Definition at line 26 of file enums.h.

◆ filter_t

Diagram filters can be add in 2 modes:

  • inclusive - the elements that match are included in the diagram
  • exclusive - the elements that match are excluded from the diagram
Enumerator
kInclusive 

Filter is inclusive

kExclusive 

Filter is exclusve

Definition at line 50 of file diagram_filter.h.

50 {
51 kInclusive, /*!< Filter is inclusive */
52 kExclusive /*!< Filter is exclusve */
53};

◆ message_scope_t

The scope of the call expression represented in the sequence diagram.

Enumerator
kNormal 
kCondition 

Definition at line 78 of file enums.h.

78 {
79 kNormal, // This is a regular call expression
80 kCondition // This is a call expression from within a control condition
81 // e.g if(a->is_valid()) { ... }
82};

◆ message_t

Types of sequence diagram activity elements.

Enumerator
kCall 
kReturn 
kIf 
kElse 
kElseIf 
kIfEnd 
kWhile 
kWhileEnd 
kDo 
kDoEnd 
kFor 
kForEnd 
kTry 
kCatch 
kTryEnd 
kSwitch 
kCase 
kSwitchEnd 
kConditional 
kConditionalElse 
kConditionalEnd 
kCoReturn 
kCoAwait 
kCoYield 
kNone 

Definition at line 47 of file enums.h.

47 {
48 kCall,
49 kReturn,
50 kIf,
51 kElse,
52 kElseIf,
53 kIfEnd,
54 kWhile,
56 kDo,
57 kDoEnd,
58 kFor,
59 kForEnd,
60 kTry,
61 kCatch,
62 kTryEnd,
63 kSwitch,
64 kCase,
72 kNone
73};

◆ module_access_t

Enumerator
kPublic 
kPrivate 

Definition at line 28 of file enums.h.

28{ kPublic, kPrivate };

◆ path_type

Type of diagram path.

Paths in diagrams represent the nest structure within a diagram, e.g. a nested set of namespaces or nested set of directories.

Enumerator
kNamespace 

Namespace path

kFilesystem 

Filesystem path

kModule 

Module path

Definition at line 34 of file path.h.

34 {
35 kNamespace, /*!< Namespace path */
36 kFilesystem, /*!< Filesystem path */
37 kModule /*!< Module path */
38};

◆ relationship_t

Enumerator
kNone 
kExtension 
kComposition 
kAggregation 
kContainment 
kOwnership 
kAssociation 
kInstantiation 
kFriendship 
kAlias 
kDependency 
kConstraint 

Definition at line 31 of file enums.h.

◆ rpqualifier

Enum representing type of reference or pointer type qualifier

Enumerator
kLValueReference 

l-value reference (e.g. &)

kRValueReference 

r-value reference (e.g. &&)

kPointer 

pointer (e.g *)

kNone 

No qualifier

Definition at line 57 of file template_parameter.h.

57 {
58 kLValueReference, /*!< l-value reference (e.g. &) */
59 kRValueReference, /*!< r-value reference (e.g. &&) */
60 kPointer, /*!< pointer (e.g *) */
61 kNone /*!< No qualifier */
62};

◆ source_file_t

This enum represents different kinds of files in the diagram.

Enumerator
kDirectory 

Diagram element is a directory

kHeader 

Diagram element is a header

kImplementation 

Diagram element is a source file (e.g. cpp)

Definition at line 40 of file source_file.h.

40 {
41 kDirectory, /*!< Diagram element is a directory */
42 kHeader, /*!< Diagram element is a header */
43 kImplementation /*!< Diagram element is a source file (e.g. cpp) */
44};

◆ template_parameter_kind_t

Type of template parameter or argument.

Enumerator
template_type 

Template type, e.g. <typename T>

template_template_type 

Template template type, e.g. <typename <> T>

non_type_template 

Non type template parameter, e.g. <int N>

argument 

Template argument, e.g. <int>

concept_constraint 

Concept constraint, e.g. <std::integral T>

empty 

Represent empty template specialization

Definition at line 43 of file template_parameter.h.

43 {
44 template_type, /*!< Template type, e.g. <typename T> */
45 template_template_type, /*!< Template template type, e.g. <typename <> T> */
46 non_type_template, /*!< Non type template parameter, e.g. <int N> */
47 argument, /*!< Template argument, e.g. <int> */
48 concept_constraint, /*!< Concept constraint, e.g. <std::integral T> */
49 empty /*!< Represent empty template specialization */
50};

Function Documentation

◆ apply_filter() [1/2]

template<typename Collection >
void clanguml::common::model::apply_filter ( Collection &  col,
const diagram_filter filter 
)

Definition at line 958 of file diagram_filter.h.

959{
960 col.erase(std::remove_if(col.begin(), col.end(),
961 [&filter](auto &&element) {
962 return !filter.should_include(element);
963 }),
964 col.end());
965}

◆ apply_filter() [2/2]

template<typename T >
void clanguml::common::model::apply_filter ( std::vector< std::reference_wrapper< T > > &  col,
const diagram_filter filter 
)

Definition at line 968 of file diagram_filter.h.

970{
971 col.erase(std::remove_if(col.begin(), col.end(),
972 [&filter](auto &&element) {
973 return !filter.should_include(element.get());
974 }),
975 col.end());
976}

◆ calculate_template_params_specialization_match()

int clanguml::common::model::calculate_template_params_specialization_match ( const std::vector< template_parameter > &  specialization,
const std::vector< template_parameter > &  base_template 
)

Calculate the match between 2 template parameter lists.

The higher the value, the more likely it is that *this is a specialization of base_template_parameter.

Todo:
This is not scientific - there probably is more strict way to calculate this...
Parameters
base_template_parameter
Returns
Specialization match value

Definition at line 647 of file template_parameter.cc.

650{
651 int res{0};
652
653 if (specialization_params.size() != template_params.size() &&
654 !std::any_of(template_params.begin(), template_params.end(),
655 [](const auto &t) { return t.is_variadic(); })) {
656 return 0;
657 }
658
659 if (!specialization_params.empty() && !template_params.empty()) {
660 auto template_index{0U};
661 auto arg_index{0U};
662
663 while (arg_index < specialization_params.size() &&
664 template_index < template_params.size()) {
665 auto match = specialization_params.at(arg_index)
666 .calculate_specialization_match(
667 template_params.at(template_index));
668
669 if (match == 0) {
670 // If any of the matches is 0 - the entire match fails
671 return 0;
672 }
673
674 // Add 1 point if the current specialization param is an argument
675 // as it's a more specific match than 2 template params
676 if (!specialization_params.at(arg_index).is_template_parameter())
677 res++;
678
679 // Add 1 point if the current template param is an argument
680 // as it's a more specific match than 2 template params
681 if (!template_params.at(template_index).is_template_parameter())
682 res++;
683
684 if (!template_params.at(template_index).is_variadic())
685 template_index++;
686
687 res += match;
688
689 arg_index++;
690 }
691
692 if (arg_index == specialization_params.size()) {
693 // Check also backwards to make sure that trailing non-variadic
694 // params match after a variadic parameter
695 template_index = template_params.size() - 1;
696 arg_index = specialization_params.size() - 1;
697
698 while (true) {
699 auto match = specialization_params.at(arg_index)
700 .calculate_specialization_match(
701 template_params.at(template_index));
702 if (match == 0) {
703 return 0;
704 }
705
706 if (arg_index == 0 || template_index == 0)
707 break;
708
709 arg_index--;
710
711 if (!template_params.at(template_index).is_variadic())
712 template_index--;
713 else
714 break;
715 }
716
717 return res;
718 }
719
720 return 0;
721 }
722
723 return 0;
724}

◆ check_diagram_type()

template<typename DiagramT >
bool clanguml::common::model::check_diagram_type ( diagram_t  t)

◆ check_diagram_type< clanguml::class_diagram::model::diagram >() [1/2]

Definition at line 314 of file diagram.cc.

315{
316 return t == diagram_t::kClass;
317}

◆ check_diagram_type< clanguml::class_diagram::model::diagram >() [2/2]

Definition at line 314 of file diagram.cc.

315{
316 return t == diagram_t::kClass;
317}

◆ check_diagram_type< clanguml::include_diagram::model::diagram >()

◆ check_diagram_type< clanguml::package_diagram::model::diagram >() [1/2]

Definition at line 96 of file diagram.cc.

97{
98 return t == diagram_t::kPackage;
99}

◆ check_diagram_type< clanguml::package_diagram::model::diagram >() [2/2]

Definition at line 96 of file diagram.cc.

97{
98 return t == diagram_t::kPackage;
99}

◆ check_diagram_type< clanguml::sequence_diagram::model::diagram >() [1/2]

Definition at line 751 of file diagram.cc.

752{
753 return t == diagram_t::kSequence;
754}

◆ check_diagram_type< clanguml::sequence_diagram::model::diagram >() [2/2]

Definition at line 751 of file diagram.cc.

752{
753 return t == diagram_t::kSequence;
754}

◆ check_diagram_type< include_diagram::model::diagram >()

Definition at line 143 of file diagram.cc.

144{
145 return t == diagram_t::kInclude;
146}

◆ diagram_filter::should_include< std::string >() [1/2]

template<>
bool clanguml::common::model::diagram_filter::should_include< std::string > ( const std::string &  name) const

Definition at line 1401 of file diagram_filter.cc.

1402{
1403 if (name.empty())
1404 return false;
1405
1406 auto [ns, n] = common::split_ns(name);
1407
1408 return should_include(ns, n);
1409}

◆ diagram_filter::should_include< std::string >() [2/2]

template<>
bool clanguml::common::model::diagram_filter::should_include< std::string > ( const std::string &  name) const

Definition at line 1401 of file diagram_filter.cc.

1402{
1403 if (name.empty())
1404 return false;
1405
1406 auto [ns, n] = common::split_ns(name);
1407
1408 return should_include(ns, n);
1409}

◆ from_string()

diagram_t clanguml::common::model::from_string ( const std::string &  s)

Definition at line 181 of file enums.cc.

182{
183 if (s == "class")
184 return diagram_t::kClass;
185 if (s == "sequence")
186 return diagram_t::kSequence;
187 if (s == "include")
188 return diagram_t::kInclude;
189 if (s == "package")
190 return diagram_t::kPackage;
191
192 throw std::runtime_error{"Invalid diagram type: " + s};
193}

◆ is_return()

bool clanguml::common::model::is_return ( message_t  t)

Definition at line 25 of file enums.cc.

26{
27 return t == message_t::kReturn || t == message_t::kCoReturn ||
28 t == message_t::kCoYield;
29}

◆ needs_root_prefix()

template<typename T >
bool clanguml::common::model::needs_root_prefix ( const T &  e)

Definition at line 184 of file diagram.h.

185{
186 if (e.get_namespace().type() != model::path_type::kNamespace)
187 return false;
188
189 if (e.using_namespace().is_empty())
190 return false;
191
192 return !util::starts_with(
193 e.full_name(false), e.using_namespace().to_string());
194}

◆ operator<<() [1/3]

std::ostream & clanguml::common::model::operator<< ( std::ostream &  out,
const diagram_element rhs 
)

Definition at line 123 of file diagram_element.cc.

124{
125 out << "(" << rhs.name() << ", full_name=[" << rhs.full_name(false) << "])";
126
127 return out;
128}

◆ operator<<() [2/3]

std::ostream & clanguml::common::model::operator<< ( std::ostream &  out,
const element rhs 
)

Definition at line 42 of file element.cc.

43{
44 out << "(" << rhs.name() << ", ns=[" << rhs.get_namespace().to_string()
45 << "], full_name=[" << rhs.full_name(true) << "], id=["
46 << rhs.id().value() << "], type_name=" << rhs.type_name() << ")";
47
48 return out;
49}

◆ operator<<() [3/3]

YAML::Emitter & clanguml::common::model::operator<< ( YAML::Emitter &  out,
const module_access_t a 
)

Definition at line 72 of file yaml_emitters.cc.

73{
74 out << to_string(a);
75 return out;
76}

◆ operator==() [1/3]

bool clanguml::common::model::operator== ( const diagram_element l,
const diagram_element r 
)

Definition at line 118 of file diagram_element.cc.

119{
120 return l.id() == r.id();
121}

◆ operator==() [2/3]

bool clanguml::common::model::operator== ( const element l,
const element r 
)

Definition at line 36 of file element.cc.

37{
38 return (l.type_name() == l.type_name()) &&
39 (l.full_name(false) == r.full_name(false));
40}

◆ operator==() [3/3]

bool clanguml::common::model::operator== ( const relationship l,
const relationship r 
)

Definition at line 93 of file relationship.cc.

94{
95 return l.type() == r.type() && l.destination() == r.destination() &&
96 l.label() == r.label();
97}

◆ to_json() [1/8]

void clanguml::common::model::to_json ( json &  j,
const element c 
)

◆ to_json() [2/8]

void clanguml::common::model::to_json ( json &  j,
const relationship c 
)

◆ to_json() [3/8]

void clanguml::common::model::to_json ( json &  j,
const source_location sl 
)

◆ to_json() [4/8]

void clanguml::common::model::to_json ( json &  j,
const template_parameter c 
)

◆ to_json() [5/8]

void clanguml::common::model::to_json ( nlohmann::json &  j,
const element c 
)

Definition at line 34 of file generator.cc.

35{
36 j = json{{"id", std::to_string(c.id().value())}, {"name", c.name()},
37 {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()},
38 {"display_name", display_name_adapter(c).full_name(true)}};
39
40 if (const auto &comment = c.comment(); comment)
41 j["comment"] = comment.value();
42
43 if (!c.file().empty()) {
44 j["source_location"] =
45 dynamic_cast<const common::model::source_location &>(c);
46 }
47}

◆ to_json() [6/8]

void clanguml::common::model::to_json ( nlohmann::json &  j,
const relationship c 
)

Definition at line 62 of file generator.cc.

63{
64 j["type"] = to_string(c.type());
65 j["destination"] = std::to_string(c.destination().value());
66 if (!c.multiplicity_source().empty())
67 j["multiplicity_source"] = c.multiplicity_source();
68 if (!c.multiplicity_destination().empty())
69 j["multiplicity_destination"] = c.multiplicity_destination();
70 if (c.access() != access_t::kNone)
71 j["access"] = to_string(c.access());
72 if (!c.label().empty())
73 j["label"] = c.label();
74 if (const auto &comment = c.comment(); comment)
75 j["comment"] = comment.value();
76}

◆ to_json() [7/8]

void clanguml::common::model::to_json ( nlohmann::json &  j,
const source_location sl 
)

Definition at line 27 of file generator.cc.

28{
29 j = json{{"file", sl.file_relative()},
30 {"translation_unit", sl.translation_unit()}, {"line", sl.line()},
31 {"column", sl.column()}};
32}

◆ to_json() [8/8]

void clanguml::common::model::to_json ( nlohmann::json &  j,
const template_parameter c 
)

Definition at line 49 of file generator.cc.

50{
51 j["kind"] = to_string(c.kind());
52 if (const auto &t = c.type(); t)
53 j["type"] = t.value();
54 if (const auto &n = c.name(); n)
55 j["name"] = n.value();
56 if (const auto &d = c.default_value(); d)
57 j["default"] = d.value();
58 j["is_variadic"] = c.is_variadic();
59 j["template_parameters"] = c.template_params();
60}

◆ to_string() [1/9]

std::string clanguml::common::model::to_string ( access_t  a)

Definition at line 64 of file enums.cc.

65{
66 switch (a) {
67 case access_t::kPublic:
68 return "public";
69 case access_t::kProtected:
70 return "protected";
71 case access_t::kPrivate:
72 return "private";
73 case access_t::kNone:
74 return "none";
75 default:
76 assert(false);
77 return "";
78 }
79}

◆ to_string() [2/9]

std::string clanguml::common::model::to_string ( const diagram_t  t)

Definition at line 151 of file enums.cc.

152{
153 switch (t) {
154 case diagram_t::kClass:
155 return "class";
156 case diagram_t::kSequence:
157 return "sequence";
158 case diagram_t::kPackage:
159 return "package";
160 case diagram_t::kInclude:
161 return "include";
162 default:
163 assert(false);
164 return "";
165 }
166}

◆ to_string() [3/9]

std::string clanguml::common::model::to_string ( const message_scope_t  t)

Definition at line 168 of file enums.cc.

169{
170 switch (t) {
171 case message_scope_t::kNormal:
172 return "normal";
173 case message_scope_t::kCondition:
174 return "condition";
175 default:
176 assert(false);
177 return "";
178 }
179}

◆ to_string() [4/9]

std::string clanguml::common::model::to_string ( const path_type  pt)

Definition at line 23 of file path.cc.

24{
25 switch (pt) {
26 case path_type::kModule:
27 return "module";
28 case path_type::kNamespace:
29 return "namespace";
30 case path_type::kFilesystem:
31 return "directory";
32 default:
33 assert(false);
34 return "";
35 }
36}

◆ to_string() [5/9]

std::string clanguml::common::model::to_string ( message_t  r)

Definition at line 94 of file enums.cc.

95{
96 switch (r) {
97 case message_t::kCall:
98 return "call";
99 case message_t::kReturn:
100 return "return";
101 case message_t::kIf:
102 return "if";
103 case message_t::kElse:
104 return "else";
105 case message_t::kElseIf:
106 return "else if";
107 case message_t::kIfEnd:
108 return "end if";
109 case message_t::kWhile:
110 return "while";
111 case message_t::kWhileEnd:
112 return "end while";
113 case message_t::kDo:
114 return "do";
115 case message_t::kDoEnd:
116 return "end do";
117 case message_t::kFor:
118 return "for";
119 case message_t::kForEnd:
120 return "end for";
121 case message_t::kTry:
122 return "try";
123 case message_t::kCatch:
124 return "catch";
125 case message_t::kTryEnd:
126 return "end try";
127 case message_t::kSwitch:
128 return "switch";
129 case message_t::kCase:
130 return "case";
131 case message_t::kSwitchEnd:
132 return "end switch";
133 case message_t::kConditional:
134 return "conditional";
135 case message_t::kConditionalElse:
136 return "conditional else";
137 case message_t::kConditionalEnd:
138 return "end conditional";
139 case message_t::kCoReturn:
140 return "co_return";
141 case message_t::kCoYield:
142 return "co_yield";
143 case message_t::kCoAwait:
144 return "co_await";
145 default:
146 assert(false);
147 return "";
148 }
149}

◆ to_string() [6/9]

std::string clanguml::common::model::to_string ( module_access_t  a)

Definition at line 81 of file enums.cc.

82{
83 switch (a) {
84 case module_access_t::kPublic:
85 return "public";
86 case module_access_t::kPrivate:
87 return "private";
88 default:
89 assert(false);
90 return "";
91 }
92}

◆ to_string() [7/9]

std::string clanguml::common::model::to_string ( relationship_t  r)

Definition at line 31 of file enums.cc.

32{
33 switch (r) {
34 case relationship_t::kNone:
35 return "none";
36 case relationship_t::kExtension:
37 return "extension";
38 case relationship_t::kComposition:
39 return "composition";
40 case relationship_t::kAggregation:
41 return "aggregation";
42 case relationship_t::kContainment:
43 return "containment";
44 case relationship_t::kOwnership:
45 return "ownership";
46 case relationship_t::kAssociation:
47 return "association";
48 case relationship_t::kInstantiation:
49 return "instantiation";
50 case relationship_t::kFriendship:
51 return "friendship";
52 case relationship_t::kDependency:
53 return "dependency";
54 case relationship_t::kAlias:
55 return "alias";
56 case relationship_t::kConstraint:
57 return "constraint";
58 default:
59 assert(false);
60 return "";
61 }
62}

◆ to_string() [8/9]

std::string clanguml::common::model::to_string ( source_file_t  sf)

Definition at line 23 of file source_file.cc.

24{
25 switch (sf) {
26 case source_file_t::kDirectory:
27 return "directory";
28 case source_file_t::kHeader:
29 return "header";
30 case source_file_t::kImplementation:
31 return "implementation";
32 default:
33 assert(false);
34 return "";
35 }
36}

◆ to_string() [9/9]

std::string clanguml::common::model::to_string ( template_parameter_kind_t  k)

Definition at line 61 of file template_parameter.cc.

62{
63 switch (k) {
64 case template_parameter_kind_t::template_type:
65 return "template_type";
66 case template_parameter_kind_t::template_template_type:
67 return "template_template_type";
68 case template_parameter_kind_t::non_type_template:
69 return "non_type_template";
70 case template_parameter_kind_t::argument:
71 return "argument";
72 case template_parameter_kind_t::concept_constraint:
73 return "concept_constraint";
74 case template_parameter_kind_t::empty:
75 return "empty";
76 default:
77 assert(false);
78 return "";
79 }
80}