0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
clanguml::common::model::template_trait Class Reference

Common interface for template diagram elements. More...

Detailed Description

Common interface for template diagram elements.

Definition at line 33 of file template_trait.h.

#include <template_trait.h>

Public Member Functions

std::ostream & render_template_params (std::ostream &ostr, const common::model::namespace_ &using_namespace, bool relative) const
 
void add_template (template_parameter &&tmplt)
 
const std::vector< template_parameter > & template_params () const
 
int calculate_template_specialization_match (const template_trait &other) const
 Wrapper around calculate_template_params_specialization_match()
 

Private Attributes

std::vector< template_parametertemplates_
 

Member Function Documentation

◆ add_template()

void clanguml::common::model::template_trait::add_template ( template_parameter &&  tmplt)

Add template parameter

Parameters
tmpltTemplate parameter

Definition at line 48 of file template_trait.cc.

49{
50 templates_.push_back(std::move(tmplt));
51}

◆ calculate_template_specialization_match()

int clanguml::common::model::template_trait::calculate_template_specialization_match ( const template_trait other) const

Wrapper around calculate_template_params_specialization_match()

Parameters
otherOther template diagram element
Returns
Match value

Definition at line 58 of file template_trait.cc.

60{
62 template_params(), base_template.template_params());
63}

◆ render_template_params()

std::ostream & clanguml::common::model::template_trait::render_template_params ( std::ostream &  ostr,
const common::model::namespace_ using_namespace,
bool  relative 
) const

Render the template parameters to a stream.

Parameters
ostrOutput stream
using_namespaceRelative to namespace
relativeWhether to make template arguments relative to using_namespace
Returns
Reference to output stream

Definition at line 23 of file template_trait.cc.

25{
27
28 if (!template_params().empty()) {
29 std::vector<std::string> tnames;
30
31 std::transform(template_params().cbegin(), template_params().cend(),
32 std::back_inserter(tnames),
33 [ns = using_namespace, relative](
34 const auto &tmplt) { return tmplt.to_string(ns, relative); });
35
36 if (template_params().size() > 1 &&
38 ostr << fmt::format(
39 "<{}>", fmt::join(tnames.begin(), tnames.end() - 1, ","));
40
41 else
42 ostr << fmt::format("<{}>", fmt::join(tnames, ","));
43 }
44
45 return ostr;
46}

◆ template_params()

const std::vector< template_parameter > & clanguml::common::model::template_trait::template_params ( ) const

Get reference to template parameters.

Returns
Reference to template parameters list.

Definition at line 53 of file template_trait.cc.

54{
55 return templates_;
56}

Member Data Documentation

◆ templates_

std::vector<template_parameter> clanguml::common::model::template_trait::templates_
private

Definition at line 72 of file template_trait.h.


The documentation for this class was generated from the following files: