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::message Class Reference

Model of a sequence diagram message. More...

Detailed Description

Model of a sequence diagram message.

Definition at line 31 of file message.h.

#include <message.h>

Public Member Functions

 message ()=default
 
 message (common::model::message_t type, eid_t from)
 Constructor.
 
bool operator== (const message &other) const noexcept
 Equality operator.
 
void set_type (common::model::message_t t)
 Set message type.
 
common::model::message_t type () const
 Get message type.
 
void set_from (eid_t f)
 Set the id of message source participant.
 
eid_t from () const
 Get the id of source of message.
 
void set_to (eid_t t)
 Set the id of the message target.
 
eid_t to () const
 Get the id of the message target.
 
void set_message_name (std::string name)
 Set the message label.
 
const std::string & message_name () const
 Get the message label.
 
void set_return_type (std::string t)
 Set the return message type label.
 
const std::string & return_type () const
 Get the return message type label.
 
const std::optional< common::model::comment_t > & comment () const
 
void set_comment (std::optional< std::pair< unsigned int, std::string > > comment)
 
void set_comment (unsigned int id, std::string comment)
 
void set_comment (common::model::comment_t c)
 
void set_comment (const std::optional< common::model::comment_t > &c)
 
void set_message_scope (common::model::message_scope_t scope)
 Set message scope.
 
common::model::message_scope_t message_scope () const
 Get message scope.
 
void condition_text (const std::string &condition_text)
 Set condition text for block statements (e.g. if(<THIS TEXT>))
 
std::optional< std::string > condition_text () const
 Get condition text.
 
bool in_static_declaration_context () const
 
void in_static_declaration_context (bool v)
 
- 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)
 

Private Attributes

common::model::message_t type_ {common::model::message_t::kNone}
 
eid_t from_ {}
 
eid_t to_ {}
 
common::model::message_scope_t scope_
 
std::string message_name_ {}
 
std::string return_type_ {}
 
std::optional< std::string > condition_text_
 
std::optional< common::model::comment_tcomment_
 
bool in_static_declaration_context_ {false}
 

Constructor & Destructor Documentation

◆ message() [1/2]

clanguml::sequence_diagram::model::message::message ( )
default

◆ message() [2/2]

clanguml::sequence_diagram::model::message::message ( common::model::message_t  type,
eid_t  from 
)

Constructor.

Parameters
typeMessage type
fromId of originating sequence

Definition at line 23 of file message.cc.

24 : type_{type}
25 , from_{from}
26{
27}

Member Function Documentation

◆ comment()

const std::optional< common::model::comment_t > & clanguml::sequence_diagram::model::message::comment ( ) const

Definition at line 60 of file message.cc.

61{
62 return comment_;
63}

◆ condition_text() [1/2]

std::optional< std::string > clanguml::sequence_diagram::model::message::condition_text ( ) const

Get condition text.

Returns
Block statement condition text

Definition at line 112 of file message.cc.

113{
114 return condition_text_;
115}

◆ condition_text() [2/2]

void clanguml::sequence_diagram::model::message::condition_text ( const std::string &  condition_text)

Set condition text for block statements (e.g. if(<THIS TEXT>))

Parameters
condition_textCondition text

Definition at line 104 of file message.cc.

105{
106 if (condition_text.empty())
107 condition_text_ = std::nullopt;
108 else
110}

◆ from()

eid_t clanguml::sequence_diagram::model::message::from ( ) const

Get the id of source of message.

Returns

Definition at line 43 of file message.cc.

43{ return from_; }

◆ in_static_declaration_context() [1/2]

bool clanguml::sequence_diagram::model::message::in_static_declaration_context ( ) const

Definition at line 117 of file message.cc.

118{
120}

◆ in_static_declaration_context() [2/2]

void clanguml::sequence_diagram::model::message::in_static_declaration_context ( bool  v)

Definition at line 122 of file message.cc.

123{
125}

◆ message_name()

const std::string & clanguml::sequence_diagram::model::message::message_name ( ) const

Get the message label.

Returns
Message label

Definition at line 54 of file message.cc.

54{ return message_name_; }

◆ message_scope()

common::model::message_scope_t clanguml::sequence_diagram::model::message::message_scope ( ) const

Get message scope.

Returns
Message scope

Definition at line 102 of file message.cc.

102{ return scope_; }

◆ operator==()

bool clanguml::sequence_diagram::model::message::operator== ( const message other) const
noexcept

Equality operator.

Parameters
otherCompare this to other message
Returns
True, if 2 messages are equal

Definition at line 29 of file message.cc.

30{
31 return from_ == other.from_ && to_ == other.to_ && type_ == other.type_ &&
32 scope_ == other.scope_ && message_name_ == other.message_name_ &&
33 return_type_ == other.return_type_ &&
34 condition_text_ == other.condition_text_ && comment_ == other.comment_;
35}

◆ return_type()

const std::string & clanguml::sequence_diagram::model::message::return_type ( ) const

Get the return message type label.

Returns
Message return type label

Definition at line 58 of file message.cc.

58{ return return_type_; }

◆ set_comment() [1/4]

void clanguml::sequence_diagram::model::message::set_comment ( common::model::comment_t  c)

Definition at line 85 of file message.cc.

86{
87 if (!c.empty())
88 comment_ = std::move(c);
89}

◆ set_comment() [2/4]

void clanguml::sequence_diagram::model::message::set_comment ( const std::optional< common::model::comment_t > &  c)

Definition at line 91 of file message.cc.

92{
93 if (c)
94 set_comment(c.value());
95}

◆ set_comment() [3/4]

void clanguml::sequence_diagram::model::message::set_comment ( std::optional< std::pair< unsigned int, std::string > >  comment)

Definition at line 65 of file message.cc.

67{
68 if (comment.has_value()) {
69 set_comment(comment.value().first, comment.value().second);
70 }
71}

◆ set_comment() [4/4]

void clanguml::sequence_diagram::model::message::set_comment ( unsigned int  id,
std::string  comment 
)

Definition at line 73 of file message.cc.

74{
75 if (comment.empty())
76 return;
77
79 c["id"] = id;
80 c["comment"] = comment;
81
82 set_comment(std::move(c));
83}

◆ set_from()

void clanguml::sequence_diagram::model::message::set_from ( eid_t  f)

Set the id of message source participant.

Parameters
fId of the participant from which message originates

Definition at line 41 of file message.cc.

41{ from_ = f; }

◆ set_message_name()

void clanguml::sequence_diagram::model::message::set_message_name ( std::string  name)

Set the message label.

Parameters
nameMessage label

Definition at line 49 of file message.cc.

50{
51 message_name_ = std::move(name);
52}

◆ set_message_scope()

void clanguml::sequence_diagram::model::message::set_message_scope ( common::model::message_scope_t  scope)

Set message scope.

Message scope currently means whether the message was called from regular statement, or a statement embedded in a statement block condition

Parameters
scopeMessage scope

Definition at line 97 of file message.cc.

98{
99 scope_ = scope;
100}

◆ set_return_type()

void clanguml::sequence_diagram::model::message::set_return_type ( std::string  t)

Set the return message type label.

Parameters
tMessage return type label

Definition at line 56 of file message.cc.

56{ return_type_ = std::move(t); }

◆ set_to()

void clanguml::sequence_diagram::model::message::set_to ( eid_t  t)

Set the id of the message target.

Parameters
tId of the message target

Definition at line 45 of file message.cc.

45{ to_ = t; }

◆ set_type()

void clanguml::sequence_diagram::model::message::set_type ( common::model::message_t  t)

Set message type.

Parameters
tMessage type

Definition at line 37 of file message.cc.

37{ type_ = t; }

◆ to()

eid_t clanguml::sequence_diagram::model::message::to ( ) const

Get the id of the message target.

Returns
Id of the message target

Definition at line 47 of file message.cc.

47{ return to_; }

◆ type()

common::model::message_t clanguml::sequence_diagram::model::message::type ( ) const

Get message type.

Returns
Message type

Definition at line 39 of file message.cc.

39{ return type_; }

Member Data Documentation

◆ comment_

std::optional<common::model::comment_t> clanguml::sequence_diagram::model::message::comment_
private

Definition at line 185 of file message.h.

◆ condition_text_

std::optional<std::string> clanguml::sequence_diagram::model::message::condition_text_
private

Definition at line 183 of file message.h.

◆ from_

eid_t clanguml::sequence_diagram::model::message::from_ {}
private

Definition at line 170 of file message.h.

◆ in_static_declaration_context_

bool clanguml::sequence_diagram::model::message::in_static_declaration_context_ {false}
private

Definition at line 187 of file message.h.

◆ message_name_

std::string clanguml::sequence_diagram::model::message::message_name_ {}
private

Definition at line 179 of file message.h.

◆ return_type_

std::string clanguml::sequence_diagram::model::message::return_type_ {}
private

Definition at line 181 of file message.h.

◆ scope_

common::model::message_scope_t clanguml::sequence_diagram::model::message::scope_
private
Initial value:

Definition at line 174 of file message.h.

◆ to_

eid_t clanguml::sequence_diagram::model::message::to_ {}
private

Definition at line 172 of file message.h.

◆ type_

common::model::message_t clanguml::sequence_diagram::model::message::type_ {common::model::message_t::kNone}
private

Definition at line 168 of file message.h.


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