0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
clanguml::common::generators::display_name_adapter< T > Class Template Reference

Detailed Description

template<typename T>
class clanguml::common::generators::display_name_adapter< T >

Definition at line 70 of file display_adapters.h.

#include <display_adapters.h>

Public Member Functions

 display_name_adapter (const T &e)
 
const display_name_adapter< T > & with_packages () const
 
template<typename U = T>
std::enable_if_t< detail::has_name< U >::value, std::string > name () const
 
template<typename U = T>
std::enable_if_t< detail::has_type< U >::value, std::string > type () const
 
template<typename U = T>
std::enable_if_t< detail::has_full_name< U >::value, std::string > full_name (bool relative) const
 
template<typename U = T>
std::enable_if_t< detail::has_name_no_ns< U >::value, std::string > name_no_ns () const
 
template<typename U = T>
std::enable_if_t< detail::has_full_name_no_ns< U >::value, std::string > full_name_no_ns () const
 

Protected Member Functions

std::string adapt (std::string n) const
 

Private Attributes

bool with_packages_ {false}
 
const T & element_
 

Constructor & Destructor Documentation

◆ display_name_adapter()

template<typename T >
clanguml::common::generators::display_name_adapter< T >::display_name_adapter ( const T &  e)
inlineexplicit

Definition at line 72 of file display_adapters.h.

73 : element_{e}
74 {
75 }

Member Function Documentation

◆ adapt()

template<typename T >
std::string clanguml::common::generators::display_name_adapter< T >::adapt ( std::string  n) const
inlineprotected

Definition at line 117 of file display_adapters.h.

118 {
119 util::replace_all(n, "##", "::");
120
121 if constexpr (std::is_base_of<common::model::element, T>::value) {
122 if (!with_packages_) {
124 return fmt::format("::{}", n);
125 }
126 else {
127 if (element_.get_namespace().is_empty() &&
129 return fmt::format("::{}", n);
130 }
131 }
132
133 return n;
134 }

◆ full_name()

template<typename T >
template<typename U = T>
std::enable_if_t< detail::has_full_name< U >::value, std::string > clanguml::common::generators::display_name_adapter< T >::full_name ( bool  relative) const
inline

Definition at line 96 of file display_adapters.h.

98 {
99 return adapt(element_.full_name(relative));
100 }

◆ full_name_no_ns()

template<typename T >
template<typename U = T>
std::enable_if_t< detail::has_full_name_no_ns< U >::value, std::string > clanguml::common::generators::display_name_adapter< T >::full_name_no_ns ( ) const
inline

Definition at line 111 of file display_adapters.h.

112 {
113 return adapt(element_.full_name_no_ns());
114 }

◆ name()

template<typename T >
template<typename U = T>
std::enable_if_t< detail::has_name< U >::value, std::string > clanguml::common::generators::display_name_adapter< T >::name ( ) const
inline

Definition at line 84 of file display_adapters.h.

85 {
86 return adapt(element_.name());
87 }

◆ name_no_ns()

template<typename T >
template<typename U = T>
std::enable_if_t< detail::has_name_no_ns< U >::value, std::string > clanguml::common::generators::display_name_adapter< T >::name_no_ns ( ) const
inline

Definition at line 104 of file display_adapters.h.

105 {
106 return adapt(element_.name_no_ns());
107 }

◆ type()

template<typename T >
template<typename U = T>
std::enable_if_t< detail::has_type< U >::value, std::string > clanguml::common::generators::display_name_adapter< T >::type ( ) const
inline

Definition at line 90 of file display_adapters.h.

91 {
92 return adapt(element_.type());
93 }

◆ with_packages()

template<typename T >
const display_name_adapter< T > & clanguml::common::generators::display_name_adapter< T >::with_packages ( ) const
inline

Definition at line 77 of file display_adapters.h.

78 {
79 with_packages_ = true;
80 return *this;
81 }

Member Data Documentation

◆ element_

template<typename T >
const T& clanguml::common::generators::display_name_adapter< T >::element_
private

Definition at line 138 of file display_adapters.h.

◆ with_packages_

template<typename T >
bool clanguml::common::generators::display_name_adapter< T >::with_packages_ {false}
mutableprivate

Definition at line 137 of file display_adapters.h.


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