0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
package.h
Go to the documentation of this file.
1/**
2 * @file src/common/model/package.h
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#pragma once
19
22#include "common/model/path.h"
24#include "common/types.h"
25#include "util/util.h"
26
27#include <spdlog/spdlog.h>
28
29#include <set>
30#include <string>
31#include <vector>
32
34
35/**
36 * @brief Diagram element representing namespace or directory package
37 *
38 * @embed{package_hierarchy_class.svg}
39 */
40class package : public element,
41 public stylable_element,
42 public nested_trait<element, path> {
43public:
46
47 package(const package &) = delete;
48 package(package &&) = default;
49 package &operator=(const package &) = delete;
50 package &operator=(package &&) = delete;
51
52 std::string type_name() const override { return "package"; }
53
54 std::string full_name(bool relative) const override;
55
56 /**
57 * Returns whether the namespace is deprecated.
58 *
59 * @return True, if namespace is deprecated.
60 */
61 bool is_deprecated() const;
62
63 /**
64 * Set namespace deprecation status.
65 *
66 * @param deprecated True, if namespace is deprecated
67 */
68 void set_deprecated(bool deprecated);
69
70 /**
71 * @brief Generate Doxygen style HTML link for the class.
72 *
73 * This method generates a link, which can be used in SVG diagrams to
74 * create links from classes to Doxygen documentation pages.
75 *
76 * @return Doxygen-style HTML link for the class.
77 */
78 std::optional<std::string> doxygen_link() const override;
79
80private:
81 bool is_deprecated_{false};
82};
83} // namespace clanguml::common::model
84
85namespace std {
86template <>
87struct hash<std::reference_wrapper<clanguml::common::model::package>> {
88 std::size_t operator()(
89 const std::reference_wrapper<clanguml::common::model::package> &key)
90 const
91 {
93
94 return key.get().id().value();
95 }
96};
97} // namespace std