0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
class_method_base.h
Go to the documentation of this file.
1/**
2 * @file src/class_diagram/model/class_method_base.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_element.h"
23#include "method_parameter.h"
24
25#include <string>
26#include <vector>
27
29/**
30 * @brief Class method model.
31 */
33public:
34 /**
35 * @brief Constructor.
36 *
37 * @param access Methods access scope (e.g. public)
38 * @param name Methods name.
39 * @param type Methods return type as string.
40 */
42 const std::string &type);
43
44 ~class_method_base() override = default;
45
46 /**
47 * @brief Method name including template parameters/arguments if any
48 *
49 * @return String representation of the methods display name
50 */
51 std::string display_name() const;
52
53 void set_display_name(const std::string &display_name);
54
55 /**
56 * @brief Whether the method is static.
57 *
58 * @return True, if the method is static
59 */
60 bool is_static() const;
61
62 /**
63 * @brief Set whether the method is static.
64 *
65 * @param is_static True, if the method is static
66 */
67 void is_static(bool is_static);
68
69 /**
70 * @brief Get the method parameters.
71 *
72 * @return List of methods parameters
73 */
74 const std::vector<method_parameter> &parameters() const;
75
76 /**
77 * @brief Add methods parameter.
78 *
79 * @param parameter Method parameter.
80 */
81 void add_parameter(method_parameter &&parameter);
82
83private:
84 std::vector<method_parameter> parameters_;
85
86 bool is_static_{false};
87 std::string display_name_;
88};
89} // namespace clanguml::class_diagram::model