0.6.0
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 , 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)
 
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 73 of file enums.h.

73 {
74 kNormal, // This is a regular call expression
75 kCondition // This is a call expression from within a control condition
76 // e.g if(a->is_valid()) { ... }
77};

◆ 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 
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,
69 kNone
70};

◆ 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 856 of file diagram_filter.h.

857{
858 col.erase(std::remove_if(col.begin(), col.end(),
859 [&filter](auto &&element) {
860 return !filter.should_include(element);
861 }),
862 col.end());
863}

◆ 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 866 of file diagram_filter.h.

868{
869 col.erase(std::remove_if(col.begin(), col.end(),
870 [&filter](auto &&element) {
871 return !filter.should_include(element.get());
872 }),
873 col.end());
874}

◆ 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 646 of file template_parameter.cc.

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

◆ 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 304 of file diagram.cc.

305{
306 return t == diagram_t::kClass;
307}

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

Definition at line 304 of file diagram.cc.

305{
306 return t == diagram_t::kClass;
307}

◆ 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 708 of file diagram.cc.

709{
710 return t == diagram_t::kSequence;
711}

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

Definition at line 708 of file diagram.cc.

709{
710 return t == diagram_t::kSequence;
711}

◆ 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 1390 of file diagram_filter.cc.

1391{
1392 if (name.empty())
1393 return false;
1394
1395 auto [ns, n] = common::split_ns(name);
1396
1397 return should_include(ns, n);
1398}

◆ 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 1390 of file diagram_filter.cc.

1391{
1392 if (name.empty())
1393 return false;
1394
1395 auto [ns, n] = common::split_ns(name);
1396
1397 return should_include(ns, n);
1398}

◆ from_string()

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

Definition at line 169 of file enums.cc.

170{
171 if (s == "class")
172 return diagram_t::kClass;
173 if (s == "sequence")
174 return diagram_t::kSequence;
175 if (s == "include")
176 return diagram_t::kInclude;
177 if (s == "package")
178 return diagram_t::kPackage;
179
180 throw std::runtime_error{"Invalid diagram type: " + s};
181}

◆ needs_root_prefix()

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

Definition at line 176 of file diagram.h.

177{
178 if (e.get_namespace().type() != model::path_type::kNamespace)
179 return false;
180
181 if (e.using_namespace().is_empty())
182 return false;
183
184 return !util::starts_with(
185 e.full_name(false), e.using_namespace().to_string());
186}

◆ 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) << "])";
46
47 return out;
48}

◆ 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 58 of file enums.cc.

59{
60 switch (a) {
61 case access_t::kPublic:
62 return "public";
63 case access_t::kProtected:
64 return "protected";
65 case access_t::kPrivate:
66 return "private";
67 case access_t::kNone:
68 return "none";
69 default:
70 assert(false);
71 return "";
72 }
73}

◆ to_string() [2/9]

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

Definition at line 139 of file enums.cc.

140{
141 switch (t) {
142 case diagram_t::kClass:
143 return "class";
144 case diagram_t::kSequence:
145 return "sequence";
146 case diagram_t::kPackage:
147 return "package";
148 case diagram_t::kInclude:
149 return "include";
150 default:
151 assert(false);
152 return "";
153 }
154}

◆ to_string() [3/9]

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

Definition at line 156 of file enums.cc.

157{
158 switch (t) {
159 case message_scope_t::kNormal:
160 return "normal";
161 case message_scope_t::kCondition:
162 return "condition";
163 default:
164 assert(false);
165 return "";
166 }
167}

◆ 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 88 of file enums.cc.

89{
90 switch (r) {
91 case message_t::kCall:
92 return "call";
93 case message_t::kReturn:
94 return "return";
95 case message_t::kIf:
96 return "if";
97 case message_t::kElse:
98 return "else";
99 case message_t::kElseIf:
100 return "else if";
101 case message_t::kIfEnd:
102 return "end if";
103 case message_t::kWhile:
104 return "while";
105 case message_t::kWhileEnd:
106 return "end while";
107 case message_t::kDo:
108 return "do";
109 case message_t::kDoEnd:
110 return "end do";
111 case message_t::kFor:
112 return "for";
113 case message_t::kForEnd:
114 return "end for";
115 case message_t::kTry:
116 return "try";
117 case message_t::kCatch:
118 return "catch";
119 case message_t::kTryEnd:
120 return "end try";
121 case message_t::kSwitch:
122 return "switch";
123 case message_t::kCase:
124 return "case";
125 case message_t::kSwitchEnd:
126 return "end switch";
127 case message_t::kConditional:
128 return "conditional";
129 case message_t::kConditionalElse:
130 return "conditional else";
131 case message_t::kConditionalEnd:
132 return "end conditional";
133 default:
134 assert(false);
135 return "";
136 }
137}

◆ to_string() [6/9]

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

Definition at line 75 of file enums.cc.

76{
77 switch (a) {
78 case module_access_t::kPublic:
79 return "public";
80 case module_access_t::kPrivate:
81 return "private";
82 default:
83 assert(false);
84 return "";
85 }
86}

◆ to_string() [7/9]

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

Definition at line 25 of file enums.cc.

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

◆ 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}