0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
method_parameter.h
Go to the documentation of this file.
1/**
2 * @file src/class_diagram/model/method_parameter.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
23#include <string>
24#include <vector>
25
27
28/**
29 * @brief Model of a method parameter.
30 */
32public:
33 method_parameter() = default;
34
35 /**
36 * @brief Constructor.
37 *
38 * @param type Type of the method parameter as string.
39 * @param name Name of the method parameter.
40 * @param default_value Default value of the parameter or empty.
41 */
43 std::string type, std::string name, std::string default_value = {});
44
45 ~method_parameter() override = default;
46
47 /**
48 * @brief Set parameters type.
49 *
50 * @param type Parameters type as string.
51 */
52 void set_type(const std::string &type);
53
54 /**
55 * @brief Get parameters type.
56 *
57 * @return Parameters type as string.
58 */
59 std::string type() const;
60
61 /**
62 * @brief Set parameters name.
63 *
64 * @param type Parameters name.
65 */
66 void set_name(const std::string &name);
67
68 /**
69 * @brief Get parameters name.
70 *
71 * @return Parameters name.
72 */
73 std::string name() const;
74
75 /**
76 * @brief Set parameters default value.
77 *
78 * @param type Parameters default value as string.
79 */
80 void set_default_value(const std::string &value);
81
82 /**
83 * @brief Get parameters name.
84 *
85 * @return Parameters name.
86 */
87 std::string default_value() const;
88
89 /**
90 * @brief Render the method parameter to a string.
91 *
92 * @param using_namespaces If provided, make all namespaces relative to it.
93 * @return String representation of the parameter.
94 */
95 std::string to_string(
96 const common::model::namespace_ &using_namespaces) const;
97
98private:
99 std::string type_;
100 std::string name_;
101 std::string default_value_;
102};
103
104} // namespace clanguml::class_diagram::model