0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
src
common
model
relationship.cc
Go to the documentation of this file.
1
/**
2
* @file src/common/model/relationship.cc
3
*
4
* Copyright (c) 2021-2025 Bartek Kryza <bkryza@gmail.com>
5
*
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
19
#include "
relationship.h
"
20
21
#include <utility>
22
23
namespace
clanguml::common::model
{
24
25
relationship::relationship
(
relationship_t
type,
eid_t
destination,
26
access_t
access, std::string label, std::string multiplicity_source,
27
std::string multiplicity_destination)
28
: type_{type}
29
, destination_{destination}
30
, multiplicity_source_{
std
::move(multiplicity_source)}
31
, multiplicity_destination_{
std
::move(multiplicity_destination)}
32
, label_{
std
::move(label)}
33
, access_{access}
34
, is_virtual_{false}
35
{
36
}
37
38
relationship::relationship
(
eid_t
destination,
access_t
access,
bool
is_virtual)
39
:
relationship
{
relationship_t
::
kExtension
, destination, access}
40
{
41
set_virtual
(
is_virtual
);
42
}
43
44
void
relationship::set_type
(
relationship_t
type)
noexcept
{ type_ = type; }
45
46
relationship_t
relationship::type
() const noexcept {
return
type_
; }
47
48
void
relationship::set_destination
(
eid_t
destination)
49
{
50
destination_
=
destination
;
51
}
52
53
eid_t
relationship::destination
()
const
{
return
destination_
; }
54
55
void
relationship::set_multiplicity_source
(
56
const
std::string &multiplicity_source)
57
{
58
multiplicity_source_
=
multiplicity_source
;
59
}
60
61
std::string
relationship::multiplicity_source
()
const
62
{
63
return
multiplicity_source_
;
64
}
65
66
void
relationship::set_multiplicity_destination
(
67
const
std::string &multiplicity_destination)
68
{
69
multiplicity_destination_
=
multiplicity_destination
;
70
}
71
72
std::string
relationship::multiplicity_destination
()
const
73
{
74
return
multiplicity_destination_
;
75
}
76
77
void
relationship::set_label
(
const
std::string &label) {
label_
=
label
; }
78
79
std::string
relationship::label
()
const
{
return
label_
; }
80
81
void
relationship::set_access
(
access_t
access)
noexcept
{ access_ = access; }
82
83
access_t
relationship::access
() const noexcept {
return
access_
; }
84
85
bool
relationship::is_virtual
()
const
{
return
is_virtual_
; }
86
87
void
relationship::set_virtual
(
const
bool
iv)
88
{
89
assert(
type
() ==
relationship_t::kExtension
);
90
is_virtual_
= iv;
91
}
92
93
bool
operator==
(
const
relationship
&l,
const
relationship
&r)
94
{
95
return
l.
type
() == r.
type
() && l.
destination
() == r.
destination
() &&
96
l.
label
() == r.
label
();
97
}
98
}
// namespace clanguml::common::model
Copyright © 2022-present
Bartek Kryza
Generated by
1.9.7