0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
src
common
model
template_trait.cc
Go to the documentation of this file.
1
/**
2
* @file src/common/model/template_trait.cc
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
19
#include "
common/model/template_trait.h
"
20
21
namespace
clanguml::common::model
{
22
23
std::ostream &
template_trait::render_template_params
(std::ostream &ostr,
24
const
common::model::namespace_
&using_namespace,
bool
relative)
const
25
{
26
using
clanguml::common::model::namespace_
;
27
28
if
(!
templates_
.empty()) {
29
std::vector<std::string> tnames;
30
31
std::transform(
templates_
.cbegin(),
templates_
.cend(),
32
std::back_inserter(tnames),
33
[ns = using_namespace, relative](
34
const
auto
&tmplt) { return tmplt.to_string(ns, relative); });
35
36
ostr << fmt::format(
"<{}>"
, fmt::join(tnames,
","
));
37
}
38
39
return
ostr;
40
}
41
42
void
template_trait::add_template
(
template_parameter
&&tmplt)
43
{
44
templates_
.push_back(std::move(tmplt));
45
}
46
47
const
std::vector<template_parameter> &
template_trait::template_params
()
const
48
{
49
return
templates_
;
50
}
51
52
int
template_trait::calculate_template_specialization_match
(
53
const
template_trait
&base_template)
const
54
{
55
return
calculate_template_params_specialization_match
(
56
template_params
(), base_template.
template_params
());
57
}
58
59
}
// namespace clanguml::common::model
Copyright © 2022-present
Bartek Kryza
Generated by
1.9.7