0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
package.cc
Go to the documentation of this file.
1/**
2 * @file src/common/model/package.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 "package.h"
20
21#include <sstream>
22
25 : element{using_namespace, pt}
26{
27}
28
29std::string package::full_name(bool relative) const
30{
31 if (relative) {
33 return res.to_string();
34 }
35
36 return (get_namespace() | name()).to_string();
37}
38
39bool package::is_deprecated() const { return is_deprecated_; }
40
41void package::set_deprecated(bool deprecated) { is_deprecated_ = deprecated; }
42
43std::optional<std::string> package::doxygen_link() const
44{
45 auto name = full_name(false);
46 util::replace_all(name, "_", "__");
47 util::replace_all(name, "::", "_1_1");
48 return fmt::format("namespace{}.html", name);
49}
50} // namespace clanguml::common::model