0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
clanguml::class_diagram::model::class_method Class Reference

Class method model. More...

Detailed Description

Class method model.

Definition at line 35 of file class_method.h.

#include <class_method.h>

Public Member Functions

 class_method (common::model::access_t access, const std::string &name, const std::string &type)
 Constructor.
 
 ~class_method () override=default
 
void update (const common::model::namespace_ &un)
 
std::string display_name () const
 Method name including template parameters/arguments if any.
 
void set_display_name (const std::string &display_name)
 
bool is_pure_virtual () const
 Whether the method is pure virtual.
 
void is_pure_virtual (bool is_pure_virtual)
 
bool is_virtual () const
 Whether the method is virtual.
 
void is_virtual (bool is_virtual)
 Set whether the method is virtual.
 
bool is_const () const
 Whether the method is const.
 
void is_const (bool is_const)
 Set whether the method is const.
 
bool is_defaulted () const
 Whether the method is defaulted.
 
void is_defaulted (bool is_defaulted)
 Set whether the method is defaulted.
 
bool is_deleted () const
 Whether the method is deleted.
 
void is_deleted (bool is_deleted)
 Set whether the method is deleted.
 
bool is_static () const
 Whether the method is static.
 
void is_static (bool is_static)
 Set whether the method is static.
 
bool is_constexpr () const
 Whether the method is constexpr.
 
void is_constexpr (bool is_constexpr)
 Set whether the method is constexpr.
 
bool is_consteval () const
 Whether the method is consteval.
 
void is_consteval (bool is_consteval)
 Set whether the method is consteval.
 
bool is_coroutine () const
 Whether the method is a C++20 coroutine.
 
void is_coroutine (bool is_coroutine)
 Set whether the method is a C++20 coroutine.
 
bool is_noexcept () const
 Whether the method is noexcept.
 
void is_noexcept (bool is_noexcept)
 Set whether the method is noexcept.
 
bool is_constructor () const
 Whether the method is a constructor.
 
void is_constructor (bool is_constructor)
 Set whether the method is a constructor.
 
bool is_destructor () const
 Whether the method is a destructor.
 
void is_destructor (bool is_destructor)
 Set whether the method is a destructor.
 
bool is_move_assignment () const
 Whether the method is move assignment.
 
void is_move_assignment (bool is_move_assignment)
 Set whether the method is a move assignment.
 
bool is_copy_assignment () const
 Whether the method is copy assignment.
 
void is_copy_assignment (bool is_copy_assignment)
 Set whether the method is a copy assignment.
 
bool is_operator () const
 Whether the method is an operator.
 
void is_operator (bool is_operator)
 Set whether the method is an operator.
 
const std::vector< method_parameter > & parameters () const
 Get the method parameters.
 
void add_parameter (method_parameter &&parameter)
 Add methods parameter.
 
- Public Member Functions inherited from clanguml::class_diagram::model::class_element
 class_element (common::model::access_t scope, std::string name, std::string type)
 
 ~class_element () override=default
 
common::model::access_t access () const
 Get elements access scope.
 
std::string name () const
 Get elements name.
 
void set_name (const std::string &name)
 Set elements name.
 
std::string type () const
 Get elements type as string.
 
void set_type (const std::string &type)
 Set elements type as string.
 
virtual inja::json context () const
 Get elements inja context in JSON.
 
- Public Member Functions inherited from clanguml::common::model::decorated_element
virtual ~decorated_element ()=default
 
bool skip () const
 
bool skip_relationship () const
 
std::pair< relationship_t, std::string > get_relationship () const
 
std::string style_spec () const
 
const std::vector< std::shared_ptr< decorators::decorator > > & decorators () const
 
void add_decorators (const std::vector< std::shared_ptr< decorators::decorator > > &decorators)
 
void append (const decorated_element &de)
 
std::optional< comment_tcomment () const
 
void set_comment (const comment_t &c)
 
virtual std::optional< std::string > doxygen_link () const
 
- Public Member Functions inherited from clanguml::common::model::source_location
 source_location ()=default
 
 source_location (std::string f, unsigned int l)
 
const std::string & file () const
 
void set_file (const std::string &file)
 
const std::string & file_relative () const
 
void set_file_relative (const std::string &file)
 
const std::string & translation_unit () const
 
void set_translation_unit (const std::string &translation_unit)
 
unsigned int line () const
 
void set_line (const unsigned line)
 
unsigned int column () const
 
void set_column (const unsigned column)
 
unsigned int location_id () const
 
void set_location_id (unsigned int h)
 
- Public Member Functions inherited from clanguml::common::model::template_trait
std::ostream & render_template_params (std::ostream &ostr, const common::model::namespace_ &using_namespace, bool relative) const
 
void add_template (template_parameter &&tmplt)
 
const std::vector< template_parameter > & template_params () const
 
int calculate_template_specialization_match (const template_trait &other) const
 Wrapper around calculate_template_params_specialization_match()
 

Private Attributes

std::vector< method_parameterparameters_
 
bool is_pure_virtual_ {false}
 
bool is_virtual_ {false}
 
bool is_const_ {false}
 
bool is_defaulted_ {false}
 
bool is_deleted_ {false}
 
bool is_static_ {false}
 
bool is_noexcept_ {false}
 
bool is_constexpr_ {false}
 
bool is_consteval_ {false}
 
bool is_coroutine_ {false}
 
bool is_constructor_ {false}
 
bool is_destructor_ {false}
 
bool is_move_assignment_ {false}
 
bool is_copy_assignment_ {false}
 
bool is_operator_ {false}
 
std::string display_name_
 

Constructor & Destructor Documentation

◆ class_method()

clanguml::class_diagram::model::class_method::class_method ( common::model::access_t  access,
const std::string &  name,
const std::string &  type 
)

Constructor.

Parameters
accessMethods access scope (e.g. public)
nameMethods name.
typeMethods return type as string.

Definition at line 23 of file class_method.cc.

26{
27}

◆ ~class_method()

clanguml::class_diagram::model::class_method::~class_method ( )
overridedefault

Member Function Documentation

◆ add_parameter()

void clanguml::class_diagram::model::class_method::add_parameter ( method_parameter &&  parameter)

Add methods parameter.

Parameters
parameterMethod parameter.

Definition at line 141 of file class_method.cc.

142{
143 parameters_.emplace_back(std::move(parameter));
144}

◆ display_name()

std::string clanguml::class_diagram::model::class_method::display_name ( ) const

Method name including template parameters/arguments if any.

Returns
String representation of the methods display name

Definition at line 42 of file class_method.cc.

42{ return display_name_; }

◆ is_const() [1/2]

bool clanguml::class_diagram::model::class_method::is_const ( ) const

Whether the method is const.

Returns
True, if the method is const

Definition at line 60 of file class_method.cc.

60{ return is_const_; }

◆ is_const() [2/2]

void clanguml::class_diagram::model::class_method::is_const ( bool  is_const)

Set whether the method is const.

Parameters
is_constTrue, if the method is const

Definition at line 62 of file class_method.cc.

◆ is_consteval() [1/2]

bool clanguml::class_diagram::model::class_method::is_consteval ( ) const

Whether the method is consteval.

Returns
True, if the method is consteval

Definition at line 86 of file class_method.cc.

86{ return is_consteval_; }

◆ is_consteval() [2/2]

void clanguml::class_diagram::model::class_method::is_consteval ( bool  is_consteval)

Set whether the method is consteval.

Parameters
is_constevalTrue, if the method is consteval

Definition at line 88 of file class_method.cc.

89{
91}

◆ is_constexpr() [1/2]

bool clanguml::class_diagram::model::class_method::is_constexpr ( ) const

Whether the method is constexpr.

Returns
True, if the method is constexpr

Definition at line 79 of file class_method.cc.

79{ return is_constexpr_; }

◆ is_constexpr() [2/2]

void clanguml::class_diagram::model::class_method::is_constexpr ( bool  is_constexpr)

Set whether the method is constexpr.

Parameters
is_constexprTrue, if the method is constexpr

Definition at line 81 of file class_method.cc.

82{
84}

◆ is_constructor() [1/2]

bool clanguml::class_diagram::model::class_method::is_constructor ( ) const

Whether the method is a constructor.

Returns
True, if the method is a constructor

Definition at line 104 of file class_method.cc.

104{ return is_constructor_; }

◆ is_constructor() [2/2]

void clanguml::class_diagram::model::class_method::is_constructor ( bool  is_constructor)

Set whether the method is a constructor.

Parameters
is_constructorTrue, if the method is a constructor

Definition at line 106 of file class_method.cc.

107{
109}

◆ is_copy_assignment() [1/2]

bool clanguml::class_diagram::model::class_method::is_copy_assignment ( ) const

Whether the method is copy assignment.

Returns
True, if the method is copy assignment

Definition at line 125 of file class_method.cc.

125{ return is_copy_assignment_; }

◆ is_copy_assignment() [2/2]

void clanguml::class_diagram::model::class_method::is_copy_assignment ( bool  is_copy_assignment)

Set whether the method is a copy assignment.

Parameters
is_copy_assignmentTrue, if the method is a copy assignment

Definition at line 127 of file class_method.cc.

◆ is_coroutine() [1/2]

bool clanguml::class_diagram::model::class_method::is_coroutine ( ) const

Whether the method is a C++20 coroutine.

Returns
True, if the method is a coroutine

Definition at line 93 of file class_method.cc.

93{ return is_coroutine_; }

◆ is_coroutine() [2/2]

void clanguml::class_diagram::model::class_method::is_coroutine ( bool  is_coroutine)

Set whether the method is a C++20 coroutine.

Parameters
is_coroutineTrue, if the method is a coroutine

Definition at line 95 of file class_method.cc.

96{
98}

◆ is_defaulted() [1/2]

bool clanguml::class_diagram::model::class_method::is_defaulted ( ) const

Whether the method is defaulted.

Returns
True, if the method is defaulted

Definition at line 64 of file class_method.cc.

64{ return is_defaulted_; }

◆ is_defaulted() [2/2]

void clanguml::class_diagram::model::class_method::is_defaulted ( bool  is_defaulted)

Set whether the method is defaulted.

Parameters
is_defaultedTrue, if the method is defaulted

Definition at line 66 of file class_method.cc.

67{
69}

◆ is_deleted() [1/2]

bool clanguml::class_diagram::model::class_method::is_deleted ( ) const

Whether the method is deleted.

Returns
True, if the method is deleted

Definition at line 71 of file class_method.cc.

71{ return is_deleted_; }

◆ is_deleted() [2/2]

void clanguml::class_diagram::model::class_method::is_deleted ( bool  is_deleted)

Set whether the method is deleted.

Parameters
is_deletedTrue, if the method is deleted

Definition at line 73 of file class_method.cc.

◆ is_destructor() [1/2]

bool clanguml::class_diagram::model::class_method::is_destructor ( ) const

Whether the method is a destructor.

Returns
True, if the method is a destructor

Definition at line 111 of file class_method.cc.

111{ return is_destructor_; }

◆ is_destructor() [2/2]

void clanguml::class_diagram::model::class_method::is_destructor ( bool  is_destructor)

Set whether the method is a destructor.

Parameters
is_destructorTrue, if the method is a destructor

Definition at line 113 of file class_method.cc.

114{
116}

◆ is_move_assignment() [1/2]

bool clanguml::class_diagram::model::class_method::is_move_assignment ( ) const

Whether the method is move assignment.

Returns
True, if the method is move assignment

Definition at line 118 of file class_method.cc.

118{ return is_move_assignment_; }

◆ is_move_assignment() [2/2]

void clanguml::class_diagram::model::class_method::is_move_assignment ( bool  is_move_assignment)

Set whether the method is a move assignment.

Parameters
is_move_assignmentTrue, if the method is a move assignment

Definition at line 120 of file class_method.cc.

◆ is_noexcept() [1/2]

bool clanguml::class_diagram::model::class_method::is_noexcept ( ) const

Whether the method is noexcept.

Returns
True, if the method is noexcept

Definition at line 100 of file class_method.cc.

100{ return is_noexcept_; }

◆ is_noexcept() [2/2]

void clanguml::class_diagram::model::class_method::is_noexcept ( bool  is_noexcept)

Set whether the method is noexcept.

Parameters
is_noexceptTrue, if the method is noexcept

Definition at line 102 of file class_method.cc.

◆ is_operator() [1/2]

bool clanguml::class_diagram::model::class_method::is_operator ( ) const

Whether the method is an operator.

Returns
True, if the method is an operator

Definition at line 132 of file class_method.cc.

132{ return is_operator_; }

◆ is_operator() [2/2]

void clanguml::class_diagram::model::class_method::is_operator ( bool  is_operator)

Set whether the method is an operator.

Parameters
is_copy_assignmentTrue, if the method is an operator

Definition at line 134 of file class_method.cc.

◆ is_pure_virtual() [1/2]

bool clanguml::class_diagram::model::class_method::is_pure_virtual ( ) const

Whether the method is pure virtual.

Returns
True, if the method is pure virtual

Definition at line 49 of file class_method.cc.

49{ return is_pure_virtual_; }

◆ is_pure_virtual() [2/2]

void clanguml::class_diagram::model::class_method::is_pure_virtual ( bool  is_pure_virtual)

Definition at line 51 of file class_method.cc.

◆ is_static() [1/2]

bool clanguml::class_diagram::model::class_method::is_static ( ) const

Whether the method is static.

Returns
True, if the method is static

Definition at line 75 of file class_method.cc.

75{ return is_static_; }

◆ is_static() [2/2]

void clanguml::class_diagram::model::class_method::is_static ( bool  is_static)

Set whether the method is static.

Parameters
is_staticTrue, if the method is static

Definition at line 77 of file class_method.cc.

◆ is_virtual() [1/2]

bool clanguml::class_diagram::model::class_method::is_virtual ( ) const

Whether the method is virtual.

Returns
True, if the method is virtual

Definition at line 56 of file class_method.cc.

56{ return is_virtual_; }

◆ is_virtual() [2/2]

void clanguml::class_diagram::model::class_method::is_virtual ( bool  is_virtual)

Set whether the method is virtual.

Parameters
is_virtualTrue, if the method is virtual

Definition at line 58 of file class_method.cc.

◆ parameters()

const std::vector< method_parameter > & clanguml::class_diagram::model::class_method::parameters ( ) const

Get the method parameters.

Returns
List of methods parameters

Definition at line 136 of file class_method.cc.

137{
138 return parameters_;
139}

◆ set_display_name()

void clanguml::class_diagram::model::class_method::set_display_name ( const std::string &  display_name)

Definition at line 44 of file class_method.cc.

45{
47}

◆ update()

void clanguml::class_diagram::model::class_method::update ( const common::model::namespace_ un)

Definition at line 29 of file class_method.cc.

30{
31 if (template_params().empty()) {
33 }
34 else {
35 std::stringstream template_params_str;
36 render_template_params(template_params_str, un, true);
38 fmt::format("{}{}", name(), template_params_str.str()));
39 }
40}

Member Data Documentation

◆ display_name_

std::string clanguml::class_diagram::model::class_method::display_name_
private

Definition at line 297 of file class_method.h.

◆ is_const_

bool clanguml::class_diagram::model::class_method::is_const_ {false}
private

Definition at line 283 of file class_method.h.

◆ is_consteval_

bool clanguml::class_diagram::model::class_method::is_consteval_ {false}
private

Definition at line 289 of file class_method.h.

◆ is_constexpr_

bool clanguml::class_diagram::model::class_method::is_constexpr_ {false}
private

Definition at line 288 of file class_method.h.

◆ is_constructor_

bool clanguml::class_diagram::model::class_method::is_constructor_ {false}
private

Definition at line 291 of file class_method.h.

◆ is_copy_assignment_

bool clanguml::class_diagram::model::class_method::is_copy_assignment_ {false}
private

Definition at line 294 of file class_method.h.

◆ is_coroutine_

bool clanguml::class_diagram::model::class_method::is_coroutine_ {false}
private

Definition at line 290 of file class_method.h.

◆ is_defaulted_

bool clanguml::class_diagram::model::class_method::is_defaulted_ {false}
private

Definition at line 284 of file class_method.h.

◆ is_deleted_

bool clanguml::class_diagram::model::class_method::is_deleted_ {false}
private

Definition at line 285 of file class_method.h.

◆ is_destructor_

bool clanguml::class_diagram::model::class_method::is_destructor_ {false}
private

Definition at line 292 of file class_method.h.

◆ is_move_assignment_

bool clanguml::class_diagram::model::class_method::is_move_assignment_ {false}
private

Definition at line 293 of file class_method.h.

◆ is_noexcept_

bool clanguml::class_diagram::model::class_method::is_noexcept_ {false}
private

Definition at line 287 of file class_method.h.

◆ is_operator_

bool clanguml::class_diagram::model::class_method::is_operator_ {false}
private

Definition at line 295 of file class_method.h.

◆ is_pure_virtual_

bool clanguml::class_diagram::model::class_method::is_pure_virtual_ {false}
private

Definition at line 281 of file class_method.h.

◆ is_static_

bool clanguml::class_diagram::model::class_method::is_static_ {false}
private

Definition at line 286 of file class_method.h.

◆ is_virtual_

bool clanguml::class_diagram::model::class_method::is_virtual_ {false}
private

Definition at line 282 of file class_method.h.

◆ parameters_

std::vector<method_parameter> clanguml::class_diagram::model::class_method::parameters_
private

Definition at line 279 of file class_method.h.


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