UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FScriptSetHelper Class Reference

#include <UnrealType.h>

+ Inheritance diagram for FScriptSetHelper:

Public Types

using FIterator = TScriptContainerIterator< FScriptSetHelper >
 

Public Member Functions

FIterator CreateIterator () const
 
FIterator CreateIterator (const int32 InLogicalIndex) const
 
 FScriptSetHelper (const FSetProperty *InProperty, const void *InSet)
 
 FScriptSetHelper (FProperty *InElementProp, const void *InSet, const FScriptSetLayout &InLayout)
 
UE_FORCEINLINE_HINT bool IsValidIndex (int32 InternalIndex) const
 
int32 Num () const
 
int32 NumUnchecked () const
 
int32 GetMaxIndex () const
 
uint8GetElementPtr (int32 InternalIndex)
 
UE_FORCEINLINE_HINT const uint8GetElementPtr (int32 InternalIndex) const
 
uint8GetElementPtr (const FIterator Iterator)
 
UE_FORCEINLINE_HINT const uint8GetElementPtr (const FIterator Iterator) const
 
uint8FindNthElementPtr (int32 N)
 
const uint8FindNthElementPtr (int32 N) const
 
void MoveAssign (void *InOtherSet)
 
int32 AddUninitializedValue ()
 
void EmptyElements (int32 Slack=0)
 
int32 AddDefaultValue_Invalid_NeedsRehash ()
 
FPropertyGetElementProperty () const
 
void RemoveAt (int32 InternalIndex, int32 Count=1)
 
COREUOBJECT_API void Rehash ()
 
int32 FindInternalIndex (int32 LogicalIdx) const
 
int32 FindLogicalIndex (int32 InternalIdx) const
 
int32 FindElementIndex (const void *ElementToFind, int32 IndexHint=0) const
 
uint8FindElementPtr (const void *ElementToFind, int32 IndexHint=0)
 
int32 FindElementIndexFromHash (const void *ElementToFind) const
 
uint8FindElementPtrFromHash (const void *ElementToFind)
 
void AddElement (const void *ElementToAdd)
 
bool RemoveElement (const void *ElementToRemove)
 

Static Public Member Functions

static int32 Num (const void *Target)
 
static FScriptSetHelper CreateHelperFormElementProperty (FProperty *InElementProperty, const void *InSet)
 

Public Attributes

FPropertyElementProp
 
FScriptSetSet
 
FScriptSetLayout SetLayout
 

Friends

class FSetProperty
 

Detailed Description

FScriptSetHelper: Pseudo dynamic Set. Used to work with Set properties in a sensible way. Note that the set can contain invalid entries some number of valid entries (i.e. Num() ) can be smaller that the actual number of elements (i.e. GetMaxIndex() ).

Internal index naming is used to identify the actual index in the container which can point to an invalid entry. It can be used for methods like Get<Item>Ptr, Get<Item>PtrWithoutCheck or IsValidIndex.

Logical index naming is used to identify only valid entries in the container so it can be smaller than the internal index in case we skipped invalid entries to reach the next valid one. This index is used on method like FindNth<Item>Ptr or FindInternalIndex. This is also the type of index we receive from most editor events (e.g. property change events) so it is strongly suggested to rely on FScriptSetHelper::FIterator to iterate or convert to internal index.

Member Typedef Documentation

◆ FIterator

Constructor & Destructor Documentation

◆ FScriptSetHelper() [1/2]

FScriptSetHelper::FScriptSetHelper ( const FSetProperty InProperty,
const void InSet 
)
inline

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

Parameters
InPropertyThe property associated with this memory
InSetPointer to raw memory that corresponds to this Set. This can be NULL, and sometimes is, but in that case almost all operations will crash.

◆ FScriptSetHelper() [2/2]

FScriptSetHelper::FScriptSetHelper ( FProperty InElementProp,
const void InSet,
const FScriptSetLayout InLayout 
)
inline

Member Function Documentation

◆ AddDefaultValue_Invalid_NeedsRehash()

int32 FScriptSetHelper::AddDefaultValue_Invalid_NeedsRehash ( )
inline

Adds a blank, constructed value to a given size. Note that this will create an invalid Set because all the keys will be default constructed, and the set needs rehashing.

Returns
The index of the first element added.

◆ AddElement()

void FScriptSetHelper::AddElement ( const void ElementToAdd)
inline

Adds the element to the set, returning true if the element was added, or false if the element was already present

◆ AddUninitializedValue()

int32 FScriptSetHelper::AddUninitializedValue ( )
inline

Add an uninitialized value to the end of the set.

Returns
The index of the added element.

◆ CreateHelperFormElementProperty()

static FScriptSetHelper FScriptSetHelper::CreateHelperFormElementProperty ( FProperty InElementProperty,
const void InSet 
)
inlinestatic

◆ CreateIterator() [1/2]

FIterator FScriptSetHelper::CreateIterator ( ) const
inline

◆ CreateIterator() [2/2]

FIterator FScriptSetHelper::CreateIterator ( const int32  InLogicalIndex) const
inline

◆ EmptyElements()

void FScriptSetHelper::EmptyElements ( int32  Slack = 0)
inline

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

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

◆ FindElementIndex()

int32 FScriptSetHelper::FindElementIndex ( const void ElementToFind,
int32  IndexHint = 0 
) const
inline

Finds the index of an element in a set

Parameters
ElementToFindThe address of an element to search for.
IndexHintThe index to start searching from.
Returns
The index of an element found in SetHelper, or -1 if none was found.

◆ FindElementIndexFromHash()

int32 FScriptSetHelper::FindElementIndexFromHash ( const void ElementToFind) const
inline

Finds element index from hash, rather than linearly searching

◆ FindElementPtr()

uint8 * FScriptSetHelper::FindElementPtr ( const void ElementToFind,
int32  IndexHint = 0 
)
inline

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

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

◆ FindElementPtrFromHash()

uint8 * FScriptSetHelper::FindElementPtrFromHash ( const void ElementToFind)
inline

Finds element pointer from hash, rather than linearly searching

◆ FindInternalIndex()

int32 FScriptSetHelper::FindInternalIndex ( int32  LogicalIdx) const
inline

Sets 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! Use CreateIterator() instead.

◆ FindLogicalIndex()

int32 FScriptSetHelper::FindLogicalIndex ( int32  InternalIdx) const
inline

Sets have gaps in their indices, so this function translates a internal index to an logical index (ie. Nth element). NOTE: This is slow, do not use this for iteration!

◆ FindNthElementPtr() [1/2]

uint8 * FScriptSetHelper::FindNthElementPtr ( int32  N)
inline

Returns a uint8 pointer to the the Nth valid element in the set (skipping invalid entries). NOTE: This is slow, do not use this for iteration! Use CreateIterator() instead.

Returns
Pointer to the element, or nullptr if the index is invalid.

◆ FindNthElementPtr() [2/2]

const uint8 * FScriptSetHelper::FindNthElementPtr ( int32  N) const
inline

Returns a uint8 pointer to the the Nth valid element in the set (skipping invalid entries). NOTE: This is slow, do not use this for iteration! Use CreateIterator() instead.

Returns
Pointer to the element, or nullptr if the index is invalid.

◆ GetElementProperty()

FProperty * FScriptSetHelper::GetElementProperty ( ) const
inline

Returns the property representing the element of the set

◆ GetElementPtr() [1/4]

uint8 * FScriptSetHelper::GetElementPtr ( const FIterator  Iterator)
inline

Returns a uint8 pointer to the element in the set.

Parameters
IteratorA valid iterator of the item to return a pointer to.
Returns
Pointer to the element, or will fail a check if an invalid iterator is provided.

◆ GetElementPtr() [2/4]

UE_FORCEINLINE_HINT const uint8 * FScriptSetHelper::GetElementPtr ( const FIterator  Iterator) const
inline

Returns a uint8 pointer to the element in the set.

Parameters
IteratorA valid iterator of the item to return a pointer to.
Returns
Pointer to the element, or will fail a check if an invalid iterator is provided.

◆ GetElementPtr() [3/4]

uint8 * FScriptSetHelper::GetElementPtr ( int32  InternalIndex)
inline

Returns a uint8 pointer to the element in the set.

Parameters
InternalIndexindex of the item to return a pointer to.
Returns
Pointer to the element, or nullptr if the set is empty.

◆ GetElementPtr() [4/4]

UE_FORCEINLINE_HINT const uint8 * FScriptSetHelper::GetElementPtr ( int32  InternalIndex) const
inline

Returns a uint8 pointer to the element in the set.

Parameters
InternalIndexindex of the item to return a pointer to.
Returns
Pointer to the element, or nullptr if the set is empty.

◆ GetMaxIndex()

int32 FScriptSetHelper::GetMaxIndex ( ) const
inline

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

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

◆ IsValidIndex()

UE_FORCEINLINE_HINT bool FScriptSetHelper::IsValidIndex ( int32  InternalIndex) const
inline

Index range check

Parameters
InternalIndexIndex to check
Returns
true if accessing this element is legal.

◆ MoveAssign()

void FScriptSetHelper::MoveAssign ( void InOtherSet)
inline

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

Note
The sets MUST be of the same type, and this function will NOT validate that!
Parameters
InOtherSetThe set to move the allocation from.

◆ Num() [1/2]

int32 FScriptSetHelper::Num ( ) const
inline

Returns the number of elements in the set.

Returns
The number of elements in the set.

◆ Num() [2/2]

static int32 FScriptSetHelper::Num ( const void Target)
inlinestatic

Static version of Num() used when you don't need to bother to construct a FScriptSetHelper. Returns the number of elements in the set.

Parameters
TargetPointer to the raw memory associated with a FScriptSet
Returns
The number of elements in the set.

◆ NumUnchecked()

int32 FScriptSetHelper::NumUnchecked ( ) const
inline

Returns the number of elements in the set. Needed to allow reading of the num when the set is 'invalid' during its intrusive unset state.

Returns
The number of elements in the set.

◆ Rehash()

void FScriptSetHelper::Rehash ( )

Rehashes the keys in the set. This function must be called to create a valid set.

◆ RemoveAt()

void FScriptSetHelper::RemoveAt ( int32  InternalIndex,
int32  Count = 1 
)
inline

Removes an element at the specified index, destroying it.

Parameters
InternalIndexThe index of the element to remove.

◆ RemoveElement()

bool FScriptSetHelper::RemoveElement ( const void ElementToRemove)
inline

Removes the element from the set

Friends And Related Symbol Documentation

◆ FSetProperty

friend class FSetProperty
friend

Member Data Documentation

◆ ElementProp

FProperty* FScriptSetHelper::ElementProp

◆ Set

FScriptSet* FScriptSetHelper::Set

◆ SetLayout

FScriptSetLayout FScriptSetHelper::SetLayout

The documentation for this class was generated from the following files: