0.5.4
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-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
25#include "common/types.h"
26
27#include <string>
28#include <vector>
29
31
32/**
33 * @brief Model of C++ concept.
34 */
38public:
40
41 concept_(const concept_ &) = delete;
42 concept_(concept_ &&) noexcept = default;
43 concept_ &operator=(const concept_ &) = delete;
44 concept_ &operator=(concept_ &&) = delete;
45
46 /**
47 * @brief Get the elements type name.
48 *
49 * @return 'concept'
50 */
51 std::string type_name() const override { return "concept"; }
52
53 friend bool operator==(const concept_ &l, const concept_ &r);
54
55 std::string full_name(bool relative = true) const override;
56
57 std::string full_name_no_ns() const override;
58
59 /**
60 * @brief Add concept parameter
61 *
62 * Concept class for convenience uses the same method parameter model
63 * as regular methods and functions.
64 *
65 * @param mp Concept parameter
66 */
67 void add_parameter(const method_parameter &mp);
68
69 /**
70 * @brief Get concepts requires expression parameters
71 *
72 * @return List of concept requires expression parameters
73 */
74 const std::vector<method_parameter> &requires_parameters() const;
75
76 /**
77 * @brief Add a concept statement
78 *
79 * @param stmt Concept statement
80 */
81 void add_statement(std::string stmt);
82
83 /**
84 * @brief Get the concepts requires statements
85 *
86 * @return List of concepts requires statements
87 */
88 const std::vector<std::string> &requires_statements() const;
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