0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
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
24
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
38relationship::relationship(eid_t destination, access_t access, bool is_virtual)
39 : relationship{relationship_t::kExtension, destination, access}
40{
42}
43
44void relationship::set_type(relationship_t type) noexcept { type_ = type; }
45
46relationship_t relationship::type() const noexcept { return type_; }
47
49{
51}
52
54
56 const std::string &multiplicity_source)
57{
59}
60
62{
64}
65
67 const std::string &multiplicity_destination)
68{
70}
71
73{
75}
76
77void relationship::set_label(const std::string &label) { label_ = label; }
78
79std::string relationship::label() const { return label_; }
80
81void relationship::set_access(access_t access) noexcept { access_ = access; }
82
83access_t relationship::access() const noexcept { return access_; }
84
85bool relationship::is_virtual() const { return is_virtual_; }
86
87void relationship::set_virtual(const bool iv)
88{
90 is_virtual_ = iv;
91}
92
93bool 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