0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
concept.h
Go to the documentation of this file.
1/**
2 * @file src/class_diagram/model/concept.h
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#pragma once
19
25#include "common/types.h"
26
27#include <string>
28#include <vector>
29
31
32/**
33 * @brief Model of C++ concept.
34 */
37public:
39
40 concept_(const concept_ &) = delete;
41 concept_(concept_ &&) noexcept = default;
42 concept_ &operator=(const concept_ &) = delete;
43 concept_ &operator=(concept_ &&) = delete;
44
45 /**
46 * @brief Get the elements type name.
47 *
48 * @return 'concept'
49 */
50 std::string type_name() const override { return "concept"; }
51
52 friend bool operator==(const concept_ &l, const concept_ &r);
53
54 std::string full_name_no_ns() const override;
55
56 /**
57 * @brief Add concept parameter
58 *
59 * Concept class for convenience uses the same method parameter model
60 * as regular methods and functions.
61 *
62 * @param mp Concept parameter
63 */
64 void add_parameter(const method_parameter &mp);
65
66 /**
67 * @brief Get concepts requires expression parameters
68 *
69 * @return List of concept requires expression parameters
70 */
71 const std::vector<method_parameter> &requires_parameters() const;
72
73 /**
74 * @brief Add a concept statement
75 *
76 * @param stmt Concept statement
77 */
78 void add_statement(std::string stmt);
79
80 /**
81 * @brief Get the concepts requires statements
82 *
83 * @return List of concepts requires statements
84 */
85 const std::vector<std::string> &requires_statements() const;
86
87protected:
88 std::string full_name_impl(bool relative = true) const override;
89
90private:
91 std::vector<std::string> requires_expression_;
92
93 std::vector<method_parameter> requires_parameters_;
94
95 std::vector<std::string> requires_statements_;
96};
97} // namespace clanguml::class_diagram::model