|
| template<typename ValueType , typename VariantValueType = std::remove_cv_t<std::remove_reference_t<ValueType>>> |
| VariantValueType & | AddVariant (ValueType &&Value) |
| |
| template<typename ValueType > |
| void | AddVariantArray (const TArray< ValueType > &Array) |
| |
| template<typename ValueType > |
| bool | GetVariant (ArrayType::SizeType Index, TSharedPtr< ValueType > &OutValue) const |
| |
| template<typename ValueType > |
| bool | GetVariant (ArrayType::SizeType Index, ValueType &OutValue) const |
| |
| template<typename ValueType > |
| bool | GetVariantArray (TArray< ValueType > &OutValue) const |
| |
| UE_FORCEINLINE_HINT constexpr | TArray () |
| |
| consteval | TArray (EConstEval) |
| |
| UE_FORCEINLINE_HINT | TArray (const ElementType *Ptr, SizeType Count) |
| |
| | TArray (const TArrayView< OtherElementType, OtherSizeType > &Other) |
| |
| | TArray (std::initializer_list< TVariant< ValueTypes... > > InitList) |
| |
| UE_FORCEINLINE_HINT | TArray (const TArray< OtherElementType, OtherAllocator > &Other) |
| |
| UE_FORCEINLINE_HINT | TArray (const TArray &Other) |
| |
| UE_FORCEINLINE_HINT | TArray (const TArray &Other, SizeType ExtraSlack) |
| |
| UE_FORCEINLINE_HINT | TArray (TArray &&Other) |
| |
| UE_FORCEINLINE_HINT | TArray (TArray< OtherElementType, OtherAllocator > &&Other) |
| |
| | TArray (TArray< OtherElementType, AllocatorType > &&Other, SizeType ExtraSlack) |
| |
| UE_NODEBUG | TArray (FIntrusiveUnsetOptionalState Tag) |
| |
| UE_FORCEINLINE_HINT | TArray (const TArrayView< OtherElementType, OtherSizeType > &Other) |
| |
| TArray & | operator= (std::initializer_list< TVariant< ValueTypes... > > InitList) |
| |
| TArray & | operator= (const TArray< ElementType, OtherAllocatorType > &Other) |
| |
| TArray & | operator= (const TArray &Other) |
| |
| TArray & | operator= (const TArrayView< OtherElementType, OtherSizeType > &Other) |
| |
| TArray & | operator= (TArray &&Other) |
| |
| TArray & | operator= (TArray< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, AllocatorType > &&Other) |
| |
| TArray & | operator= (const TArray< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherAllocator > &Other) |
| |
| TArray< TVariant< ValueTypes... >, InAllocatorType > & | operator= (const TArrayView< OtherElementType, OtherSizeType > &Other) |
| |
| | ~TArray () |
| |
| UE_NODEBUG bool | operator== (FIntrusiveUnsetOptionalState Tag) const |
| |
| UE_NODEBUG bool | operator== (const TArray &OtherArray) const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT ElementType * | GetData () UE_LIFETIMEBOUND |
| |
| UE_REWRITE const ElementType * | GetData () const UE_LIFETIMEBOUND |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SIZE_T | GetAllocatedSize (void) const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SizeType | GetSlack () const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | CheckInvariants () const |
| |
| UE_FORCEINLINE_HINT void | RangeCheck (SizeType Index) const |
| |
| UE_FORCEINLINE_HINT void | RangeCheck (SizeType Index, SizeType Count) const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT bool | IsValidIndex (SizeType Index) const |
| |
| UE_REWRITE bool | IsEmpty () const |
| |
| UE_REWRITE SizeType | Num () const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SIZE_T | NumBytes () const |
| |
| UE_REWRITE SizeType | Max () const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT ElementType & | operator[] (SizeType Index) UE_LIFETIMEBOUND |
| |
| UE_REWRITE const ElementType & | operator[] (SizeType Index) const UE_LIFETIMEBOUND |
| |
| ElementType | Pop (EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT ElementType | Pop (bool bAllowShrinking) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | Push (ElementType &&Item) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | Push (const ElementType &Item) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT ElementType & | Top () UE_LIFETIMEBOUND |
| |
| UE_REWRITE const ElementType & | Top () const UE_LIFETIMEBOUND |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT ElementType & | Last (SizeType IndexFromTheEnd=0) UE_LIFETIMEBOUND |
| |
| UE_REWRITE const ElementType & | Last (SizeType IndexFromTheEnd=0) const UE_LIFETIMEBOUND |
| |
| UE_FORCEINLINE_HINT void | Shrink () |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT bool | Find (const ElementType &Item, SizeType &Index) const |
| |
| SizeType | Find (const ElementType &Item) const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT bool | FindLast (const ElementType &Item, SizeType &Index) const |
| |
| SizeType | FindLast (const ElementType &Item) const |
| |
| SizeType | FindLastByPredicate (Predicate Pred, SizeType Count) const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SizeType | FindLastByPredicate (Predicate Pred) const |
| |
| SizeType | IndexOfByKey (const KeyType &Key) const |
| |
| SizeType | IndexOfByPredicate (Predicate Pred) const |
| |
| ElementType * | FindByKey (const KeyType &Key) |
| |
| UE_REWRITE const ElementType * | FindByKey (const KeyType &Key) const |
| |
| ElementType * | FindByPredicate (Predicate Pred) |
| |
| UE_REWRITE const ElementType * | FindByPredicate (Predicate Pred) const |
| |
| TArray< ElementType > | FilterByPredicate (Predicate Pred) const |
| |
| bool | Contains (const ComparisonType &Item) const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT bool | ContainsByPredicate (Predicate Pred) const |
| |
| UE_REWRITE bool | operator!= (const TArray &OtherArray) const |
| |
| void | BulkSerialize (FArchive &Ar, bool bForcePerElementSerialization=false) |
| |
| UE_NODEBUG void | CountBytes (FArchive &Ar) const |
| |
| UE_FORCEINLINE_HINT SizeType | AddUninitialized () |
| |
| UE_FORCEINLINE_HINT SizeType | AddUninitialized (SizeType Count) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | InsertUninitialized (SizeType Index) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | InsertUninitialized (SizeType Index, SizeType Count) |
| |
| void | InsertZeroed (SizeType Index) |
| |
| void | InsertZeroed (SizeType Index, SizeType Count) |
| |
| ElementType & | InsertZeroed_GetRef (SizeType Index) UE_LIFETIMEBOUND |
| |
| void | InsertDefaulted (SizeType Index) |
| |
| void | InsertDefaulted (SizeType Index, SizeType Count) |
| |
| ElementType & | InsertDefaulted_GetRef (SizeType Index) UE_LIFETIMEBOUND |
| |
| SizeType | Insert (std::initializer_list< ElementType > InitList, const SizeType InIndex) |
| |
| SizeType | Insert (const TArray< ElementType, OtherAllocator > &Items, const SizeType InIndex) |
| |
| SizeType | Insert (TArray< ElementType, OtherAllocator > &&Items, const SizeType InIndex) |
| |
| SizeType | Insert (const ElementType *Ptr, SizeType Count, SizeType Index) |
| |
| SizeType | Insert (ElementType &&Item, SizeType Index) |
| |
| SizeType | Insert (const ElementType &Item, SizeType Index) |
| |
| SizeType | Insert (const TArray< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherAllocator > &Items, const SizeType InIndex) |
| |
| SizeType | Insert (TArray< typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType, OtherAllocator > &&Items, const SizeType InIndex) |
| |
| UE_FORCEINLINE_HINT void | CheckAddress (const ElementType *Addr) const |
| |
| ElementType & | Insert_GetRef (ElementType &&Item, SizeType Index) UE_LIFETIMEBOUND |
| |
| ElementType & | Insert_GetRef (const ElementType &Item, SizeType Index) UE_LIFETIMEBOUND |
| |
| void | RemoveAt (SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_FORCEINLINE_HINT void | RemoveAt (SizeType Index, CountType Count, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_FORCEINLINE_HINT void | RemoveAt (SizeType Index, CountType Count, bool bAllowShrinking) |
| |
| UE_FORCEINLINE_HINT void | RemoveAtSwap (SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_FORCEINLINE_HINT void | RemoveAtSwap (SizeType Index, CountType Count, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | RemoveAtSwap (SizeType Index, CountType Count, bool bAllowShrinking) |
| |
| void | Reset (SizeType NewSize=0) |
| |
| void | Empty (SizeType Slack=0) |
| |
| void | SetNum (SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | SetNum (SizeType NewNum, bool bAllowShrinking) |
| |
| void | SetNumZeroed (SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | SetNumZeroed (SizeType NewNum, bool bAllowShrinking) |
| |
| void | SetNumUninitialized (SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | SetNumUninitialized (SizeType NewNum, bool bAllowShrinking) |
| |
| void | SetNumUnsafeInternal (SizeType NewNum) |
| |
| void | Append (const TArray< OtherElementType, OtherAllocatorType > &Source) |
| |
| void | Append (TArray< OtherElementType, OtherAllocator > &&Source) |
| |
| void | Append (RangeType &&Source) |
| |
| void | Append (const ElementType *Ptr, SizeType Count) |
| |
| UE_FORCEINLINE_HINT void | Append (std::initializer_list< ElementType > InitList) |
| |
| void | Append (const typename TContainerElementTypeCompatibility< ElementType >::CopyFromOtherType *Ptr, SizeType Count) |
| |
| UE_NODEBUG TArray & | operator+= (TArray &&Other) |
| |
| UE_NODEBUG TArray & | operator+= (const TArray &Other) |
| |
| UE_NODEBUG TArray & | operator+= (std::initializer_list< ElementType > InitList) |
| |
| UE_FORCEINLINE_HINT SizeType | Emplace (ArgsType &&... Args) |
| |
| UE_FORCEINLINE_HINT ElementType & | Emplace_GetRef (ArgsType &&... Args) UE_LIFETIMEBOUND |
| |
| UE_FORCEINLINE_HINT void | EmplaceAt (SizeType Index, ArgsType &&... Args) |
| |
| UE_FORCEINLINE_HINT ElementType & | EmplaceAt_GetRef (SizeType Index, ArgsType &&... Args) UE_LIFETIMEBOUND |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SizeType | Add (ElementType &&Item) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SizeType | Add (const ElementType &Item) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT ElementType & | Add_GetRef (ElementType &&Item) UE_LIFETIMEBOUND |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT ElementType & | Add_GetRef (const ElementType &Item) UE_LIFETIMEBOUND |
| |
| SizeType | AddZeroed () |
| |
| SizeType | AddZeroed (SizeType Count) |
| |
| ElementType & | AddZeroed_GetRef () UE_LIFETIMEBOUND |
| |
| SizeType | AddDefaulted () |
| |
| SizeType | AddDefaulted (SizeType Count) |
| |
| ElementType & | AddDefaulted_GetRef () UE_LIFETIMEBOUND |
| |
| | operator TArray< typename TContainerElementTypeCompatibility< AliasElementType >::ReinterpretType, AllocatorType > & () |
| |
| | operator const TArray< typename TContainerElementTypeCompatibility< AliasElementType >::ReinterpretType, AllocatorType > & () const |
| |
| UE_FORCEINLINE_HINT SizeType | AddUnique (ElementType &&Item) |
| |
| UE_FORCEINLINE_HINT SizeType | AddUnique (const ElementType &Item) |
| |
| UE_FORCEINLINE_HINT void | Reserve (SizeType Number) |
| |
| void | Init (const ElementType &Element, SizeType Number) |
| |
| SizeType | RemoveSingle (const ElementType &Item) |
| |
| SizeType | Remove (const ElementType &Item) |
| |
| SizeType | RemoveAll (const PREDICATE_CLASS &Predicate) |
| |
| SizeType | RemoveAllSwap (const PREDICATE_CLASS &Predicate, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SizeType | RemoveAllSwap (const PREDICATE_CLASS &Predicate, bool bAllowShrinking) |
| |
| SizeType | RemoveSingleSwap (const ElementType &Item, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SizeType | RemoveSingleSwap (const ElementType &Item, bool bAllowShrinking) |
| |
| SizeType | RemoveSwap (const ElementType &Item, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT SizeType | RemoveSwap (const ElementType &Item, bool bAllowShrinking) |
| |
| UE_FORCEINLINE_HINT void | SwapMemory (SizeType FirstIndexToSwap, SizeType SecondIndexToSwap) |
| |
| UE_FORCEINLINE_HINT void | Swap (SizeType FirstIndexToSwap, SizeType SecondIndexToSwap) |
| |
| bool | FindItemByClass (SearchType **Item=nullptr, SizeType *ItemIndex=nullptr, SizeType StartIndex=0) const |
| |
| UE_NODEBUG TIterator | CreateIterator () |
| |
| UE_NODEBUG TConstIterator | CreateConstIterator () const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForIteratorType | begin () |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForConstIteratorType | begin () const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForIteratorType | end () |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForConstIteratorType | end () const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForReverseIteratorType | rbegin () |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForConstReverseIteratorType | rbegin () const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForReverseIteratorType | rend () |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT RangedForConstReverseIteratorType | rend () const |
| |
| UE_NODEBUG void | Sort () |
| |
| UE_NODEBUG void | Sort (const PREDICATE_CLASS &Predicate) |
| |
| UE_NODEBUG void | StableSort () |
| |
| UE_NODEBUG void | StableSort (const PREDICATE_CLASS &Predicate) |
| |
| void | WriteMemoryImage (FMemoryImageWriter &Writer) const |
| |
| void | CopyUnfrozen (const FMemoryUnfreezeContent &Context, void *Dst) const |
| |
| void | ToString (const FPlatformTypeLayoutParameters &LayoutParams, FMemoryToStringContext &OutContext) const |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | Heapify (const PREDICATE_CLASS &Predicate) |
| |
| UE_NODEBUG void | Heapify () |
| |
| SizeType | HeapPush (ElementType &&InItem, const PREDICATE_CLASS &Predicate) |
| |
| SizeType | HeapPush (const ElementType &InItem, const PREDICATE_CLASS &Predicate) |
| |
| UE_NODEBUG SizeType | HeapPush (ElementType &&InItem) |
| |
| UE_NODEBUG SizeType | HeapPush (const ElementType &InItem) |
| |
| void | HeapPop (ElementType &OutItem, const PREDICATE_CLASS &Predicate, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | HeapPop (ElementType &OutItem, const PREDICATE_CLASS &Predicate, bool bAllowShrinking) |
| |
| UE_NODEBUG void | HeapPop (ElementType &OutItem, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | HeapPop (ElementType &OutItem, bool bAllowShrinking) |
| |
| UE_NODEBUG void | VerifyHeap (const PREDICATE_CLASS &Predicate) |
| |
| void | HeapPopDiscard (const PREDICATE_CLASS &Predicate, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | HeapPopDiscard (const PREDICATE_CLASS &Predicate, bool bAllowShrinking) |
| |
| UE_NODEBUG void | HeapPopDiscard (EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | HeapPopDiscard (bool bAllowShrinking) |
| |
| UE_NODEBUG const ElementType & | HeapTop () const UE_LIFETIMEBOUND |
| |
| UE_NODEBUG ElementType & | HeapTop () UE_LIFETIMEBOUND |
| |
| void | HeapRemoveAt (SizeType Index, const PREDICATE_CLASS &Predicate, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG void | HeapRemoveAt (SizeType Index, const PREDICATE_CLASS &Predicate, bool bAllowShrinking) |
| |
| UE_NODEBUG void | HeapRemoveAt (SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >()) |
| |
| UE_NODEBUG UE_FORCEINLINE_HINT void | HeapRemoveAt (SizeType Index, bool bAllowShrinking) |
| |
| UE_NODEBUG void | HeapSort (const PREDICATE_CLASS &Predicate) |
| |
| UE_NODEBUG void | HeapSort () |
| |
| UE_NODEBUG const ElementAllocatorType & | GetAllocatorInstance () const |
| |
| UE_NODEBUG ElementAllocatorType & | GetAllocatorInstance () |
| |
| TSharedRef< TVariantArray< ValueTypes... >, Mode > | AsShared () |
| |
| TSharedRef< TVariantArray< ValueTypes... > const, Mode > | AsShared () const |
| |
| TSharedRef< SubobjectType, Mode > | AsSharedSubobject (SubobjectType *SubobjectPtr) const |
| |
| TWeakPtr< TVariantArray< ValueTypes... >, Mode > | AsWeak () |
| |
| TWeakPtr< TVariantArray< ValueTypes... > const, Mode > | AsWeak () const |
| |
| TWeakPtr< SubobjectType, Mode > | AsWeakSubobject (SubobjectType *SubobjectPtr) const |
| |
| void | UpdateWeakReferenceInternal (TSharedPtr< SharedPtrType, SharedPtrMode > const *InSharedPtr, OtherType *InObject) const |
| |
| void | UpdateWeakReferenceInternal (TSharedRef< SharedRefType, SharedPtrMode > const *InSharedRef, OtherType *InObject) const |
| |
| UE_FORCEINLINE_HINT bool | DoesSharedInstanceExist () const |
| |
template<typename... ValueTypes>
class TVariantArray< ValueTypes >
This set of classes enables building nested TVariant structures using shared pointers to TArrays and TMaps. This can be extended to other core container types or custom types as needed. If this proves useful beyond online use cases, this could move to Core.
This allows for usage such as:
using FNestedVariant = TNestedVariant<FString, bool, int64, double, FString>; // The first FString is the TMap key type. FNestedVariant::FMapRef Data = FNestedVariant::FMap::CreateVariant();
Data->AddVariant(TEXT("MyString"), FString(TEXT("1234-5678-9000"))); Data->AddVariant(TEXT("MyInt"), 42LL); Data->AddVariant(TEXT("MyObject"), FNestedVariant::FMap::CreateVariant())->AddVariant(TEXT("MyNestedObjectDouble"), 1.0); FNestedVariant::FArrayRef& Array = Data->AddVariant(TEXT("MyArray"), FNestedVariant::FArray::CreateVariant());
Array->AddVariant(FNestedVariant::FMap::CreateVariant())->AddVariant(TEXT("MyNestedArrayObjectInt"), 100LL); Array->AddVariant(FNestedVariant::FArray::CreateVariant())->AddVariant(1.23); Array->AddVariant(4.0); Array->AddVariant(true);
FNestedVariant::FMapPtr NestedMap; if (Array->GetVariant(0, NestedMap)) { // Found nested map in array. }
double ArrayDouble; if (Array->GetVariant(2, ArrayDouble)) { ... }
int64 MyInt; if (Data->GetVariant(TEXT("MyInt"), MyInt)) { ... }
FNestedVariant::FArrayPtr NestedArray; if (Data->GetVariant(TEXT("MyArray"), NestedArray)) { bool Value; if (NestedArray->GetVariant(3, Value)) { ... } }
OnlineUtils.h has ToLogString() overrides to allow for: ToLogString(Data); Which would output: {MyString:1234-5678-9000, MyInt:42, MyObject:{MyNestedObjectDouble:1.00}, MyArray:[{MyNestedArrayObjectInt:100}, [1.23], 4.00, true]} TArray that holds a TVariant with helper functions for working with variant types.