0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
template_trait.h
Go to the documentation of this file.
1/**
2 * @file src/common/model/template_trait.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 Common interface for template diagram elements.
30 *
31 * @embed{template_trait_hierarchy_class.svg}
32 */
34public:
35 /**
36 * Render the template parameters to a stream.
37 *
38 * @param ostr Output stream
39 * @param using_namespace Relative to namespace
40 * @param relative Whether to make template arguments relative to
41 * `using_namespace`
42 * @return Reference to output stream
43 */
44 std::ostream &render_template_params(std::ostream &ostr,
45 const common::model::namespace_ &using_namespace, bool relative) const;
46
47 /**
48 * Add template parameter
49 *
50 * @param tmplt Template parameter
51 */
52 void add_template(template_parameter &&tmplt);
53
54 /**
55 * Get reference to template parameters.
56 *
57 * @return Reference to template parameters list.
58 */
59 const std::vector<template_parameter> &template_params() const;
60
61 /**
62 * @brief Wrapper around @ref
63 * calculate_template_params_specialization_match()
64 *
65 * @param other Other template diagram element
66 * @return Match value
67 */
69 const template_trait &other) const;
70
71private:
72 std::vector<template_parameter> templates_;
74};
75
76} // namespace clanguml::common::model