UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GeneratedTypeName.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
7
8#if defined(_MSC_VER) && !defined(__clang__)
9 #define SIG __FUNCSIG__
10 #define SIG_STARTCHAR '<'
11 #define SIG_ENDCHAR '>'
12
13 #pragma warning(push)
14 #pragma warning(disable : 4503) // "identifier" : decorated name length exceeded, name was truncated
15#else
16 #define SIG __PRETTY_FUNCTION__
17 #define SIG_STARTCHAR '='
18 #define SIG_ENDCHAR ']'
19#endif
20
21#if !UE_BUILD_DOCS
22
24{
25 // Class representing a substring of another string
26 struct FSubstr
27 {
28 const char* Ptr;
30
31 constexpr char operator[](uint32 Index) const
32 {
33 return Ptr[Index];
34 }
35
36 constexpr uint32 Len() const
37 {
38 return Length;
39 }
40
41 constexpr FSubstr PopFront(int Num = 1) const
42 {
43 return { Ptr + Num, Len() - Num };
44 }
45
46 constexpr FSubstr PopBack(int Num = 1) const
47 {
48 return { Ptr, Len() - Num };
49 }
50
51 constexpr FSubstr PopFrontAll(char Ch) const
52 {
53 return (Len() > 0 && Ptr[0] == Ch) ? PopFront().PopFrontAll(Ch) : *this;
54 }
55
56 constexpr FSubstr PopFrontAllNot(char Ch) const
57 {
58 return (Len() > 0 && Ptr[0] != Ch) ? PopFront().PopFrontAllNot(Ch) : *this;
59 }
60
61 constexpr FSubstr PopBackAll(char Ch) const
62 {
63 return (Len() > 0 && Ptr[Len() - 1] == Ch) ? PopBack().PopBackAll(Ch) : *this;
64 }
65
66 constexpr FSubstr PopBackAllNot(char Ch) const
67 {
68 return (Len() > 0 && Ptr[Len() - 1] != Ch) ? PopBack().PopBackAllNot(Ch) : *this;
69 }
70 };
71
72 // Gets the name of the type as a substring of a literal
73 template <typename T>
75 {
76 return FSubstr{ SIG, sizeof(SIG) - 1 }
79 .PopFront()
80 .PopBack()
81 .PopFrontAll(' ')
82 .PopBackAll(' ');
83 }
84
85 template <uint32 NumChars>
87 {
89 };
90
91 template <typename T, uint32... Indices>
93 {
94 return TCharArray<sizeof...(Indices)> { { (TCHAR)GetTypeSubstr<T>()[Indices]... } };
95 }
96}
97
98#endif
99
110template <typename T>
112{
113 static constexpr auto Result = UETypeName_Private::TypeSubstrToCharArray<T>(TMakeIntegerSequence<uint32, UETypeName_Private::GetTypeSubstr<T>().Len()>());
114 return Result.Array;
115}
116
117#if defined(_MSC_VER) && !defined(__clang__)
118 #pragma warning(pop)
119#endif
120
121#undef SIG_ENDCHAR
122#undef SIG_STARTCHAR
123#undef SIG
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SIG_ENDCHAR
Definition GeneratedTypeName.h:18
#define SIG_STARTCHAR
Definition GeneratedTypeName.h:17
#define SIG
Definition GeneratedTypeName.h:16
const TCHAR * GetGeneratedTypeName()
Definition GeneratedTypeName.h:111
typename UE4IntegerSequence_Private::TMakeIntegerSequenceImpl< T, N >::Type TMakeIntegerSequence
Definition IntegerSequence.h:31
@ Num
Definition MetalRHIPrivate.h:234
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition GeneratedTypeName.h:24
constexpr TCharArray< sizeof...(Indices)> TypeSubstrToCharArray(TIntegerSequence< uint32, Indices... >)
Definition GeneratedTypeName.h:92
constexpr FSubstr GetTypeSubstr()
Definition GeneratedTypeName.h:74
U16 Index
Definition radfft.cpp:71
Definition IntegerSequence.h:9
Definition GeneratedTypeName.h:27
const char * Ptr
Definition GeneratedTypeName.h:28
constexpr FSubstr PopFrontAll(char Ch) const
Definition GeneratedTypeName.h:51
constexpr char operator[](uint32 Index) const
Definition GeneratedTypeName.h:31
constexpr FSubstr PopFront(int Num=1) const
Definition GeneratedTypeName.h:41
constexpr FSubstr PopBack(int Num=1) const
Definition GeneratedTypeName.h:46
constexpr uint32 Len() const
Definition GeneratedTypeName.h:36
constexpr FSubstr PopBackAllNot(char Ch) const
Definition GeneratedTypeName.h:66
uint32 Length
Definition GeneratedTypeName.h:29
constexpr FSubstr PopBackAll(char Ch) const
Definition GeneratedTypeName.h:61
constexpr FSubstr PopFrontAllNot(char Ch) const
Definition GeneratedTypeName.h:56
Definition GeneratedTypeName.h:87
TCHAR Array[NumChars+1]
Definition GeneratedTypeName.h:88