0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
concept.cc
Go to the documentation of this file.
1/**
2 * @file src/class_diagram/model/concept.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 "concept.h"
20#include "method_parameter.h"
21
22#include <sstream>
23
25
27 : element{using_namespace}
28{
29}
30
31bool operator==(const concept_ &l, const concept_ &r)
32{
33 return l.id() == r.id();
34}
35
36std::string concept_::full_name_no_ns() const
37{
38 using namespace clanguml::util;
39
40 std::ostringstream ostr;
41
42 ostr << name();
43
45
46 return ostr.str();
47}
48
49std::string concept_::full_name(bool relative) const
50{
51 using namespace clanguml::util;
53
54 std::ostringstream ostr;
55
56 ostr << name_and_ns();
57
58 render_template_params(ostr, using_namespace(), relative);
59
60 std::string res;
61
62 if (relative)
63 res = using_namespace().relative(ostr.str());
64 else
65 res = ostr.str();
66
67 if (res.empty())
68 return "<<anonymous>>";
69
70 return res;
71}
72
74{
75 requires_parameters_.emplace_back(mp);
76}
77
78const std::vector<method_parameter> &concept_::requires_parameters() const
79{
81}
82
83void concept_::add_statement(std::string stmt)
84{
85 requires_statements_.emplace_back(std::move(stmt));
86}
87
88const std::vector<std::string> &concept_::requires_statements() const
89{
91}
92
93} // namespace clanguml::class_diagram::model