0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
src
class_diagram
model
concept.cc
Go to the documentation of this file.
1
/**
2
* @file src/class_diagram/model/concept.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 "
concept.h
"
20
#include "
method_parameter.h
"
21
22
#include <sstream>
23
24
namespace
clanguml::class_diagram::model
{
25
26
concept_::concept_
(
const
common::model::namespace_
&using_namespace)
27
: template_element{using_namespace}
28
{
29
}
30
31
bool
operator==
(
const
concept_
&l,
const
concept_
&r)
32
{
33
return
l.
id
() == r.
id
();
34
}
35
36
std::string
concept_::full_name_no_ns
()
const
37
{
38
using namespace
clanguml::util
;
39
40
std::ostringstream ostr;
41
42
ostr <<
name
();
43
44
render_template_params
(ostr,
using_namespace
(),
false
);
45
46
return
ostr.str();
47
}
48
49
std::string
concept_::full_name_impl
(
bool
relative)
const
50
{
51
using namespace
clanguml::util
;
52
using
clanguml::common::model::namespace_
;
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
73
void
concept_::add_parameter
(
const
method_parameter
&mp)
74
{
75
requires_parameters_
.emplace_back(mp);
76
}
77
78
const
std::vector<method_parameter> &
concept_::requires_parameters
()
const
79
{
80
return
requires_parameters_
;
81
}
82
83
void
concept_::add_statement
(std::string stmt)
84
{
85
requires_statements_
.emplace_back(std::move(stmt));
86
}
87
88
const
std::vector<std::string> &
concept_::requires_statements
()
const
89
{
90
return
requires_statements_
;
91
}
92
93
}
// namespace clanguml::class_diagram::model
Copyright © 2022-present
Bartek Kryza
Generated by
1.9.7