0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
src
common
model
package.cc
Go to the documentation of this file.
1
/**
2
* @file src/common/model/package.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 "
package.h
"
20
21
#include <sstream>
22
23
namespace
clanguml::common::model
{
24
package::package
(
const
common::model::namespace_
&using_namespace,
path_type
pt)
25
:
element
{using_namespace, pt}
26
{
27
}
28
29
std::string
package::full_name_impl
(
bool
relative)
const
30
{
31
if
(relative) {
32
if
(
get_namespace
().type() ==
path_type::kNamespace
) {
33
auto
res =
get_namespace
() |
name
();
34
return
using_namespace
().
relative
(res.to_string());
35
}
36
37
auto
res =
get_namespace
().
relative_to
(
using_namespace
()) |
name
();
38
return
res.to_string();
39
}
40
41
return
(
get_namespace
() |
name
()).to_string();
42
}
43
44
bool
package::is_deprecated
()
const
{
return
is_deprecated_
; }
45
46
void
package::set_deprecated
(
bool
deprecated) {
is_deprecated_
= deprecated; }
47
48
std::optional<std::string>
package::doxygen_link
()
const
49
{
50
if
(
get_namespace
().type() !=
path_type::kNamespace
)
51
return
std::nullopt;
52
53
auto
name
=
full_name
(
false
);
54
util::replace_all
(
name
,
"_"
,
"__"
);
55
util::replace_all
(
name
,
"::"
,
"_1_1"
);
56
return
fmt::format(
"namespace{}.html"
,
name
);
57
}
58
}
// namespace clanguml::common::model
Copyright © 2022-present
Bartek Kryza
Generated by
1.9.7