UEnum

Reflection data for an enumeration.

Windows
MacOS
Linux

Inheritance Hierarchy

Syntax

class UEnum : public UField

Remarks

Reflection data for an enumeration.

Variables

Name Description

Protected variable

ECppForm

 

CppForm

How the enum was originally defined.

Public variable

FString

 

CppType

This will be the true type of the enum as a string, e.g. "ENamespacedEnum::InnerType" or "ERegularEnum" or "EEnumClass"

Protected variable

FEnumDisplayNam...

 

EnumDisplayNameFn

Pointer to function used to look up the enum's display name.

Protected variable

TArray< TPair< ...

 

Names

List of pairs of all enum names and values.

Constructors

Name Description

Public function

UEnum

(
    FVTableHelper& Helper
)

DO NOT USE. This constructor is for internal usage only for hot-reload purposes.

Public function

UEnum

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Static

void

 

__DefaultConstructor

(
    const FObjectInitializer& X
)

Public function Static

UObject *...

 

__VTableCtorCaller

(
    FVTableHelper& Helper
)

Protected function

void

 

AddNamesToMasterList()

Adds the Names in this enum to the master AllEnumNames list

Public function Const

bool

 

ContainsExistingMax()

Tests if the enum contains a MAX value

Public function Const

FString

 

GenerateEnumPrefix()

Find the longest common prefix of all items in the enumeration.

Public function Virtual Const

FString

 

GenerateFullEnumName

(
    const TCHAR* InEnumName
)

Generates full name including EnumName:: given enum name.

Public function Const

ECppForm

 

GetCppForm()

Returns the type of enum: whether it's a regular enum, namespaced enum or C++11 enum class.

Public function Virtual Const

FText

 

GetDisplayNameTextByIndex

(
    int32 InIndex
)

Finds the localized display name or native display name as a fallback.

Public function Const

FText

 

GetDisplayNameTextByValue

(
    int64 InValue
)

Version of GetDisplayNameTextByIndex that takes a value instead

Public function Static

FText

 

GetDisplayValueAsText

(
    const TCHAR* EnumPath,
    const T EnumeratorValue
)

Public function Static

FText

 

GetDisplayValueAsText

(
    const TCHAR* EnumPath,
    const TEnumAsByte< T > EnumeratorVa...
)

Public function Static

void

 

GetDisplayValueAsText

(
    const EnumType EnumeratorValue,
    FText& out_TextValue
)

Public function Static

void

 

GetDisplayValueAsText

(
    const TCHAR* EnumPath,
    const T EnumeratorValue,
    FText& out_TextValue
)

Public function Static

FText

 

GetDisplayValueAsText

(
    const TEnumAsByte< EnumType > Enume...
)

Public function Static

FText

 

GetDisplayValueAsText

(
    const EnumType EnumeratorValue
)

Public function Const

int32

 

GetIndexByName

(
    FName InName,
    EGetByNameFlags Flags
)

Gets index of name in enum, returns INDEX_NONE and optionally errors when name is not found.

Public function Const

int32

 

GetIndexByNameString

(
    const FString& SearchString,
    EGetByNameFlags Flags
)

Gets index of name in enum, returns INDEX_NONE and optionally errors when name is not found.

Public function Const

int32

 

GetIndexByValue

(
    int64 InValue
)

Index is the internal index into the Enum array, and is not useful outside of the Enum system Value is the value set in the Enum Class in C++ or Blueprint Enums can be sparse, which means that not every valid Index is a proper Value, and they are not necessarily equal It is not safe to cast an Index to a Enum Class, always do that with a Value instead Gets the internal index for an enum value.

Public function Const

int64

 

GetMaxEnumValue()

Gets max value of Enum. Defaults to zero if there are no entries.

Public function Const

FString

 

GetMetaData

(
    const TCHAR* Key,
    int32 NameIndex,
    bool bAllowRemap
)

Return the metadata value associated with the specified key.

Public function Const

FName

 

GetNameByIndex

(
    int32 Index
)

Gets enum name by index in Names array. Returns NAME_None if Index is not valid.

Public function Const

FName

 

GetNameByValue

(
    int64 InValue
)

Gets enum name by value. Returns NAME_None if value is not found.

Public function Const

FString

 

GetNameStringByIndex

(
    int32 InIndex
)

Returns the short name at the enum index, returns empty string if invalid

Public function Const

FString

 

GetNameStringByValue

(
    int64 InValue
)

Returns the short name matching the enum Value, returns empty string if invalid

Public function Const

FText

 

GetToolTipTextByIndex

(
    int32 NameIndex
)

Finds the localized tooltip or native tooltip as a fallback.

Public function Static

void

 

GetValueAsName

(
    const EnumType EnumeratorValue,
    FName& out_NameValue
)

Public function Static

FName

 

GetValueAsName

(
    const TEnumAsByte< EnumType > Enume...
)

Public function Static

FName

 

GetValueAsName

(
    const EnumType EnumeratorValue
)

Public function Static

FString

 

GetValueAsString

(
    const EnumType EnumeratorValue
)

Public function Static

void

 

GetValueAsString

(
    const TCHAR* EnumPath,
    const T EnumeratorValue,
    FString& out_StringValue
)

Public function Static

void

 

GetValueAsString

(
    const EnumType EnumeratorValue,
    FString& out_StringValue
)

Public function Static

FString

 

GetValueAsString

(
    const TCHAR* EnumPath,
    const TEnumAsByte< T > EnumeratorVa...
)

Public function Static

FString

 

GetValueAsString

(
    const TCHAR* EnumPath,
    const T EnumeratorValue
)

Public function Static

FString

 

GetValueAsString

(
    const TEnumAsByte< EnumType > Enume...
)

Public function Const

int64

 

GetValueByIndex

(
    int32 Index
)

Gets enum value by index in Names array. Asserts on invalid index

Public function Const

int64

 

GetValueByName

(
    FName InName,
    EGetByNameFlags Flags
)

Gets enum value by name, returns INDEX_NONE and optionally errors when name is not found.

Public function Const

int64

 

GetValueByNameString

(
    const FString& SearchString,
    EGetByNameFlags Flags
)

Gets enum value by name, returns INDEX_NONE and optionally errors when name is not found.

Public function Const

bool

 

HasMetaData

(
    const TCHAR* Key,
    int32 NameIndex
)

Wrapper method for easily determining whether this enum has metadata associated with it.

Public function Static

bool

 

IsFullEnumName

(
    const TCHAR* InEnumName
)

Checks if a enum name is fully qualified name.

Public function Const

bool

 

IsValidEnumName

(
    FName InName
)

Checks if enum has entry with given name. Includes autogenerated _MAX entry.

Public function Const

bool

 

IsValidEnumValue

(
    int64 InValue
)

Checks if enum has entry with given value. Includes autogenerated _MAX entry.

Public function Static

int64

 

LookupEnumName

(
    FName TestName,
    UEnum** FoundEnum
)

Searches the list of all enum value names for the specified name

Public function Static

int64

 

LookupEnumNameSlow

(
    const TCHAR* InTestShortName,
    UEnum** FoundEnum
)

Searches the list of all enum value names for the specified name

Public function Const

int32

 

NumEnums()

Public function Static

int64

 

ParseEnum

(
    const TCHAR*& Str
)

Parses the passed in string for a name, then searches for that name in any Enum (in any package)

Public function Const

void

 

RemoveMetaData

(
    const TCHAR* Key,
    int32 NameIndex
)

Remove given key meta data

Public function

void

 

RemoveNamesFromMasterList()

Removes the Names in this enum from the master AllEnumNames list

Public function Virtual Const

int64

 

ResolveEnumerator

(
    FArchive& Ar,
    int64 EnumeratorIndex
)

Try to update an out-of-date enum index after an enum changes at runtime

Public function

void

 

SetEnumDisplayNameFn

(
    FEnumDisplayNameFn InEnumDisplayNam...
)

Associate a function for looking up Enum display names by index, only intended for use by generated code

Public function Virtual

bool

 

SetEnums

(
    TArray< TPair< FName, int64 >>& In...,
    ECppForm InCppForm,
    bool bAddMaxKeyIfMissing
)

Sets the array of enums.

Public function Const

void

 

SetMetaData

(
    const TCHAR* Key,
    const TCHAR* InValue,
    int32 NameIndex
)

Set the metadata value associated with the specified key.

Public function Static

UClass *

 

StaticClass()

Returns a UClass object representing this class at runtime

Public function Static

EClassCastFl...

 

StaticClassCastFlags()

Returns the static cast flags for this class

Public function Static

const TCHAR ...

 

StaticPackage()

Returns the package this class belongs in

Public function Static

void

 

StaticRegisterNativesUEnum()

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Operators

Name Description

Public function

void *

 

operator new

(
    const size_t InSize,
    EInternal* InMem
)

For internal use only; use StaticConstructObject() to create new objects.

Public function

void *

 

operator new

(
    const size_t InSize,
    EInternal InInternalOnly,
    UObject* InOuter,
    FName InName,
    EObjectFlags InSetFlags
)

For internal use only; use StaticConstructObject() to create new objects.

Enums

Name

Description

Public enum

ECppForm

How this enum is declared in C++, affects the internal naming of enum values

Typedefs

Name

Description

Super

Typedef for the base class (UField)

ThisClass

Typedef for UEnum.

Constants

Name

Description

AllEnumNames

Global list of all value names used by all enums in memory, used for property text import

StaticClassFlags

Bitwise union of EClassFlags pertaining to this class.

Deprecated Functions

Name Description

Public function Const

int32

 

FindEnumIndex

(
    FName InName
)

FindEnumIndex is deprecated, call GetIndexByName or GetValueByName instead

Public function Static

int32

 

FindEnumRedirects

(
    const UEnum* Enum,
    FName EnumEntryName
)

FindEnumRedirects is deprecated, call GetIndexByNameString instead

Public function Const

FText

 

GetDisplayNameText

(
    int32 NameIndex
)

GetDisplayNameText with name index is deprecated, call GetDisplayNameTextByIndex instead

Public function Const

FName

 

GetEnum

(
    int32 InIndex
)

GetEnum is deprecated, call GetNameByIndex instead

Public function Const

FString

 

GetEnumName

(
    int32 InIndex
)

GetEnumName is deprecated, call GetNameStringByIndex instead

Public function Const

FString

 

GetEnumNameStringByValue

(
    int64 InValue
)

GetEnumNameStringByValue is deprecated, call GetNameStringByValue instead

Public function Const

FText

 

GetEnumText

(
    int32 NameIndex
)

GetEnumText with name index is deprecated, call GetDisplayNameTextByIndex instead

Public function

FText

 

GetEnumTextByValue

(
    int64 Value
)

GetEnumTextByValue with name index is deprecated, call GetDisplayNameTextByValue instead

Public function Const

FText

 

GetToolTipText

(
    int32 NameIndex
)

GetToolTipText with name index is deprecated, call GetToolTipTextByIndex instead

References

Module

CoreUObject

Header

Runtime/CoreUObject/Public/UObject/Class.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback