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

#include <UnrealType.h>

+ Inheritance diagram for FScriptArrayHelper:

Public Member Functions

UE_FORCEINLINE_HINT FScriptArrayHelper (const FArrayProperty *InProperty, const void *InArray)
 
UE_FORCEINLINE_HINT bool IsValidIndex (int32 Index) const
 
int32 Num () const
 
int32 NumUnchecked () const
 
uint8GetRawPtr (int32 Index=0)
 
UE_FORCEINLINE_HINT uint8GetElementPtr (int32 Index=0)
 
void EmptyAndAddValues (int32 Count)
 
void EmptyAndAddUninitializedValues (int32 Count)
 
bool ExpandForIndex (int32 Index)
 
void Resize (int32 Count)
 
int32 AddValues (int32 Count)
 
UE_FORCEINLINE_HINT int32 AddValue ()
 
int32 AddUninitializedValues (int32 Count)
 
UE_FORCEINLINE_HINT int32 AddUninitializedValue ()
 
void InsertValues (int32 Index, int32 Count=1)
 
void EmptyValues (int32 Slack=0)
 
void RemoveValues (int32 Index, int32 Count=1)
 
void ClearValues (int32 Index, int32 Count=1)
 
void SwapValues (int32 A, int32 B)
 
void MoveAssign (void *InOtherArray)
 
void CountBytes (FArchive &Ar) const
 
void DestroyContainer_Unsafe ()
 

Static Public Member Functions

static FScriptArrayHelper CreateHelperFormInnerProperty (const FProperty *InInnerProperty, const void *InArray, EArrayPropertyFlags InArrayFlags=EArrayPropertyFlags::None)
 

Detailed Description

FScriptArrayHelper: Pseudo dynamic array. Used to work with array properties in a sensible way.

Constructor & Destructor Documentation

◆ FScriptArrayHelper()

UE_FORCEINLINE_HINT FScriptArrayHelper::FScriptArrayHelper ( const FArrayProperty InProperty,
const void InArray 
)
inline

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

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

Member Function Documentation

◆ AddUninitializedValue()

UE_FORCEINLINE_HINT int32 FScriptArrayHelper::AddUninitializedValue ( )
inline

Add an uninitialized value to the end of the array.

Returns
the index of the newly added item.

◆ AddUninitializedValues()

int32 FScriptArrayHelper::AddUninitializedValues ( int32  Count)
inline

Add uninitialized values to the end of the array.

Parameters
Countthe number of items to insert.
Returns
the index of the first newly added item.

◆ AddValue()

UE_FORCEINLINE_HINT int32 FScriptArrayHelper::AddValue ( )
inline

Add a blank, constructed values to the end of the array.

Returns
the index of the newly added item.

◆ AddValues()

int32 FScriptArrayHelper::AddValues ( int32  Count)
inline

Add blank, constructed values to the end of the array.

Parameters
Countthe number of items to insert.
Returns
the index of the first newly added item.

◆ ClearValues()

void FScriptArrayHelper::ClearValues ( int32  Index,
int32  Count = 1 
)
inline

Clear values in the array. The meaning of clear is defined by the property system.

Parameters
Indexfirst item to clear.
Countnumber of items to clear.

◆ CountBytes()

void FScriptArrayHelper::CountBytes ( FArchive Ar) const
inline

Used by memory counting archives to accumulate the size of this array.

Parameters
Ararchive to accumulate sizes

◆ CreateHelperFormInnerProperty()

static FScriptArrayHelper FScriptArrayHelper::CreateHelperFormInnerProperty ( const FProperty InInnerProperty,
const void InArray,
EArrayPropertyFlags  InArrayFlags = EArrayPropertyFlags::None 
)
inlinestatic

◆ DestroyContainer_Unsafe()

void FScriptArrayHelper::DestroyContainer_Unsafe ( )
inline

Destroys the container object - THERE SHOULD BE NO MORE USE OF THIS HELPER AFTER THIS FUNCTION IS CALLED!

◆ EmptyAndAddUninitializedValues()

void FScriptArrayHelper::EmptyAndAddUninitializedValues ( int32  Count)
inline

Empty the array, then add uninitialized values to a given size.

Parameters
Countthe number of items the array will have on completion.

◆ EmptyAndAddValues()

void FScriptArrayHelper::EmptyAndAddValues ( int32  Count)
inline

Empty the array, then add blank, constructed values to a given size.

Parameters
Countthe number of items the array will have on completion.

◆ EmptyValues()

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

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

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

◆ ExpandForIndex()

bool FScriptArrayHelper::ExpandForIndex ( int32  Index)
inline

Expand the array, if needed, so that the given index is valid

Parameters
Indexindex for the item that we want to ensure is valid
Returns
true if expansion was necessary NOTE: This is not a count, it is an INDEX, so the final count will be at least Index+1 this matches the usage.

◆ GetElementPtr()

UE_FORCEINLINE_HINT uint8 * FScriptArrayHelper::GetElementPtr ( int32  Index = 0)
inline

Returns a uint8 pointer to an element in the array. This call is identical to GetRawPtr and is here to provide interface parity with FScriptSetHelper*.

Parameters
Indexindex of the item to return a pointer to.
Returns
Pointer to this element, or NULL if the array is empty

◆ GetRawPtr()

uint8 * FScriptArrayHelper::GetRawPtr ( int32  Index = 0)
inline

Returns a uint8 pointer to an element in the array

Parameters
Indexindex of the item to return a pointer to.
Returns
Pointer to this element, or NULL if the array is empty

◆ InsertValues()

void FScriptArrayHelper::InsertValues ( int32  Index,
int32  Count = 1 
)
inline

Insert blank, constructed values into the array.

Parameters
Indexindex of the first inserted item after completion
Countthe number of items to insert.

◆ IsValidIndex()

UE_FORCEINLINE_HINT bool FScriptArrayHelper::IsValidIndex ( int32  Index) const
inline

Index range check

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

◆ MoveAssign()

void FScriptArrayHelper::MoveAssign ( void InOtherArray)
inline

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

Note
The arrays MUST be of the same type, and this function will NOT validate that!
Parameters
InOtherArrayThe array to move the allocation from.

◆ Num()

int32 FScriptArrayHelper::Num ( ) const
inline

Return the number of elements in the array.

Returns
The number of elements in the array.

◆ NumUnchecked()

int32 FScriptArrayHelper::NumUnchecked ( ) const
inline

Return the number of elements in the array without validating the state of the array. Needed to allow reading of the num when the array is 'invalid' during its intrusive unset state.

Returns
The number of elements in the array.

◆ RemoveValues()

void FScriptArrayHelper::RemoveValues ( int32  Index,
int32  Count = 1 
)
inline

Remove values from the array, calling destructors, etc as appropriate.

Parameters
Indexfirst item to remove.
Countnumber of items to remove.

◆ Resize()

void FScriptArrayHelper::Resize ( int32  Count)
inline

Add or remove elements to set the array to a given size.

Parameters
Countthe number of items the array will have on completion.

◆ SwapValues()

void FScriptArrayHelper::SwapValues ( int32  A,
int32  B 
)
inline

Swap two elements in the array, does not call constructors and destructors

Parameters
Aindex of one item to swap.
Bindex of the other item to swap.

Member Data Documentation

◆ FreezableArray

FFreezableScriptArray* FScriptArrayHelper::FreezableArray

◆ HeapArray

FScriptArray* FScriptArrayHelper::HeapArray

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