0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
decorated_element.cc
Go to the documentation of this file.
1/**
2 * @file src/common/model/decorated_element.cc
3 *
4 * Copyright (c) 2021-2024 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 "decorated_element.h"
20
22
24{
25 return std::any_of(
26 decorators_.begin(), decorators_.end(), [](const auto &d) {
27 return std::dynamic_pointer_cast<decorators::skip>(d) != nullptr;
28 });
29}
30
32{
33 return std::any_of(
34 decorators_.begin(), decorators_.end(), [](const auto &d) {
35 return std::dynamic_pointer_cast<decorators::skip_relationship>(
36 d) != nullptr;
37 });
38}
39
40std::pair<relationship_t, std::string>
42{
43 for (const auto &d : decorators_)
44 if (std::dynamic_pointer_cast<decorators::association>(d))
46 std::dynamic_pointer_cast<decorators::relationship>(d)
47 ->multiplicity};
48 else if (std::dynamic_pointer_cast<decorators::aggregation>(d))
50 std::dynamic_pointer_cast<decorators::relationship>(d)
51 ->multiplicity};
52 else if (std::dynamic_pointer_cast<decorators::composition>(d))
54 std::dynamic_pointer_cast<decorators::relationship>(d)
55 ->multiplicity};
56
57 return {relationship_t::kNone, ""};
58}
59
61{
62 for (const auto &d : decorators_)
63 if (std::dynamic_pointer_cast<decorators::style>(d))
64 return std::dynamic_pointer_cast<decorators::style>(d)->spec;
65
66 return "";
67}
68
69const std::vector<std::shared_ptr<decorators::decorator>> &
71{
72 return decorators_;
73}
74
76 const std::vector<std::shared_ptr<decorators::decorator>> &decorators)
77{
78 for (const auto &d : decorators) {
79 decorators_.push_back(d);
80 }
81}
82
84{
85 for (const auto &d : de.decorators()) {
86 decorators_.push_back(d);
87 }
88}
89
90std::optional<comment_t> decorated_element::comment() const { return comment_; }
91
93
94std::optional<std::string> decorated_element::doxygen_link() const
95{
96 return std::nullopt;
97}
98
99} // namespace clanguml::common::model