MCRO
C++23 utilities for Unreal Engine.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
TypeName.h File Reference

Convert types to string. More...

#include <string>
#include "ConstexprXXH3.h"
#include "CoreMinimal.h"
#include "UnrealCtre.h"
#include "Mcro/TextMacros.h"
#include "Mcro/Platform.h"

Go to the source code of this file.

Data Structures

struct  Mcro::TypeName::FType
 Group together type info for identification. Can have an invalid state when no type is specified. More...
 
struct  Mcro::TypeName::FType::TTag< T >
 

Namespaces

namespace  Mcro
 
namespace  Mcro::TypeName
 

Macros

#define MCRO_EXPLICIT_TYPE_EXTRACTION   defined(MCRO_EXPLICIT_PRETTY_FUNCTION) && defined(MCRO_EXPLICIT_TYPE_EXTRACT_REGEX)
 

Functions

template<typename T >
consteval std::basic_string_view< TCHAR > GetCompileTimeTypeName ()
 Get a string view of the compile time typename.
 
template<typename T >
consteval uint64 GetCompileTimeTypeHash ()
 
template<typename T >
FName Mcro::TypeName::TTypeFName ()
 Same as TTypeName converted to FName. This is not cached and a new FName is created every time this is called.
 
template<typename T >
FString Mcro::TypeName::TTypeString ()
 Same as TTypeName converted to FString. This is not cached and a new FString is created every time this is called.
 

Variables

template<typename T >
constexpr FType Mcro::TypeName::TTypeOf = FType(FType::TTag<T>())
 
template<typename T >
constexpr FStringView Mcro::TypeName::TTypeName
 Get a friendly string of an input type without using typeid(T).name().
 
template<typename T >
constexpr std::basic_string_view< TCHAR > Mcro::TypeName::TTypeNameStd = GetCompileTimeTypeName<std::decay_t<T>>()
 Same as TTypeName just stored as STL string made during compile time.
 
template<typename T >
constexpr uint64 Mcro::TypeName::TTypeHash = GetCompileTimeTypeHash<T>()
 Get a fixed uint64 hash representation of the given type. Have similar caveats as TTypeName
 

Detailed Description

Convert types to string.

Author
David Mórász
Date
2025

Definition in file TypeName.h.

Macro Definition Documentation

◆ MCRO_EXPLICIT_TYPE_EXTRACTION

#define MCRO_EXPLICIT_TYPE_EXTRACTION   defined(MCRO_EXPLICIT_PRETTY_FUNCTION) && defined(MCRO_EXPLICIT_TYPE_EXTRACT_REGEX)

Definition at line 27 of file TypeName.h.

Function Documentation

◆ GetCompileTimeTypeHash()

template<typename T >
uint64 GetCompileTimeTypeHash ( )
consteval

Definition at line 97 of file TypeName.h.

◆ GetCompileTimeTypeName()

template<typename T >
std::basic_string_view< TCHAR > GetCompileTimeTypeName ( )
consteval

Get a string view of the compile time typename.

Note
Using std::(w)string here instead of FString or FStringView for consteval compatibility
Template Parameters
Ttarget type
Returns
string view of the name of the type

Definition at line 57 of file TypeName.h.