0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
class_member.h
Go to the documentation of this file.
1/**
2 * @file src/class_diagram/model/class_member.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
20#include "class_element.h"
21
22#include <string>
23
25
26/**
27 * @brief Class member model.
28 */
30public:
31 /**
32 * @brief Constructor.
33 *
34 * @param access Members access scope (e.g. public)
35 * @param name Members name.
36 * @param type Members type as string.
37 */
39 const std::string &type);
40
41 ~class_member() override = default;
42
43 /**
44 * @brief Whether the member is static.
45 *
46 * @return True, if the member is static.
47 */
48 bool is_static() const;
49
50 /**
51 * @brief Set members static status.
52 *
53 * @param is_static True, if the member is static.
54 */
55 void is_static(bool is_static);
56
57 /**
58 * @brief Set members destination multiplicity.
59 *
60 * @param m Optional multiplicity value
61 */
62 void set_destination_multiplicity(std::optional<size_t> m);
63
64 /**
65 * @brief Get members destination multiplicity.
66 *
67 * @return Optional multiplicity value
68 */
69 std::optional<size_t> destination_multiplicity() const;
70
71private:
72 bool is_static_{false};
73 std::optional<size_t> destination_multiplicity_{};
74};
75
76} // namespace clanguml::class_diagram::model