FName

Public name, available to the world.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/UObject/NameTypes.h

Include

#include "UObject/NameTypes.h"

Syntax

class FName

Remarks

Public name, available to the world. Names are stored as a combination of an index into a table of unique strings and an instance number. Names are case-insensitive, but case-preserving (when WITH_CASE_PRESERVING_NAME is 1)

Constructors

Name Description

Public function

FName()

Default constructor, initialized to None

Public function

FName

(
    int32 Len,
    const WIDECHAR* Name,
    EFindName FindType
)

Create FName from non-null string with known length

Public function

FName

(
    int32 Len,
    const ANSICHAR* Name,
    EFindName FindType
)

Public function

FName

(
    const WIDECHAR* Name,
    int32 InNumber,
    EFindName FindType
)

Create an FName.

Public function

FName

(
    const ANSICHAR* Name,
    int32 InNumber,
    EFindName FindType
)

Public function

FName

(
    int32 Len,
    const WIDECHAR* Name,
    int32 Number,
    EFindName FindType
)

Public function

FName

(
    int32 Len,
    const ANSICHAR* Name,
    int32 InNumber,
    EFindName FindType
)

Public function

FName

(
    const TCHAR* Name,
    int32 InNumber,
    EFindName FindType,
    bool bSplitName
)

Create an FName.

Public function

FName

(
    EName N
)

Create an FName with a hardcoded string index.

Public function

FName

(
    ENoInit
)

Scary no init constructor, used for something obscure in UObjectBase

Public function

FName

(
    const FNameEntrySerialized& Loaded...
)

Constructor used by FLinkerLoad when loading its name table; Creates an FName with an instance number of 0 that does not attempt to split the FName into string and number portions.

Public function

FName

(
    EName N,
    int32 InNumber
)

Create an FName with a hardcoded string index and (instance).

Public function

FName

(
    const FName& Other,
    int32 InNumber
)

Create an FName from an existing string, but with a different instance.

Public function

FName

(
    const WIDECHAR* Name,
    EFindName FindType
)

Create an FName.

Public function

FName

(
    const ANSICHAR* Name,
    EFindName FindType
)

Public function

FName

(
    const FNameEntryId InComparisonInde...,
    const FNameEntryId InDisplayIndex,
    const int32 InNumber
)

Create an FName from its component parts Only call this if you really know what you're doing

Functions

Name Description

Public function Const

void

 

AppendString

(
    FString& Out
)

Converts an FName to a readable format, in place, appending to an existing string (ala GetFullName)

Public function Static

void

 

AutoTest()

Run autotest on FNames.

Public function Const

int32

 

Compare

(
    const FName& Other
)

Compares name to passed in one. Sort is alphabetical ascending.

Public function Const

int32

 

CompareIndexes

(
    const FName& Other
)

Fast compares name to passed in one using indexes. Sort is allocation order ascending.

Public function Static

FName

 

CreateFromDisplayId

(
    FNameEntryId DisplayId,
    int32 Number
)

Only call this if you really know what you're doing

Public function Static

TArray< cons...

 

DebugDump()

Public function Static

void

 

DisplayHash

(
    FOutputDevice& Ar
)

Public function Const

bool

 

FastLess

(
    const FName& Other
)

Fast non-alphabetical order that is only stable during this process' lifetime.

Public function Static

FNameEntryId

 

GetComparisonIdFromDisplayId

(
    FNameEntryId DisplayId
)

Public function Const

FNameEntryId

 

GetComparisonIndex()

Public function Const

const FNameE...

 

GetComparisonNameEntry()

Public function Const

FNameEntryId

 

GetDisplayIndex()

Public function Const

const FNameE...

 

GetDisplayNameEntry()

Public function Static

FNameEntry c...

 

GetEntry

(
    FNameEntryId Id
)

Public function Static

FNameEntry c...

 

GetEntry

(
    EName Ename
)

Public function Static

int32

 

GetNameEntryMemorySize()

Public function Static

int32

 

GetNameTableMemorySize()

Public function Static

int32

 

GetNumAnsiNames()

Public function Const

int32

 

GetNumber()

Public function Static

int32

 

GetNumWideNames()

Public function Const

void

 

GetPlainANSIString

(
    ANSICHAR AnsiName
)

Copy ANSI name without number part. Must only be used for ANSI FNames. Doesn't allocate.

Public function Const

FString

 

GetPlainNameString()

Get name without number part as a dynamically allocated string

Public function Const

uint32

 

GetPlainNameString

(
    TCHAR OutName
)

Convert name without number part into TCHAR buffer and returns string length. Doesn't allocate.

Public function Const

void

 

GetPlainWIDEString

(
    WIDECHAR WideName
)

Copy wide name without number part. Must only be used for wide FNames. Doesn't allocate.

Public function Const

uint32

 

GetStringLength()

Get the number of characters, excluding null-terminator, that ToString() would yield

Public function Const

bool

 

IsEqual

(
    const FName& Other,
    const ENameCase CompareMethod,
    const bool bCompareNumber
)

Check to see if this FName matches the other FName, potentially also checking for any case variations

Public function Const

bool

 

IsNone()

True for FName(), FName(NAME_None) and FName

Public function Const

bool

 

IsValid()

Paranoid sanity check

Public function Const

bool

 

IsValidGroupName

(
    FText& OutReason,
    bool bIsGroupName
)

Takes an FName and checks to see that it follows the rules that Unreal requires for package or group names.

Public function Const

bool

 

IsValidIndexFast()

Paranoid sanity check, same as IsValid()

Public function Const

bool

 

IsValidObjectName

(
    FText& OutReason
)

Takes an FName and checks to see that it follows the rules that Unreal requires for object names.

Public function Const

bool

 

IsValidXName

(
    FText& OutReason,
    const FString& InInvalidChars
)

Takes an FName and checks to see that it follows the rules that Unreal requires.

Public function Static

bool

 

IsValidXName

(
    const FString& InName,
    const FString& InInvalidChars,
    FText* OutReason,
    const FText* InErrorCtx
)

Checks to see that a given name-like string follows the rules that Unreal requires.

Public function Const

bool

 

IsValidXName

(
    const FString& InInvalidChars,
    FText* OutReason,
    const FText* InErrorCtx
)

Checks to see that a FName follows the rules that Unreal requires.

Public function Const

bool

 

LexicalLess

(
    const FName& Other
)

Slow alphabetical order that is stable / deterministic over process runs.

Public function Static

FString

 

NameToDisplayString

(
    const FString& InDisplayName,
    const bool bIsBool
)

Takes a string and breaks it down into a human readable string.

Public function Static

FString

 

SafeString

(
    FNameEntryId InDisplayIndex,
    int32 InstanceNumber
)

Public function

void

 

SetNumber

(
    const int32 NewNumber
)

Public function Const

const EName ...

 

ToEName()

Get the EName that this FName represents or nullptr

Public function Const

FString

 

ToString()

Converts an FName to a readable format

Public function Const

void

 

ToString

(
    FString& Out
)

Converts an FName to a readable format, in place

Public function Const

uint32

 

ToString

(
    TCHAR Out
)

Public function Const

uint32

 

ToString

(
    TCHAR* Out,
    uint32 OutSize
)

Convert to string buffer to avoid dynamic allocations and returns string length

Operators

Name Description

Public function Const

bool

 

operator!=

(
    EName Ename
)

Public function Const

bool

 

operator!=

(
    const CharType* Other
)

Inequality operator.

Public function Const

bool

 

operator!=

(
    const FName& Other
)

Public function Const

bool

 

operator==

(
    const FName& Other
)

Public function Const

bool

 

operator==

(
    const ANSICHAR* Other
)

Equality operator.

Public function Const

bool

 

operator==

(
    EName Ename
)

Public function Const

bool

 

operator==

(
    const WIDECHAR* Other
)

Constants

Name

Description

StringBufferSize

Buffer size required for any null-terminated FName string, i.e. [name] '_' [digits] '\0'

Deprecated Functions

Name Description

Public function Const

Default lexi...

 

operator<

(
    const FName& Other
)

Please use FastLess() / FNameFastLess or LexicalLess() / FNameLexicalLess instead.

Public function Const

bool

 

operator>

(
    const FName& Other
)

Please use B.FastLess(A) or B.LexicalLess(A) instead of A > B.

Select Skin
Light
Dark

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