0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
class_method.h
Go to the documentation of this file.
1/**
2 * @file src/class_diagram/model/class_method.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
20#include "class_method_base.h"
23#include "method_parameter.h"
24
25#include <string>
26#include <vector>
27
29
31
32/**
33 * @brief Class method model.
34 */
36public:
37 /**
38 * @brief Constructor.
39 *
40 * @param access Methods access scope (e.g. public)
41 * @param name Methods name.
42 * @param type Methods return type as string.
43 */
45 const std::string &type);
46
47 ~class_method() override = default;
48
49 void update(const common::model::namespace_ &un);
50
51 /**
52 * @brief Whether the method is pure virtual.
53 *
54 * @return True, if the method is pure virtual
55 */
56 bool is_pure_virtual() const;
58
59 /**
60 * @brief Whether the method is virtual.
61 *
62 * @return True, if the method is virtual
63 */
64 bool is_virtual() const;
65
66 /**
67 * @brief Set whether the method is virtual.
68 *
69 * @param is_virtual True, if the method is virtual
70 */
71 void is_virtual(bool is_virtual);
72
73 /**
74 * @brief Whether the method is const.
75 *
76 * @return True, if the method is const
77 */
78 bool is_const() const;
79
80 /**
81 * @brief Set whether the method is const.
82 *
83 * @param is_const True, if the method is const
84 */
85 void is_const(bool is_const);
86
87 /**
88 * @brief Whether the method is defaulted.
89 *
90 * @return True, if the method is defaulted
91 */
92 bool is_defaulted() const;
93
94 /**
95 * @brief Set whether the method is defaulted.
96 *
97 * @param is_defaulted True, if the method is defaulted
98 */
99 void is_defaulted(bool is_defaulted);
100
101 /**
102 * @brief Whether the method is deleted.
103 *
104 * @return True, if the method is deleted
105 */
106 bool is_deleted() const;
107
108 /**
109 * @brief Set whether the method is deleted.
110 *
111 * @param is_deleted True, if the method is deleted
112 */
113 void is_deleted(bool is_deleted);
114
115 /**
116 * @brief Whether the method is constexpr.
117 *
118 * @return True, if the method is constexpr
119 */
120 bool is_constexpr() const;
121
122 /**
123 * @brief Set whether the method is constexpr.
124 *
125 * @param is_constexpr True, if the method is constexpr
126 */
127 void is_constexpr(bool is_constexpr);
128
129 /**
130 * @brief Whether the method is consteval.
131 *
132 * @return True, if the method is consteval
133 */
134 bool is_consteval() const;
135
136 /**
137 * @brief Set whether the method is consteval.
138 *
139 * @param is_consteval True, if the method is consteval
140 */
141 void is_consteval(bool is_consteval);
142
143 /**
144 * @brief Whether the method is a C++20 coroutine.
145 *
146 * @return True, if the method is a coroutine
147 */
148 bool is_coroutine() const;
149
150 /**
151 * @brief Set whether the method is a C++20 coroutine.
152 *
153 * @param is_coroutine True, if the method is a coroutine
154 */
155 void is_coroutine(bool is_coroutine);
156
157 /**
158 * @brief Whether the method is noexcept.
159 *
160 * @return True, if the method is noexcept
161 */
162 bool is_noexcept() const;
163
164 /**
165 * @brief Set whether the method is noexcept.
166 *
167 * @param is_noexcept True, if the method is noexcept
168 */
169 void is_noexcept(bool is_noexcept);
170
171 /**
172 * @brief Whether the method is a constructor.
173 *
174 * @return True, if the method is a constructor
175 */
176 bool is_constructor() const;
177
178 /**
179 * @brief Set whether the method is a constructor.
180 *
181 * @param is_constructor True, if the method is a constructor
182 */
184
185 /**
186 * @brief Whether the method is a destructor.
187 *
188 * @return True, if the method is a destructor
189 */
190 bool is_destructor() const;
191
192 /**
193 * @brief Set whether the method is a destructor.
194 *
195 * @param is_destructor True, if the method is a destructor
196 */
197 void is_destructor(bool is_destructor);
198
199 /**
200 * @brief Whether the method is move assignment.
201 *
202 * @return True, if the method is move assignment
203 */
204 bool is_move_assignment() const;
205
206 /**
207 * @brief Set whether the method is a move assignment.
208 *
209 * @param is_move_assignment True, if the method is a move assignment
210 */
212
213 /**
214 * @brief Whether the method is copy assignment.
215 *
216 * @return True, if the method is copy assignment
217 */
218 bool is_copy_assignment() const;
219
220 /**
221 * @brief Set whether the method is a copy assignment.
222 *
223 * @param is_copy_assignment True, if the method is a copy assignment
224 */
226
227 /**
228 * @brief Whether the method is an operator.
229 *
230 * @return True, if the method is an operator
231 */
232 bool is_operator() const;
233
234 /**
235 * @brief Set whether the method is an operator.
236 *
237 * @param is_copy_assignment True, if the method is an operator
238 */
239 void is_operator(bool is_operator);
240
241private:
242 bool is_pure_virtual_{false};
243 bool is_virtual_{false};
244 bool is_const_{false};
245 bool is_defaulted_{false};
246 bool is_deleted_{false};
247 bool is_noexcept_{false};
248 bool is_constexpr_{false};
249 bool is_consteval_{false};
250 bool is_coroutine_{false};
251 bool is_constructor_{false};
252 bool is_destructor_{false};
255 bool is_operator_{false};
256};
257} // namespace clanguml::class_diagram::model