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::sequence_diagram::model::method Struct Reference

Participant model representing a method. More...

Detailed Description

Participant model representing a method.

Definition at line 380 of file participant.h.

#include <participant.h>

Public Member Functions

 method (const common::model::namespace_ &using_namespace)
 
 method (const method &)=delete
 
 method (method &&) noexcept=delete
 
methodoperator= (const method &)=delete
 
methodoperator= (method &&)=delete
 
std::string type_name () const override
 
std::string method_name () const
 Get method name.
 
void set_method_name (const std::string &name)
 Set method name.
 
std::string alias () const override
 Get the participant PlantUML alias.
 
void set_class_id (eid_t id)
 Set the id of the participant to which this method belongs to.
 
void set_class_full_name (const std::string &name)
 Set full qualified name of the class.
 
const auto & class_full_name () const
 Get the class full name.
 
std::string full_name (bool relative) const override
 
std::string message_name (message_render_mode mode) const override
 Render function name as message label.
 
eid_t class_id () const
 Get the class id.
 
std::string to_string () const override
 Create a string representation of the participant.
 
bool is_constructor () const
 Check, if the method is a constructor.
 
void is_constructor (bool c)
 Set whether the method is a constructor.
 
bool is_defaulted () const
 Check, if the method is defaulted.
 
void is_defaulted (bool c)
 Set whether the method is defaulted.
 
bool is_assignment () const
 Check, if the method is an assignment operator.
 
void is_assignment (bool a)
 Set whether the method is an assignment operator.
 
- Public Member Functions inherited from clanguml::sequence_diagram::model::function
 function (const common::model::namespace_ &using_namespace)
 
 function (const function &)=delete
 
 function (function &&) noexcept=delete
 
functionoperator= (const function &)=delete
 
functionoperator= (function &&)=delete
 
std::string type_name () const override
 
std::string full_name (bool relative=true) const override
 
std::string full_name_no_ns () const override
 
virtual std::string message_name (message_render_mode mode) const
 Render function name as message label.
 
bool is_const () const
 Check if function is const.
 
void is_const (bool c)
 Set whether the function is const.
 
bool is_void () const
 Check, if the function has no return value.
 
void is_void (bool v)
 Set whether the function has a return value.
 
bool is_static () const
 Check, if the function is static.
 
void is_static (bool s)
 Set whether the function is static.
 
bool is_operator () const
 Check, if the method is an operator.
 
void is_operator (bool o)
 Set whether the method is an operator.
 
bool is_cuda_kernel () const
 Check, if a functions is a call to CUDA Kernel.
 
void is_cuda_kernel (bool c)
 Set whether the method is a CUDA kernel call.
 
bool is_cuda_device () const
 Check, if a functions is a call to CUDA device.
 
void is_cuda_device (bool c)
 Set whether the method is a CUDA device call.
 
void return_type (const std::string &rt)
 Set functions return type.
 
const std::string & return_type () const
 Get function return type.
 
void add_parameter (const std::string &a)
 Add a function parameter.
 
const std::vector< std::string > & parameters () const
 Get the list of function parameters.
 
- Public Member Functions inherited from clanguml::sequence_diagram::model::participant
 participant (const participant &)=delete
 
 participant (participant &&) noexcept=delete
 
participantoperator= (const participant &)=delete
 
participantoperator= (participant &&)=delete
 
std::string type_name () const override
 
virtual std::string to_string () const
 Create a string representation of the participant.
 
- Public Member Functions inherited from clanguml::common::model::template_element
 ~template_element () override=default
 
bool is_template () const
 
void is_template (bool is_template)
 
int calculate_template_specialization_match (const template_element &other) const
 Calculate template specialization match with other class.
 
bool template_specialization_found () const
 
void template_specialization_found (bool found)
 
 element (namespace_ using_namespace, path_type pt=path_type::kNamespace)
 
- Public Member Functions inherited from clanguml::common::model::element
 element (namespace_ using_namespace, path_type pt=path_type::kNamespace)
 
 ~element () override=default
 
std::string name_and_ns () const
 
void set_namespace (const namespace_ &ns)
 
namespace_ get_namespace () const
 
namespace_ get_relative_namespace () const
 
const namespace_path () const
 
void set_module (const std::string &module)
 
std::optional< std::string > module () const
 
void set_module_private (const bool module_private)
 
bool module_private () const
 
std::string full_name (bool relative) const override
 
virtual std::string full_name_no_ns () const
 
const namespace_using_namespace () const
 
inja::json context () const override
 
- Public Member Functions inherited from clanguml::common::model::diagram_element
 diagram_element ()
 
 ~diagram_element () override=default
 
const eid_tid () const
 Returns diagram element id.
 
void set_id (eid_t id)
 
std::optional< eid_tparent_element_id () const
 
void set_parent_element_id (eid_t id)
 
virtual std::string alias () const
 Return elements' diagram alias.
 
void set_name (const std::string &name)
 
std::string name () const
 
virtual std::string type_name () const
 
virtual std::string full_name (bool) const
 Return the elements fully qualified name.
 
std::vector< relationship > & relationships ()
 
const std::vector< relationship > & relationships () const
 
void add_relationship (relationship &&cr)
 
void append (const decorated_element &e)
 
virtual inja::json context () const
 
bool is_nested () const
 
void nested (bool nested)
 
bool complete () const
 
void complete (bool completed)
 
virtual void apply_filter (const diagram_filter &filter, const std::set< eid_t > &removed)
 
- 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()
 
- Public Member Functions inherited from clanguml::common::model::stylable_element
void set_style (const std::string &style)
 
std::optional< std::string > style () const
 

Private Attributes

eid_t class_id_ {}
 
std::string method_name_
 
std::string class_full_name_
 
bool is_constructor_ {false}
 
bool is_defaulted_ {false}
 
bool is_assignment_ {false}
 

Additional Inherited Members

- Public Types inherited from clanguml::sequence_diagram::model::function
enum class  message_render_mode { full , abbreviated , no_arguments }
 
- Public Types inherited from clanguml::sequence_diagram::model::participant
enum class  stereotype_t {
  participant = 0 , actor , boundary , control ,
  entity , database , collections , queue
}
 Enum representing stereotype of a participant. More...
 
- Public Attributes inherited from clanguml::sequence_diagram::model::participant
stereotype_t stereotype_ {stereotype_t::participant}
 

Constructor & Destructor Documentation

◆ method() [1/3]

clanguml::sequence_diagram::model::method::method ( const common::model::namespace_ using_namespace)

Definition at line 172 of file participant.cc.

174{
175}

◆ method() [2/3]

clanguml::sequence_diagram::model::method::method ( const method )
delete

◆ method() [3/3]

clanguml::sequence_diagram::model::method::method ( method &&  )
deletenoexcept

Member Function Documentation

◆ alias()

std::string clanguml::sequence_diagram::model::method::alias ( ) const
overridevirtual

Get the participant PlantUML alias.

Todo:
This method does not belong here - refactor to PlantUML specific code.
Returns
PlantUML alias for the participant to which this method belongs to.

Reimplemented from clanguml::common::model::diagram_element.

Definition at line 179 of file participant.cc.

180{
181 assert(class_id_.is_global());
182
183 return fmt::format("C_{:022}", class_id_.value());
184}

◆ class_full_name()

const auto & clanguml::sequence_diagram::model::method::class_full_name ( ) const

Get the class full name.

Returns
Class full name

Definition at line 207 of file participant.cc.

207{ return class_full_name_; }

◆ class_id()

eid_t clanguml::sequence_diagram::model::method::class_id ( ) const

Get the class id.

Returns
Class id

Definition at line 241 of file participant.cc.

241{ return class_id_; }

◆ full_name()

std::string clanguml::sequence_diagram::model::method::full_name ( bool  relative) const
overridevirtual

Return elements full name.

Returns
Fully qualified elements name.

Reimplemented from clanguml::sequence_diagram::model::function.

Definition at line 209 of file participant.cc.

210{
211 if (relative)
212 return fmt::format("{}({}){}", method_name(),
213 fmt::join(parameters(), ","), is_const() ? " const" : "");
214
215 return fmt::format("{}::{}({}){}", class_full_name(), method_name(),
216 fmt::join(parameters(), ","), is_const() ? " const" : "");
217}

◆ is_assignment() [1/2]

bool clanguml::sequence_diagram::model::method::is_assignment ( ) const

Check, if the method is an assignment operator.

Returns
True, if the method is an assignment operator

Definition at line 194 of file participant.cc.

194{ return is_assignment_; }

◆ is_assignment() [2/2]

void clanguml::sequence_diagram::model::method::is_assignment ( bool  a)

Set whether the method is an assignment operator.

Parameters
vTrue, if the method is an assignment operator

Definition at line 196 of file participant.cc.

196{ is_assignment_ = a; }

◆ is_constructor() [1/2]

bool clanguml::sequence_diagram::model::method::is_constructor ( ) const

Check, if the method is a constructor.

Returns
True, if the method is a constructor

Definition at line 186 of file participant.cc.

186{ return is_constructor_; }

◆ is_constructor() [2/2]

void clanguml::sequence_diagram::model::method::is_constructor ( bool  c)

Set whether the method is a constructor.

Parameters
vTrue, if the method is a constructor

Definition at line 188 of file participant.cc.

188{ is_constructor_ = c; }

◆ is_defaulted() [1/2]

bool clanguml::sequence_diagram::model::method::is_defaulted ( ) const

Check, if the method is defaulted.

Returns
True, if the method is defaulted

Definition at line 190 of file participant.cc.

190{ return is_defaulted_; }

◆ is_defaulted() [2/2]

void clanguml::sequence_diagram::model::method::is_defaulted ( bool  c)

Set whether the method is defaulted.

Parameters
vTrue, if the method is defaulted

Definition at line 192 of file participant.cc.

192{ is_defaulted_ = d; }

◆ message_name()

std::string clanguml::sequence_diagram::model::method::message_name ( message_render_mode  mode) const
overridevirtual

Render function name as message label.

Parameters
modeFunction argument render mode
Returns
Message label

Reimplemented from clanguml::sequence_diagram::model::function.

Definition at line 219 of file participant.cc.

220{
221 constexpr auto kAbbreviatedMethodArgumentsLength{15};
222
223 const std::string style{};
224
226 return fmt::format("{}{}(){}{}", style, method_name(),
227 is_const() ? " const" : "", style);
228 }
230 return fmt::format("{}({}){}", name(),
232 fmt::format("{}", fmt::join(parameters(), ",")),
233 kAbbreviatedMethodArgumentsLength),
234 is_const() ? " const" : "");
235 }
236
237 return fmt::format("{}{}({}){}{}", style, method_name(),
238 fmt::join(parameters(), ","), is_const() ? " const" : "", style);
239}

◆ method_name()

std::string clanguml::sequence_diagram::model::method::method_name ( ) const

Get method name.

Returns
Method name

Definition at line 177 of file participant.cc.

177{ return method_name_; }

◆ operator=() [1/2]

method & clanguml::sequence_diagram::model::method::operator= ( const method )
delete

◆ operator=() [2/2]

method & clanguml::sequence_diagram::model::method::operator= ( method &&  )
delete

◆ set_class_full_name()

void clanguml::sequence_diagram::model::method::set_class_full_name ( const std::string &  name)

Set full qualified name of the class.

Parameters
nameName of the class including namespace

Definition at line 202 of file participant.cc.

203{
205}

◆ set_class_id()

void clanguml::sequence_diagram::model::method::set_class_id ( eid_t  id)

Set the id of the participant to which this method belongs to.

Parameters
idId of the class to which this method belongs to

Definition at line 200 of file participant.cc.

200{ class_id_ = id; }

◆ set_method_name()

void clanguml::sequence_diagram::model::method::set_method_name ( const std::string &  name)

Set method name.

Parameters
nameMethod name

Definition at line 198 of file participant.cc.

198{ method_name_ = name; }

◆ to_string()

std::string clanguml::sequence_diagram::model::method::to_string ( ) const
overridevirtual

Create a string representation of the participant.

Returns
Participant representation as string

Reimplemented from clanguml::sequence_diagram::model::participant.

Definition at line 243 of file participant.cc.

244{
245 return fmt::format("Participant '{}': id={}, name={}, class_id={}",
246 type_name(), id(), full_name(false), class_id());
247}

◆ type_name()

std::string clanguml::sequence_diagram::model::method::type_name ( ) const
inlineoverridevirtual

Get the type name of the diagram element.

Returns
Type name of the diagram element.

Reimplemented from clanguml::sequence_diagram::model::function.

Definition at line 393 of file participant.h.

393{ return "method"; }

Member Data Documentation

◆ class_full_name_

std::string clanguml::sequence_diagram::model::method::class_full_name_
private

Definition at line 508 of file participant.h.

◆ class_id_

eid_t clanguml::sequence_diagram::model::method::class_id_ {}
private

Definition at line 506 of file participant.h.

◆ is_assignment_

bool clanguml::sequence_diagram::model::method::is_assignment_ {false}
private

Definition at line 511 of file participant.h.

◆ is_constructor_

bool clanguml::sequence_diagram::model::method::is_constructor_ {false}
private

Definition at line 509 of file participant.h.

◆ is_defaulted_

bool clanguml::sequence_diagram::model::method::is_defaulted_ {false}
private

Definition at line 510 of file participant.h.

◆ method_name_

std::string clanguml::sequence_diagram::model::method::method_name_
private

Definition at line 507 of file participant.h.


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