SpECTRE
v2024.09.29
|
Pretty printing of types. More...
Namespaces | |
namespace | pretty_type |
Contains all functions that are part of PrettyType, used for printing types in a pretty manner. | |
Classes | |
struct | pretty_type::stl_templates |
A list of type traits to check if something is an STL member. More... | |
Typedefs | |
using | pretty_type::basics_map = detail::TemplateMap_t< char, signed char, unsigned char, wchar_t, char16_t, char32_t, int, unsigned int, long, unsigned long, long long, unsigned long long, short, unsigned short, float, double, long double, bool, std::string > |
typelist of basic types that can be pretty printed More... | |
Functions | |
template<typename T , typename Map = basics_map, typename KnownTemplates = stl_templates> | |
std::string | pretty_type::get_name () |
Returns a string with the prettiest typename known for the type T. More... | |
template<typename T > | |
std::string | pretty_type::get_runtime_type_name (const T &x) |
Returns a string with the prettiest typename known for the runtime type of x. More... | |
template<typename T > | |
std::string | pretty_type::short_name () |
Return the "short name" of a class, that is, the name without template parameters or scopes. | |
template<typename List > | |
std::string | pretty_type::list_of_names () |
Return a comma separated list of the pretty_type::name of every type in a tmpl::list . More... | |
Variables | |
template<typename... Types> | |
std::vector< std::string > | pretty_type::vector_of_get_names (tmpl::list< Types... >) |
Return a vector of the pretty_type::get_name of every type in a tmpl::list . | |
template<typename T > | |
std::string | pretty_type::name () |
Return the result of the name() member of a class. If a class doesn't have a name() member, call pretty_type::short_name<T>() instead. More... | |
template<typename T > | |
std::string | pretty_type::name (const T &) |
Return the result of the name() member of a class. If a class doesn't have a name() member, call pretty_type::short_name<T>() instead. More... | |
Pretty printing of types.
using pretty_type::basics_map = typedef detail::TemplateMap_t<char, signed char, unsigned char, wchar_t, char16_t, char32_t, int, unsigned int, long, unsigned long, long long, unsigned long long, short, unsigned short, float, double, long double, bool, std::string> |
typelist of basic types that can be pretty printed
These are specializations of tt::Type<T>
std::string pretty_type::get_name | ( | ) |
Returns a string with the prettiest typename known for the type T.
Example usage: auto name = get_name<T>();
T | the type to print |
Map | a tmpl::map of basic types (non-containers) and their Type<T> specializations that determine how to print the type name in a pretty form |
KnownTemplates | struct hold template alias tmpl::list of is_... that are known how to be printed pretty |
Returns: std::string containing the typename
std::string pretty_type::get_runtime_type_name | ( | const T & | x | ) |
Returns a string with the prettiest typename known for the runtime type of x.
The result will generally not be as pretty as the result of get_name, but this function will report the derived type of a class when only given a base class reference, which get_type cannot do.
std::string pretty_type::list_of_names | ( | ) |
Return a comma separated list of the pretty_type::name
of every type in a tmpl::list
.
tmpl::list
must be flattened. std::string pretty_type::name | ( | ) |
Return the result of the name()
member of a class. If a class doesn't have a name()
member, call pretty_type::short_name<T>()
instead.
name()
member of struct. This can lead to recursion as pretty_type::name<Tag>()
will call the name()
member of the struct. std::string pretty_type::name | ( | const T & | ) |
Return the result of the name()
member of a class. If a class doesn't have a name()
member, call pretty_type::short_name<T>()
instead.
name()
member of struct. This can lead to recursion as pretty_type::name<Tag>()
will call the name()
member of the struct.