MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
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"
#include "Mcro/Inheritance.h"

Go to the source code of this file.

Namespaces

namespace  Mcro
 
namespace  Mcro::TypeName
 

Macros

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

Typedefs

using Mcro::TypeName::FTypeHash = uint64
 

Functions

template<typename T >
consteval std::basic_string_view< TCHAR > GetCompileTimeTypeName ()
 Get a string view of the compile time typename.
 
template<typename T >
consteval FTypeHash Mcro::TypeName::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 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 FTypeHash 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 28 of file TypeName.h.

Function Documentation

◆ 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 58 of file TypeName.h.