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

FScriptMapHelper: Pseudo dynamic map. 更多...

#include <UnrealType.h>

被 FScriptMapHelper_InContainer 继承.

Public 成员函数

int32 AddDefaultValue_Invalid_NeedsRehash ()
 Adds a blank, constructed value to a given size. 更多...
 
void AddPair (const void *KeyPtr, const void *ValuePtr)
 Adds the (key, value) pair to the map, returning true if the element was added, or false if the element was already present and has been overwritten
 
FORCEINLINE int32 AddUninitializedValue ()
 Add an uninitialized value to the end of the map. 更多...
 
void EmptyValues (int32 Slack=0)
 Remove all values from the map, calling destructors, etc as appropriate. 更多...
 
int32 FindInternalIndex (int32 LogicalIdx) const
 Maps have gaps in their indices, so this function translates a logical index (ie. 更多...
 
int32 FindMapIndexWithKey (const void *PairWithKeyToFind, int32 IndexHint=0) const
 Finds the index of an element in a map which matches the key in another pair. 更多...
 
uint8 * FindMapPairPtrFromHash (const void *KeyPtr)
 Finds the associated pair from hash, rather than linearly searching
 
FORCEINLINE uint8 * FindMapPairPtrWithKey (const void *PairWithKeyToFind, int32 IndexHint=0)
 Finds the pair in a map which matches the key in another pair. 更多...
 
void * FindOrAdd (const void *KeyPtr)
 Finds or adds a new default-constructed value 更多...
 
uint8 * FindValueFromHash (const void *KeyPtr)
 Finds the associated value from hash, rather than linearly searching
 
FORCEINLINE FScriptMapHelper (const FMapProperty *InProperty, const void *InMap)
 Constructor, brings together a property and an instance of the property located in memory 更多...
 
FProperty * GetKeyProperty () const
 Returns the property representing the key of the map pair. 更多...
 
FORCEINLINE uint8 * GetKeyPtr (int32 Index)
 Returns a uint8 pointer to the Key (first element) in the map. 更多...
 
FORCEINLINE int32 GetMaxIndex () const
 Returns the (non-inclusive) maximum index of elements in the map. 更多...
 
FORCEINLINE uint8 * GetPairPtr (int32 Index)
 Returns a uint8 pointer to the pair in the map 更多...
 
FORCEINLINE const uint8 * GetPairPtr (int32 Index) const
 Returns a uint8 pointer to the pair in the map. 更多...
 
FProperty * GetValueProperty () const
 Returns the property representing the value of the map pair. 更多...
 
FORCEINLINE uint8 * GetValuePtr (int32 Index)
 Returns a uint8 pointer to the Value (second element) in the map. 更多...
 
bool HasKey (const void *InBaseAddress, const FString &InKeyValue) const
 Checks if a key in the map matches the specified key 更多...
 
FORCEINLINE bool IsValidIndex (int32 Index) const
 Index range check 更多...
 
void MoveAssign (void *InOtherMap)
 Move the allocation from another map and make it our own. 更多...
 
FORCEINLINE int32 Num () const
 Returns the number of elements in the map. 更多...
 
COREUOBJECT_API void Rehash ()
 Rehashes the keys in the map. 更多...
 
void RemoveAt (int32 Index, int32 Count=1)
 Removes an element at the specified index, destroying it. 更多...
 
bool RemovePair (const void *KeyPtr)
 Removes the key and its associated value from the map
 

静态 Public 成员函数

static FORCEINLINE int32 Num (const void *Target)
 Static version of Num() used when you don't need to bother to construct a FScriptMapHelper. 更多...
 

详细描述

FScriptMapHelper: Pseudo dynamic map.

Used to work with map properties in a sensible way.

构造及析构函数说明

◆ FScriptMapHelper()

FORCEINLINE FScriptMapHelper::FScriptMapHelper ( const FMapProperty *  InProperty,
const void *  InMap 
)
inline

Constructor, brings together a property and an instance of the property located in memory

参数
InPropertyThe property associated with this memory
InMapPointer to raw memory that corresponds to this map. This can be NULL, and sometimes is, but in that case almost all operations will crash.

成员函数说明

◆ AddDefaultValue_Invalid_NeedsRehash()

int32 FScriptMapHelper::AddDefaultValue_Invalid_NeedsRehash ( )
inline

Adds a blank, constructed value to a given size.

Note that this will create an invalid map because all the keys will be default constructed, and the map needs rehashing.

返回
The index of the first element added.

◆ AddUninitializedValue()

FORCEINLINE int32 FScriptMapHelper::AddUninitializedValue ( )
inline

Add an uninitialized value to the end of the map.

返回
The index of the added element.

◆ EmptyValues()

void FScriptMapHelper::EmptyValues ( int32  Slack = 0)
inline

Remove all values from the map, calling destructors, etc as appropriate.

参数
Slackused to presize the set for a subsequent add, to avoid reallocation.

◆ FindInternalIndex()

int32 FScriptMapHelper::FindInternalIndex ( int32  LogicalIdx) const
inline

Maps have gaps in their indices, so this function translates a logical index (ie.

Nth element) to an internal index that can be used for the other functions in this class. NOTE: This is slow, do not use this for iteration!

◆ FindMapIndexWithKey()

int32 FScriptMapHelper::FindMapIndexWithKey ( const void *  PairWithKeyToFind,
int32  IndexHint = 0 
) const
inline

Finds the index of an element in a map which matches the key in another pair.

参数
PairWithKeyToFindThe address of a map pair which contains the key to search for.
IndexHintThe index to start searching from.
返回
The index of an element found in MapHelper, or -1 if none was found.

◆ FindMapPairPtrWithKey()

FORCEINLINE uint8 * FScriptMapHelper::FindMapPairPtrWithKey ( const void *  PairWithKeyToFind,
int32  IndexHint = 0 
)
inline

Finds the pair in a map which matches the key in another pair.

参数
PairWithKeyToFindThe address of a map pair which contains the key to search for.
IndexHintThe index to start searching from.
返回
A pointer to the found pair, or nullptr if none was found.

◆ FindOrAdd()

void * FScriptMapHelper::FindOrAdd ( const void *  KeyPtr)
inline

Finds or adds a new default-constructed value

No need to rehash after calling. The hash table must be properly hashed before calling.

返回
The address to the value, not the pair

◆ GetKeyProperty()

FProperty * FScriptMapHelper::GetKeyProperty ( ) const
inline

Returns the property representing the key of the map pair.

返回
The property representing the key of the map pair.

◆ GetKeyPtr()

FORCEINLINE uint8 * FScriptMapHelper::GetKeyPtr ( int32  Index)
inline

Returns a uint8 pointer to the Key (first element) in the map.

Currently identical to GetPairPtr, but provides clarity of purpose and avoids exposing implementation details of TMap.

参数
Indexindex of the item to return a pointer to.
返回
Pointer to the key, or nullptr if the map is empty.

◆ GetMaxIndex()

FORCEINLINE int32 FScriptMapHelper::GetMaxIndex ( ) const
inline

Returns the (non-inclusive) maximum index of elements in the map.

返回
The (non-inclusive) maximum index of elements in the map.

◆ GetPairPtr() [1/2]

FORCEINLINE uint8 * FScriptMapHelper::GetPairPtr ( int32  Index)
inline

Returns a uint8 pointer to the pair in the map

参数
Indexindex of the item to return a pointer to.
返回
Pointer to the pair, or nullptr if the map is empty.

◆ GetPairPtr() [2/2]

FORCEINLINE const uint8 * FScriptMapHelper::GetPairPtr ( int32  Index) const
inline

Returns a uint8 pointer to the pair in the map.

参数
Indexindex of the item to return a pointer to.
返回
Pointer to the pair, or nullptr if the map is empty.

◆ GetValueProperty()

FProperty * FScriptMapHelper::GetValueProperty ( ) const
inline

Returns the property representing the value of the map pair.

返回
The property representing the value of the map pair.

◆ GetValuePtr()

FORCEINLINE uint8 * FScriptMapHelper::GetValuePtr ( int32  Index)
inline

Returns a uint8 pointer to the Value (second element) in the map.

参数
Indexindex of the item to return a pointer to.
返回
Pointer to the value, or nullptr if the map is empty.

◆ HasKey()

bool FScriptMapHelper::HasKey ( const void *  InBaseAddress,
const FString &  InKeyValue 
) const
inline

Checks if a key in the map matches the specified key

参数
InBaseAddressThe base address of the map
InKeyValueThe key to find within the map
返回
True if the key is found, false otherwise

◆ IsValidIndex()

FORCEINLINE bool FScriptMapHelper::IsValidIndex ( int32  Index) const
inline

Index range check

参数
IndexIndex to check
返回
true if accessing this element is legal.

◆ MoveAssign()

void FScriptMapHelper::MoveAssign ( void *  InOtherMap)
inline

Move the allocation from another map and make it our own.

注解
The maps MUST be of the same type, and this function will NOT validate that!
参数
InOtherMapThe map to move the allocation from.

◆ Num() [1/2]

FORCEINLINE int32 FScriptMapHelper::Num ( ) const
inline

Returns the number of elements in the map.

返回
The number of elements in the map.

◆ Num() [2/2]

static FORCEINLINE int32 FScriptMapHelper::Num ( const void *  Target)
inlinestatic

Static version of Num() used when you don't need to bother to construct a FScriptMapHelper.

Returns the number of elements in the map.

参数
TargetPointer to the raw memory associated with a FScriptMap
返回
The number of elements in the map.

◆ Rehash()

COREUOBJECT_API void FScriptMapHelper::Rehash ( )

Rehashes the keys in the map.

This function must be called to create a valid map.

◆ RemoveAt()

void FScriptMapHelper::RemoveAt ( int32  Index,
int32  Count = 1 
)
inline

Removes an element at the specified index, destroying it.

参数
IndexThe index of the element to remove.

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