engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | 静态 Public 属性 | 所有成员列表
FName类 参考

Public name, available to the world. 更多...

#include <NameTypes.h>

Public 成员函数

void AppendString (FString &Out) const
 Converts an FName to a readable format, in place, appending to an existing string (ala GetFullName) 更多...
 
void AppendString (FStringBuilderBase &Out) const
 Converts an FName to a readable format, in place, appending to an existing string (ala GetFullName) 更多...
 
int32 Compare (const FName &Other) const
 Compares name to passed in one. 更多...
 
FORCEINLINE int32 CompareIndexes (const FName &Other) const
 Fast compares name to passed in one using indexes. 更多...
 
FORCEINLINE bool FastLess (const FName &Other) const
 Fast non-alphabetical order that is only stable during this process' lifetime.
 
FORCEINLINE FName ()
 Default constructor, initialized to None
 
FORCEINLINE FName (const FName &Other, int32 InNumber)
 Create an FName from an existing string, but with a different instance. 更多...
 
FORCEINLINE FName (const FNameEntryId InComparisonIndex, const FNameEntryId InDisplayIndex, const int32 InNumber)
 Create an FName from its component parts Only call this if you really know what you're doing
 
 FName (const FNameEntrySerialized &LoadedEntry)
 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. 更多...
 
 FName (const TCHAR *Name, int32 InNumber, EFindName FindType, bool bSplitName)
 Create an FName. 更多...
 
 FName (const WIDECHAR *Name, EFindName FindType=FNAME_Add)
 Create an FName. 更多...
 
 FName (const WIDECHAR *Name, int32 InNumber, EFindName FindType=FNAME_Add)
 Create an FName. 更多...
 
FORCEINLINE FName (EName Ename)
 Create an FName with a hardcoded string index. 更多...
 
FORCEINLINE FName (EName Ename, int32 InNumber)
 Create an FName with a hardcoded string index and (instance). 更多...
 
 FName (ENoInit)
 Scary no init constructor, used for something obscure in UObjectBase
 
 FName (int32 Len, const WIDECHAR *Name, EFindName FindType=FNAME_Add)
 Create FName from non-null string with known length

 
void GetPlainANSIString (ANSICHAR(&AnsiName)[NAME_SIZE]) const
 Copy ANSI name without number part. 更多...
 
FString GetPlainNameString () const
 Get name without number part as a dynamically allocated string
 
uint32 GetPlainNameString (TCHAR(&OutName)[NAME_SIZE]) const
 Convert name without number part into TCHAR buffer and returns string length. 更多...
 
void GetPlainWIDEString (WIDECHAR(&WideName)[NAME_SIZE]) const
 Copy wide name without number part. 更多...
 
uint32 GetStringLength () const
 Get the number of characters, excluding null-terminator, that ToString() would yield
 
FORCEINLINE bool IsEqual (const FName &Other, const ENameCase CompareMethod=ENameCase::IgnoreCase, const bool bCompareNumber=true) const
 Check to see if this FName matches the other FName, potentially also checking for any case variations
 
FORCEINLINE bool IsNone () const
 True for FName(), FName(NAME_None) and FName("None")
 
bool IsValid () const
 Paranoid sanity check 更多...
 
bool IsValidGroupName (FText &OutReason, bool bIsGroupName=false) const
 Takes an FName and checks to see that it follows the rules that Unreal requires for package or group names. 更多...
 
bool IsValidIndexFast () const
 Paranoid sanity check, same as IsValid()
 
bool IsValidObjectName (FText &OutReason) const
 Takes an FName and checks to see that it follows the rules that Unreal requires for object names. 更多...
 
bool IsValidXName (const FString &InInvalidChars=INVALID_NAME_CHARACTERS, FText *OutReason=nullptr, const FText *InErrorCtx=nullptr) const
 Checks to see that a FName follows the rules that Unreal requires. 更多...
 
bool IsValidXName (FText &OutReason, const FString &InInvalidChars=INVALID_NAME_CHARACTERS) const
 Takes an FName and checks to see that it follows the rules that Unreal requires. 更多...
 
FORCEINLINE bool LexicalLess (const FName &Other) const
 Slow alphabetical order that is stable / deterministic over process runs.
 
template<typename CharType >
bool operator!= (const CharType *Other) const
 Inequality operator. 更多...
 
bool operator== (const ANSICHAR *Other) const
 Equality operator. 更多...
 
const EName * ToEName () const
 Get the EName that this FName represents or nullptr
 
FString ToString () const
 Converts an FName to a readable format 更多...
 
void ToString (FString &Out) const
 Converts an FName to a readable format, in place 更多...
 
void ToString (FStringBuilderBase &Out) const
 Converts an FName to a readable format, in place 更多...
 
uint32 ToString (TCHAR *Out, uint32 OutSize) const
 Convert to string buffer to avoid dynamic allocations and returns string length 更多...
 
bool TryAppendAnsiString (FAnsiStringBuilderBase &Out) const
 Converts an ANSI FName to a readable format appended to the string builder. 更多...
 

静态 Public 成员函数

static void AutoTest ()
 Run autotest on FNames.
 
static FName CreateFromDisplayId (FNameEntryId DisplayId, int32 Number)
 Only call this if you really know what you're doing
 
static int32 GetNameEntryMemorySize ()
 
static int32 GetNameTableMemorySize ()
 
static int32 GetNumAnsiNames ()
 
static int32 GetNumWideNames ()
 
static bool IsValidXName (const FName InName, const FString &InInvalidChars, FText *OutReason=nullptr, const FText *InErrorCtx=nullptr)
 Checks to see that a given name-like string follows the rules that Unreal requires. 更多...
 
static FString NameToDisplayString (const FString &InDisplayName, const bool bIsBool)
 Takes a string and breaks it down into a human readable string. 更多...
 
static void TearDown ()
 Tear down system and free all allocated memory 更多...
 

静态 Public 属性

static constexpr uint32 StringBufferSize = NAME_SIZE + 1 + 10
 Buffer size required for any null-terminated FName string, i.e. 更多...
 

详细描述

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)

示例
/github/workspace/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

构造及析构函数说明

◆ FName() [1/7]

FORCEINLINE FName::FName ( EName  Ename)
inline

Create an FName with a hardcoded string index.

参数
NThe hardcoded value the string portion of the name will have. The number portion will be NAME_NO_NUMBER

◆ FName() [2/7]

FORCEINLINE FName::FName ( EName  Ename,
int32  InNumber 
)
inline

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

参数
NThe hardcoded value the string portion of the name will have
InNumberThe hardcoded value for the number portion of the name

◆ FName() [3/7]

FORCEINLINE FName::FName ( const FName &  Other,
int32  InNumber 
)
inline

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

参数
OtherThe FName to take the string values from
InNumberThe hardcoded value for the number portion of the name

◆ FName() [4/7]

FName::FName ( const WIDECHAR *  Name,
EFindName  FindType = FNAME_Add 
)

Create an FName.

If FindType is FNAME_Find, and the string part of the name doesn't already exist, then the name will be NAME_None

参数
NameValue for the string portion of the name
FindTypeAction to take (see EFindName)

◆ FName() [5/7]

FName::FName ( const WIDECHAR *  Name,
int32  InNumber,
EFindName  FindType = FNAME_Add 
)

Create an FName.

If FindType is FNAME_Find, and the string part of the name doesn't already exist, then the name will be NAME_None

参数
NameValue for the string portion of the name
NumberValue for the number portion of the name
FindTypeAction to take (see EFindName)
bSplitNametrue if the trailing number should be split from the name when Number == NAME_NO_NUMBER_INTERNAL, or false to always use the name as-is

◆ FName() [6/7]

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

Create an FName.

If FindType is FNAME_Find, and the string part of the name doesn't already exist, then the name will be NAME_None

参数
NameValue for the string portion of the name
NumberValue for the number portion of the name
FindTypeAction to take (see EFindName)
bSplitNametrue if the trailing number should be split from the name when Number == NAME_NO_NUMBER_INTERNAL, or false to always use the name as-is

◆ FName() [7/7]

FName::FName ( const FNameEntrySerialized &  LoadedEntry)

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.

Also, this version skips calculating the hashes of the names if possible

成员函数说明

◆ AppendString() [1/2]

void FName::AppendString ( FString &  Out) const

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

参数
OutString to append with the string representation of the name

◆ AppendString() [2/2]

void FName::AppendString ( FStringBuilderBase &  Out) const

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

参数
OutStringBuilder to append with the string representation of the name

◆ Compare()

int32 FName::Compare ( const FName &  Other) const

Compares name to passed in one.

Sort is alphabetical ascending.

参数
OtherName to compare this against
返回
< 0 is this < Other, 0 if this == Other, > 0 if this > Other

◆ CompareIndexes()

FORCEINLINE int32 FName::CompareIndexes ( const FName &  Other) const
inline

Fast compares name to passed in one using indexes.

Sort is allocation order ascending.

参数
OtherName to compare this against
返回
< 0 is this < Other, 0 if this == Other, > 0 if this > Other

◆ GetNameEntryMemorySize()

static int32 FName::GetNameEntryMemorySize ( )
static
返回
Size of all name entries.

◆ GetNameTableMemorySize()

static int32 FName::GetNameTableMemorySize ( )
static
返回
Size of Name Table object as a whole

◆ GetNumAnsiNames()

static int32 FName::GetNumAnsiNames ( )
static
返回
number of ansi names in name table

◆ GetNumWideNames()

static int32 FName::GetNumWideNames ( )
static
返回
number of wide names in name table

◆ GetPlainANSIString()

void FName::GetPlainANSIString ( ANSICHAR(&)  AnsiName[NAME_SIZE]) const

Copy ANSI name without number part.

Must only be used for ANSI FNames. Doesn't allocate.

◆ GetPlainNameString()

uint32 FName::GetPlainNameString ( TCHAR(&)  OutName[NAME_SIZE]) const

Convert name without number part into TCHAR buffer and returns string length.

Doesn't allocate.

◆ GetPlainWIDEString()

void FName::GetPlainWIDEString ( WIDECHAR(&)  WideName[NAME_SIZE]) const

Copy wide name without number part.

Must only be used for wide FNames. Doesn't allocate.

◆ IsValid()

bool FName::IsValid ( ) const
inline

Paranoid sanity check

All FNames are valid except for stomped memory, dangling pointers, etc. Should only be used to investigate such bugs and not in production code.

◆ IsValidGroupName()

bool FName::IsValidGroupName ( FText &  OutReason,
bool  bIsGroupName = false 
) const
inline

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

参数
OutReasonIf the check fails, this string is filled in with the reason why.
bIsGroupNameif true, check legality for a group name, else check legality for a package name
返回
true if the name is valid

◆ IsValidObjectName()

bool FName::IsValidObjectName ( FText &  OutReason) const
inline

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

参数
OutReasonIf the check fails, this string is filled in with the reason why.
返回
true if the name is valid

◆ IsValidXName() [1/3]

static bool FName::IsValidXName ( const FName  InName,
const FString &  InInvalidChars,
FText *  OutReason = nullptr,
const FText *  InErrorCtx = nullptr 
)
static

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

参数
InNameString containing the name to test.
InInvalidCharsThe set of invalid characters that the name cannot contain.
OutReasonIf the check fails, this string is filled in with the reason why.
InErrorCtxError context information to show in the error message (default is "Name").
返回
true if the name is valid

◆ IsValidXName() [2/3]

bool FName::IsValidXName ( const FString &  InInvalidChars = INVALID_NAME_CHARACTERS,
FText *  OutReason = nullptr,
const FText *  InErrorCtx = nullptr 
) const
inline

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

参数
InInvalidCharsThe set of invalid characters that the name cannot contain
OutReasonIf the check fails, this string is filled in with the reason why.
InErrorCtxError context information to show in the error message (default is "Name").
返回
true if the name is valid

◆ IsValidXName() [3/3]

bool FName::IsValidXName ( FText &  OutReason,
const FString &  InInvalidChars = INVALID_NAME_CHARACTERS 
) const
inline

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

参数
OutReasonIf the check fails, this string is filled in with the reason why.
InInvalidCharsThe set of invalid characters that the name cannot contain
返回
true if the name is valid

◆ NameToDisplayString()

static FString FName::NameToDisplayString ( const FString &  InDisplayName,
const bool  bIsBool 
)
static

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

For example - "bCreateSomeStuff" becomes "Create Some Stuff?" and "DrawScale3D" becomes "Draw Scale 3D".

参数
InDisplayName[In, Out] The name to sanitize
bIsBoolTrue if the name is a bool
返回
the sanitized version of the display name

◆ operator!=()

template<typename CharType >
bool FName::operator!= ( const CharType *  Other) const
inline

Inequality operator.

参数
OtherString to compare this name to
返回
true if name does not match the string, false otherwise

◆ operator==()

bool FName::operator== ( const ANSICHAR *  Other) const

Equality operator.

参数
OtherString to compare this name to
返回
true if name matches the string, false otherwise

◆ TearDown()

static void FName::TearDown ( )
static

Tear down system and free all allocated memory

FName must not be used after teardown

◆ ToString() [1/4]

FString FName::ToString ( ) const

Converts an FName to a readable format

返回
String representation of the name

◆ ToString() [2/4]

void FName::ToString ( FString &  Out) const

Converts an FName to a readable format, in place

参数
OutString to fill with the string representation of the name

◆ ToString() [3/4]

void FName::ToString ( FStringBuilderBase &  Out) const

Converts an FName to a readable format, in place

参数
OutStringBuilder to fill with the string representation of the name

◆ ToString() [4/4]

uint32 FName::ToString ( TCHAR *  Out,
uint32  OutSize 
) const

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

Fails hard if OutLen < GetStringLength() + 1. StringBufferSize guarantees success.

Note that a default constructed FName returns "None" instead of ""

◆ TryAppendAnsiString()

bool FName::TryAppendAnsiString ( FAnsiStringBuilderBase &  Out) const

Converts an ANSI FName to a readable format appended to the string builder.

参数
OutA string builder to write the readable representation of the name into.
返回
Whether the string is ANSI. A return of false indicates that the string was wide and was not written.

类成员变量说明

◆ StringBufferSize

constexpr uint32 FName::StringBufferSize = NAME_SIZE + 1 + 10
staticconstexpr

Buffer size required for any null-terminated FName string, i.e.

[name] '_' [digits] '\0'


该类的文档由以下文件生成: