0.5.4
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-2024 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
 
class  filter_visitor
 Base class for any diagram filter. More...
 
struct  fs_path_sep
 
struct  method_type_filter
 
struct  module_access_filter
 
struct  modules_filter
 
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
}
 
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 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 27 of file enums.h.

◆ diagram_t

Enumerator
kClass 
kSequence 
kPackage 
kInclude 

Definition at line 24 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 49 of file diagram_filter.h.

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

◆ message_scope_t

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

Enumerator
kNormal 
kCondition 

Definition at line 71 of file enums.h.

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

◆ 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 45 of file enums.h.

45 {
46 kCall,
47 kReturn,
48 kIf,
49 kElse,
50 kElseIf,
51 kIfEnd,
52 kWhile,
54 kDo,
55 kDoEnd,
56 kFor,
57 kForEnd,
58 kTry,
59 kCatch,
60 kTryEnd,
61 kSwitch,
62 kCase,
67 kNone
68};

◆ module_access_t

Enumerator
kPublic 
kPrivate 

Definition at line 26 of file enums.h.

26{ 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 29 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 50 of file template_parameter.h.

50 {
51 kLValueReference, /*!< l-value reference (e.g. &) */
52 kRValueReference, /*!< r-value reference (e.g. &&) */
53 kPointer, /*!< pointer (e.g *) */
54 kNone /*!< No qualifier */
55};

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

Definition at line 37 of file template_parameter.h.

37 {
38 template_type, /*!< Template type, e.g. <typename T> */
39 template_template_type, /*!< Template template type, e.g. <typename <> T> */
40 non_type_template, /*!< Non type template parameter, e.g. <int N> */
41 argument, /*!< Template argument, e.g. <int> */
42 concept_constraint /*!< Concept constraint, e.g. <std::integral T> */
43};

Function Documentation

◆ apply_filter() [1/2]

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

Definition at line 835 of file diagram_filter.h.

836{
837 col.erase(std::remove_if(col.begin(), col.end(),
838 [&filter](auto &&element) {
839 return !filter.should_include(element);
840 }),
841 col.end());
842}

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

847{
848 col.erase(std::remove_if(col.begin(), col.end(),
849 [&filter](auto &&element) {
850 return !filter.should_include(element.get());
851 }),
852 col.end());
853}

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

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

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

302{
303 return t == diagram_t::kClass;
304}

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

Definition at line 301 of file diagram.cc.

302{
303 return t == diagram_t::kClass;
304}

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

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

Definition at line 100 of file diagram.cc.

101{
102 return t == diagram_t::kPackage;
103}

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

Definition at line 100 of file diagram.cc.

101{
102 return t == diagram_t::kPackage;
103}

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

Definition at line 683 of file diagram.cc.

684{
685 return t == diagram_t::kSequence;
686}

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

Definition at line 683 of file diagram.cc.

684{
685 return t == diagram_t::kSequence;
686}

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

Definition at line 161 of file diagram.cc.

162{
163 return t == diagram_t::kInclude;
164}

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

1126{
1127 if (name.empty())
1128 return false;
1129
1130 auto [ns, n] = common::split_ns(name);
1131
1132 return should_include(ns, n);
1133}

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

1126{
1127 if (name.empty())
1128 return false;
1129
1130 auto [ns, n] = common::split_ns(name);
1131
1132 return should_include(ns, n);
1133}

◆ from_string()

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

Definition at line 167 of file enums.cc.

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

◆ operator<<() [1/3]

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

Definition at line 124 of file diagram_element.cc.

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

◆ operator<<() [2/3]

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

Definition at line 52 of file element.cc.

53{
54 out << "(" << rhs.name() << ", ns=[" << rhs.get_namespace().to_string()
55 << "], full_name=[" << rhs.full_name(true) << "])";
56
57 return out;
58}

◆ 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 119 of file diagram_element.cc.

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

◆ operator==() [2/3]

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

Definition at line 47 of file element.cc.

48{
49 return l.full_name(false) == r.full_name(false);
50}

◆ operator==() [3/3]

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

Definition at line 78 of file relationship.cc.

79{
80 return l.type() == r.type() && l.destination() == r.destination() &&
81 l.label() == r.label();
82}

◆ 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 32 of file generator.cc.

33{
34 j = json{{"id", std::to_string(c.id().value())},
35 {"name", common::generators::json::render_name(c.name())},
36 {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()},
37 {"display_name",
38 common::generators::json::render_name(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 25 of file generator.cc.

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

◆ 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 default:
68 assert(false);
69 return "";
70 }
71}

◆ to_string() [2/9]

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

Definition at line 137 of file enums.cc.

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

◆ to_string() [3/9]

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

Definition at line 154 of file enums.cc.

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

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

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

◆ to_string() [6/9]

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

Definition at line 73 of file enums.cc.

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

◆ 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 default:
75 assert(false);
76 return "";
77 }
78}