UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UnrealType.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 UnrealType.h: Unreal engine base type definitions.
5=============================================================================*/
6
7#pragma once
8
11#include "Containers/Array.h"
16#include "Containers/List.h"
17#include "Containers/Map.h"
19#include "Containers/Set.h"
22#include "CoreGlobals.h"
23#include "HAL/MemoryBase.h"
24#include "HAL/UnrealMemory.h"
25#include "Logging/LogCategory.h"
26#include "Logging/LogMacros.h"
28#include "Misc/EnumClassFlags.h"
29#include "Misc/NotNull.h"
30#include "Misc/Optional.h"
35#include "Templates/Casts.h"
36#include "Templates/IsPODType.h"
38#include "Templates/MemoryOps.h"
39#include "Templates/Models.h"
41#include "Templates/Tuple.h"
45#include "UObject/Class.h"
46#include "UObject/Field.h"
48#include "UObject/NameTypes.h"
49#include "UObject/Object.h"
51#include "UObject/ObjectPtr.h"
54#include "UObject/PropertyTag.h"
61#include "UObject/UnrealNames.h"
63#include <type_traits>
64
65#define UE_API COREUOBJECT_API
66
67class FBlake3;
68class FOutputDevice;
69class UPackageMap;
71enum ELifetimeCondition : int;
72struct CGetTypeHashable;
74class FProperty;
76template <typename FuncType> class TFunctionRef;
77namespace UE { class FPropertyTypeName; }
78namespace UE { class FPropertyTypeNameBuilder; }
79namespace UE::GC
80{
81 class FPropertyStack;
82 class FSchemaBuilder;
83}
86
88
90{
92 {
93 LogWarning = 0,
94 LogError = 1,
96 };
97
99}
100
101/*-----------------------------------------------------------------------------
102 FProperty.
103-----------------------------------------------------------------------------*/
104
106{
108 CPPF_None = 0x00000000,
110 CPPF_OptionalValue = 0x00000001,
118 CPPF_NoConst = 0x00000010,
120 CPPF_NoRef = 0x00000020,
122 CPPF_NoStaticArray = 0x00000040,
126 CPPF_NoTObjectPtr = 0x00000100,
127};
128
140
142{
143 // Direct memory access - the associated pointer points to the memory at the reflected item.
144 Direct,
145
146 // Container access - the associated pointer points to the outer of the reflected item.
147 // Access via containers will use getter and setters, if present.
149};
150
152
153
156{
157 Direct = 0,
158 Container = 1,
159};
160
162{
163 // Defined in EnumProperty.cpp and used by both FEnumProperty and FByteProperty.
164 // They don't have an API macro because they're not intended to be called outside of CoreUObject.
166
167 void ExportEnumToBuffer(const UEnum* Enum, const FProperty* Prop, const FNumericProperty* NumericProp, FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope);
168}
169
170//
171// An UnrealScript variable.
172//
173class FProperty : public FField
174{
176
177 // Persistent variables.
178 int32 ArrayDim;
179 UE_DEPRECATED(5.5, "Use GetElementSize/SetElementSize instead.")
180 int32 ElementSize;
181public:
184
185private:
186 TEnumAsByte<ELifetimeCondition> BlueprintReplicationCondition;
187
188#if WITH_EDITORONLY_DATA || WITH_METADATA
189 union
190 {
191#if WITH_EDITORONLY_DATA
193 int32 IndexInOwner = -1;
194#endif
195#if WITH_METADATA && UE_WITH_CONSTINIT_UOBJECT
201#endif
202 };
203#endif // WITH_EDITORONLY_DATA || WITH_METADATA
204
205 // In memory variables (generated during Link()).
206 // When UE_WITH_CONSTINIT_UOBJECT is set, this is set at compile time for compiled-in objects.
207 int32 Offset_Internal;
208
209public:
212
213 union
214 {
216 FProperty* NextRef = nullptr;
217#if WITH_METADATA && UE_WITH_CONSTINIT_UOBJECT
222 const UE::CodeGen::ConstInit::FMetaData* MetaDataParams;
223#endif
224 };
225 union
226 {
229#if UE_WITH_CONSTINIT_UOBJECT
235#endif
236 };
239
241
242public:
243 // Constructors.
245
251 COREUOBJECT_API FProperty(FFieldVariant InOwner, const UECodeGen_Private::FPropertyParamsBaseWithOffset& Prop, EPropertyFlags AdditionalPropertyFlags = CPF_None);
252
258 COREUOBJECT_API FProperty(FFieldVariant InOwner, const UECodeGen_Private::FPropertyParamsBaseWithoutOffset& Prop, EPropertyFlags AdditionalPropertyFlags = CPF_None);
259
260#if UE_WITH_CONSTINIT_UOBJECT
262 explicit consteval FProperty(UE::CodeGen::ConstInit::FPropertyParams InParams)
263 : Super(ConstEval, InParams.FieldClass, InParams.Owner, InParams.NextProperty, InParams.ObjectFlags, InParams.NameUTF8)
264 , ArrayDim(InParams.ArrayDim)
265 , ElementSize(InParams.ElementSize)
267 , RepIndex(0)
268 , BlueprintReplicationCondition()
271#endif
272 , Offset_Internal(InParams.Offset)
273 , PropertyLinkNext(nullptr)
276#endif
278 {
279 }
283#endif
284
285#if WITH_EDITORONLY_DATA
287#endif // WITH_EDITORONLY_DATA
288
289 // ElementSize accessors to facilitate underlying type change
297
298 // UObject interface
299 COREUOBJECT_API virtual void Serialize( FArchive& Ar ) override;
300 // End of UObject interface
301
302 // FField interface
303 COREUOBJECT_API virtual void PostDuplicate(const FField& InField) override;
304
316 static COREUOBJECT_API const TCHAR* ImportSingleProperty( const TCHAR* Str, void* DestData, const UStruct* ObjectStruct, UObject* SubobjectOuter, int32 PortFlags,
318
321
328 COREUOBJECT_API FString GetNameCPP() const;
329
330 // UHT interface
331 COREUOBJECT_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const;
332
339 virtual FString GetCPPType( FString* ExtendedTypeText=NULL, uint32 CPPExportFlags=0 ) const PURE_VIRTUAL(FProperty::GetCPPType,return TEXT(""););
340 // End of UHT interface
341
342#if WITH_EDITORONLY_DATA
345#endif
346
348 virtual bool HasSetter() const
349 {
350 return false;
351 }
353 virtual bool HasGetter() const
354 {
355 return false;
356 }
358 virtual bool HasSetterOrGetter() const
359 {
360 return false;
361 }
367 virtual void CallSetter(void* Container, const void* InValue) const
368 {
369 checkf(HasSetter(), TEXT("Calling a setter on %s but it doesn't have one"), *GetFullName());
370 }
376 virtual void CallGetter(const void* Container, void* OutValue) const
377 {
378 checkf(HasGetter(), TEXT("Calling a getter on %s but it doesn't have one"), *GetFullName());
379 }
380
381 UE_DEPRECATED(5.7, "Visit is deprecated, please use Visit with context instead.")
383
393
403
409
410private:
414 COREUOBJECT_API int32 SetupOffset();
415
419
422
426 COREUOBJECT_API void Init();
427
428public:
429#if WITH_EDITORONLY_DATA
432 {
433 return IndexInOwner;
434 }
435
438 {
440 }
441#endif
442
445 {
446 return Offset_Internal;
447 }
450 {
451 return Offset_Internal;
452 }
455 {
456 return Offset_Internal;
457 }
460 {
461 return Offset_Internal;
462 }
465 {
466 return Offset_Internal;
467 }
468
470 {
471 LinkInternal(Ar);
472 }
473
475 {
476 LinkInternal(Ar);
477 return SetupOffset();
478 }
479
480#if WITH_METADATA
482 void InitializeMetaData();
483#endif
484
485protected:
486 COREUOBJECT_API virtual void LinkInternal(FArchive& Ar);
487public:
488
505
515 virtual bool Identical( const void* A, const void* B, uint32 PortFlags=0 ) const PURE_VIRTUAL(FProperty::Identical,return false;);
516
526 bool Identical_InContainer( const void* A, const void* B, int32 ArrayIndex = 0, uint32 PortFlags=0 ) const
527 {
528 return Identical( ContainerPtrToValuePtr<void>(A, ArrayIndex), B ? ContainerPtrToValuePtr<void>(B, ArrayIndex) : NULL, PortFlags );
529 }
530
538 void SerializeBinProperty( FStructuredArchive::FSlot Slot, void* Data, int32 ArrayIdx = -1 )
539 {
542 {
543 const int32 LoopMin = ArrayIdx < 0 ? 0 : ArrayIdx;
544 const int32 LoopMax = ArrayIdx < 0 ? ArrayDim : ArrayIdx + 1;
545 for (int32 Idx = LoopMin; Idx < LoopMax; Idx++)
546 {
547 // Keep setting the property in case something inside of SerializeItem changes it
548 FSerializedPropertyScope SerializedProperty(Slot.GetUnderlyingArchive(), this);
549 SerializeItem(Stream.EnterElement(), ContainerPtrToValuePtr<void>(Data, Idx));
550 }
551 }
552 }
561 void SerializeNonMatchingBinProperty( FStructuredArchive::FSlot Slot, void* Data, void const* DefaultData, UStruct* DefaultStruct)
562 {
563 FArchive& UnderlyingArchive = Slot.GetUnderlyingArchive();
565
566 if( ShouldSerializeValue(UnderlyingArchive) )
567 {
568 for (int32 Idx = 0; Idx < ArrayDim; Idx++)
569 {
570 void* Target = ContainerPtrToValuePtr<void>(Data, Idx);
571 void const* Default = ContainerPtrToValuePtrForDefaults<void>(DefaultStruct, DefaultData, Idx);
572 if ( !Identical(Target, Default, UnderlyingArchive.GetPortFlags()) )
573 {
574 FSerializedPropertyScope SerializedProperty(UnderlyingArchive, this);
575 SerializeItem( Stream.EnterElement(), Target, Default );
576 }
577 }
578 }
579 }
580
581 virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults = NULL) const PURE_VIRTUAL(FProperty::SerializeItem, );
584
585 void ExportTextItem_Direct(FString& ValueStr, const void* PropertyValue, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope = nullptr) const
586 {
587 ExportText_Internal(ValueStr, PropertyValue, EPropertyPointerType::Direct, DefaultValue, Parent, PortFlags, ExportRootScope);
588 }
589
590 void ExportTextItem_InContainer(FString& ValueStr, const void* Container, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope = nullptr) const
591 {
592 ExportText_Internal(ValueStr, Container, EPropertyPointerType::Container, DefaultValue, Parent, PortFlags, ExportRootScope);
593 }
594
605 {
606 if (!ValidateImportFlags(PortFlags, ErrorText) || Buffer == nullptr)
607 {
608 return nullptr;
609 }
610 PortFlags |= EPropertyPortFlags::PPF_UseDeprecatedProperties; // Imports should always process deprecated properties
612 }
613
623 const TCHAR* ImportText_Direct(const TCHAR* Buffer, void* PropertyPtr, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText = (FOutputDevice*)GWarn) const
624 {
625 if (!ValidateImportFlags(PortFlags, ErrorText) || Buffer == NULL)
626 {
627 return NULL;
628 }
629 PortFlags |= EPropertyPortFlags::PPF_UseDeprecatedProperties; // Imports should always process deprecated properties
631 }
632
633 inline void SetValue_InContainer(void* OutContainer, const void* InValue) const
634 {
635 if (!HasSetter())
636 {
637 CopyCompleteValue(ContainerVoidPtrToValuePtrInternal(OutContainer, 0), InValue);
638 }
639 else
640 {
642 }
643 }
644 inline void GetValue_InContainer(void const* InContainer, void* OutValue) const
645 {
646 if (!HasGetter())
647 {
648 CopyCompleteValue(OutValue, ContainerVoidPtrToValuePtrInternal((void*)InContainer, 0));
649 }
650 else
651 {
653 }
654 }
655
662 COREUOBJECT_API void SetSingleValue_InContainer(void* OutContainer, const void* InValue, int32 ArrayIndex) const;
663
670 COREUOBJECT_API void GetSingleValue_InContainer(const void* InContainer, void* OutValue, int32 ArrayIndex) const;
671
674
677
685
693
701
702#if WITH_EDITORONLY_DATA
714 COREUOBJECT_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const;
715#endif
716protected:
717
718 virtual void ExportText_Internal(FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope = nullptr) const PURE_VIRTUAL(FProperty::ExportText, );
719 virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const PURE_VIRTUAL(FProperty::ImportText, return nullptr;);
720
721public:
722
723 COREUOBJECT_API bool ExportText_Direct(FString& ValueStr, const void* Data, const void* Delta, UObject* Parent, int32 PortFlags, UObject* ExportRootScope = nullptr) const;
724 UE_FORCEINLINE_HINT bool ExportText_InContainer(int32 Index, FString& ValueStr, const void* Data, const void* Delta, UObject* Parent, int32 PortFlags, UObject* ExportRootScope = nullptr) const
725 {
727 }
728
729private:
730
731 inline void* ContainerVoidPtrToValuePtrInternal(void* ContainerPtr, int32 ArrayIndex) const
732 {
733 checkf((ArrayIndex >= 0) && (ArrayIndex < ArrayDim), TEXT("Array index out of bounds: %i from an array of size %i"), ArrayIndex, ArrayDim);
734 check(ContainerPtr);
735
736 if (0)
737 {
738 // in the future, these checks will be tested if the property is NOT relative to a UClass
739 check(!GetOwner<UClass>()); // Check we are _not_ calling this on a direct child property of a UClass, you should pass in a UObject* in that case
740 }
741
742 return (uint8*)ContainerPtr + Offset_Internal + static_cast<size_t>(GetElementSize()) * ArrayIndex;
743 }
744
745 inline void* ContainerUObjectPtrToValuePtrInternal(UObject* ContainerPtr, int32 ArrayIndex) const
746 {
747 checkf((ArrayIndex >= 0) && (ArrayIndex < ArrayDim), TEXT("Array index out of bounds: %i from an array of size %i"), ArrayIndex, ArrayDim);
748 check(ContainerPtr);
749
750 // in the future, these checks will be tested if the property is supposed be from a UClass
751 // need something for networking, since those are NOT live uobjects, just memory blocks
752 check(((UObject*)ContainerPtr)->IsValidLowLevel()); // Check its a valid UObject that was passed in
753 check(((UObject*)ContainerPtr)->GetClass() != NULL);
754 check(GetOwner<UClass>()); // Check that the outer of this property is a UClass (not another property)
755
756 // Check that the object we are accessing is of the class that contains this property
757 checkf(((UObject*)ContainerPtr)->IsA(GetOwner<UClass>()), TEXT("'%s' is of class '%s' however property '%s' belongs to class '%s'")
758 , *((UObject*)ContainerPtr)->GetName()
759 , *((UObject*)ContainerPtr)->GetClass()->GetName()
760 , *GetName()
761 , *GetOwner<UClass>()->GetName());
762
763 if (0)
764 {
765 // in the future, these checks will be tested if the property is NOT relative to a UClass
766 check(!GetOwner<UClass>()); // Check we are _not_ calling this on a direct child property of a UClass, you should pass in a UObject* in that case
767 }
768
769 return (uint8*)ContainerPtr + Offset_Internal + static_cast<size_t>(GetElementSize()) * ArrayIndex;
770 }
771
772protected:
773
775 friend void UE::CoreUObject::Private::ExportEnumToBuffer(const UEnum* Enum, const FProperty* Prop, const FNumericProperty* NumericProp, FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope);
776
778 {
780 {
781 return (uint8*)ContainerOrPropertyPtr + Offset_Internal + static_cast<size_t>(GetElementSize()) * ArrayIndex;
782 }
783 else
784 {
785 return (void*)ContainerOrPropertyPtr;
786 }
787 }
788
789public:
790
798 template<typename ValueType>
799 UE_FORCEINLINE_HINT ValueType* ContainerPtrToValuePtr(UObject* ContainerPtr, int32 ArrayIndex = 0) const
800 {
801 return (ValueType*)ContainerUObjectPtrToValuePtrInternal(ContainerPtr, ArrayIndex);
802 }
803 template<typename ValueType>
804 UE_FORCEINLINE_HINT ValueType* ContainerPtrToValuePtr(void* ContainerPtr, int32 ArrayIndex = 0) const
805 {
806 return (ValueType*)ContainerVoidPtrToValuePtrInternal(ContainerPtr, ArrayIndex);
807 }
808 template<typename ValueType>
809 UE_FORCEINLINE_HINT ValueType const* ContainerPtrToValuePtr(UObject const* ContainerPtr, int32 ArrayIndex = 0) const
810 {
811 return ContainerPtrToValuePtr<ValueType>((UObject*)ContainerPtr, ArrayIndex);
812 }
813 template<typename ValueType>
814 UE_FORCEINLINE_HINT ValueType const* ContainerPtrToValuePtr(void const* ContainerPtr, int32 ArrayIndex = 0) const
815 {
816 return ContainerPtrToValuePtr<ValueType>((void*)ContainerPtr, ArrayIndex);
817 }
818
819 // Default variants, these accept and return nullptr, and also check the property against the size of the container.
820 // If we copy from a baseclass (like for a CDO), then this will give nullptr for any property that doesn't belong to the baseclass.
821 template<typename ValueType>
822 inline ValueType* ContainerPtrToValuePtrForDefaults(const UStruct* ContainerClass, UObject* ContainerPtr, int32 ArrayIndex = 0) const
823 {
824 if (ContainerPtr && IsInContainer(ContainerClass))
825 {
826 return ContainerPtrToValuePtr<ValueType>(ContainerPtr, ArrayIndex);
827 }
828 return nullptr;
829 }
830 template<typename ValueType>
831 inline ValueType* ContainerPtrToValuePtrForDefaults(const UStruct* ContainerClass, void* ContainerPtr, int32 ArrayIndex = 0) const
832 {
833 if (ContainerPtr && IsInContainer(ContainerClass))
834 {
835 return ContainerPtrToValuePtr<ValueType>(ContainerPtr, ArrayIndex);
836 }
837 return nullptr;
838 }
839 template<typename ValueType>
840 inline const ValueType* ContainerPtrToValuePtrForDefaults(const UStruct* ContainerClass, const UObject* ContainerPtr, int32 ArrayIndex = 0) const
841 {
842 if (ContainerPtr && IsInContainer(ContainerClass))
843 {
844 return ContainerPtrToValuePtr<ValueType>(ContainerPtr, ArrayIndex);
845 }
846 return nullptr;
847 }
848 template<typename ValueType>
849 inline const ValueType* ContainerPtrToValuePtrForDefaults(const UStruct* ContainerClass, const void* ContainerPtr, int32 ArrayIndex = 0) const
850 {
851 if (ContainerPtr && IsInContainer(ContainerClass))
852 {
853 return ContainerPtrToValuePtr<ValueType>(ContainerPtr, ArrayIndex);
854 }
855 return nullptr;
856 }
859 {
860 return Offset_Internal + GetSize() <= ContainerSize;
861 }
864 {
865 return Offset_Internal + GetSize() <= (ContainerClass ? ContainerClass->GetPropertiesSize() : MAX_int32);
866 }
867
879 inline void CopySingleValue( void* Dest, void const* Src ) const
880 {
881 if(Dest != Src)
882 {
884 {
885 FMemory::Memcpy( Dest, Src, GetElementSize() );
886 }
887 else
888 {
889 CopyValuesInternal(Dest, Src, 1);
890 }
891 }
892 }
893
897 COREUOBJECT_API uint32 GetValueTypeHash(const void* Src) const;
898
899protected:
900 COREUOBJECT_API virtual void CopyValuesInternal( void* Dest, void const* Src, int32 Count ) const;
901 COREUOBJECT_API virtual uint32 GetValueTypeHashInternal(const void* Src) const;
902
903public:
913 inline void CopyCompleteValue( void* Dest, void const* Src ) const
914 {
915 if(Dest != Src)
916 {
918 {
919 FMemory::Memcpy( Dest, Src, static_cast<size_t>(GetElementSize()) * ArrayDim );
920 }
921 else
922 {
923 CopyValuesInternal(Dest, Src, ArrayDim);
924 }
925 }
926 }
927 UE_FORCEINLINE_HINT void CopyCompleteValue_InContainer( void* Dest, void const* Src ) const
928 {
930 }
931
942 COREUOBJECT_API virtual void CopySingleValueToScriptVM( void* Dest, void const* Src ) const;
943
952 COREUOBJECT_API virtual void CopyCompleteValueToScriptVM( void* Dest, void const* Src ) const;
953
957 COREUOBJECT_API virtual void CopyCompleteValueToScriptVM_InContainer( void* OutValue, void const* InContainer ) const;
958 COREUOBJECT_API virtual void CopyCompleteValueFromScriptVM_InContainer( void* OutContainer, void const* InValue ) const;
959
970 COREUOBJECT_API virtual void CopySingleValueFromScriptVM( void* Dest, void const* Src ) const;
971
980 COREUOBJECT_API virtual void CopyCompleteValueFromScriptVM( void* Dest, void const* Src ) const;
981
988 inline void ClearValue( void* Data ) const
989 {
991 {
993 }
994 else
995 {
997 }
998 }
1005 inline void ClearValue_InContainer( void* Data, int32 ArrayIndex = 0 ) const
1006 {
1008 {
1010 }
1011 else
1012 {
1014 }
1015 }
1016protected:
1017 COREUOBJECT_API virtual void ClearValueInternal( void* Data ) const;
1018public:
1025 inline void DestroyValue( void* Dest ) const
1026 {
1028 {
1030 }
1031 }
1038 inline void DestroyValue_InContainer( void* Dest ) const
1039 {
1041 {
1043 }
1044 }
1045
1046protected:
1047 COREUOBJECT_API virtual void DestroyValueInternal( void* Dest ) const;
1048public:
1049
1054 {
1055 // Skip if the property does not need any destroying.
1057 {
1058 return false;
1059 }
1061 }
1062
1070 void FinishDestroy( void* Data ) const
1071 {
1072 // Skip if the property does not need any destroying.
1074 {
1075 return;
1076 }
1078 }
1079
1087 void FinishDestroy_InContainer( void* Data ) const
1088 {
1089 // Skip if the property does not need any destroying.
1091 {
1092 return;
1093 }
1095 }
1096protected:
1098 COREUOBJECT_API virtual void FinishDestroyInternal( void* Data ) const;
1099public:
1100
1108 inline void InitializeValue( void* Dest ) const
1109 {
1111 {
1112 FMemory::Memzero(Dest, static_cast<size_t>(GetElementSize()) * ArrayDim);
1113 }
1114 else
1115 {
1117 }
1118 }
1126 inline void InitializeValue_InContainer( void* Dest ) const
1127 {
1129 {
1130 FMemory::Memzero(ContainerPtrToValuePtr<void>(Dest), static_cast<size_t>(GetElementSize()) * ArrayDim);
1131 }
1132 else
1133 {
1135 }
1136 }
1137protected:
1138 COREUOBJECT_API virtual void InitializeValueInternal( void* Dest ) const;
1139public:
1140
1149 COREUOBJECT_API bool ValidateImportFlags( uint32 PortFlags, FOutputDevice* ErrorText = NULL ) const;
1150 COREUOBJECT_API bool ShouldPort( uint32 PortFlags=0 ) const;
1151 COREUOBJECT_API virtual FName GetID() const;
1152
1161 COREUOBJECT_API virtual void InstanceSubobjects( void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph );
1162
1163 COREUOBJECT_API virtual int32 GetMinAlignment() const;
1164
1174
1186
1197
1203
1204 // @TODO: Surely this can have an int32 overflow. This should probably return size_t. Just
1205 // need to audit all callers to make such a change.
1207 {
1208 return ArrayDim * GetElementSize();
1209 }
1211
1212 COREUOBJECT_API virtual bool UseBinaryOrNativeSerialization(const FArchive& Ar) const;
1213
1220 {
1221 return ShouldPort() && GetOwnerClass() != UObject::StaticClass();
1222 }
1223
1229 COREUOBJECT_API virtual bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag* Tag = nullptr);
1230
1235
1240
1245 {
1246 FProperty* Result = this;
1248 {
1249 Result = PropBase;
1250 }
1251 return Result;
1252 }
1253
1255 {
1256 const FProperty* Result = this;
1258 {
1259 Result = PropBase;
1260 }
1261 return Result;
1262 }
1263
1301
1307 {
1308 return (!GIsEditor && ((PropertyFlags & CPF_Net) != 0)) ? this : NULL;
1309 }
1310
1319 {
1320 return (PropertyFlags & CPF_DevelopmentAssets) != 0;
1321 }
1322
1324 COREUOBJECT_API virtual bool SameType(const FProperty* Other) const;
1325
1326 ELifetimeCondition GetBlueprintReplicationCondition() const { return BlueprintReplicationCondition; }
1328
1336
1343
1352 COREUOBJECT_API virtual bool IsIntrusiveOptionalValueSet(const void* Data) const;
1353
1361
1367 COREUOBJECT_API virtual void EmitIntrusiveOptionalReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath);
1368};
1369
1370
1372{
1373public:
1374 static COREUOBJECT_API const TCHAR* ReadToken( const TCHAR* Buffer, FString& Out, bool DottedNames = false);
1375
1376 // @param Out Appended to
1377 static COREUOBJECT_API const TCHAR* ReadToken( const TCHAR* Buffer, FStringBuilderBase& Out, bool DottedNames = false);
1378};
1379
1380namespace UEProperty_Private
1381{
1384 {
1385 public:
1395 {
1396 Property.SetOffset_Internal(OffsetOverride);
1397 }
1398 };
1399}
1400
1403{
1406 bool operator== (const FDefinedProperty& Other) const
1407 {
1408 return (Property == Other.Property && Index == Other.Index);
1409 }
1410};
1411
1416{
1417public:
1420 : Obj(FMemory::Malloc(InProp->GetSize(), InProp->GetMinAlignment()), [InProp](void* Object)
1421 {
1422 InProp->DestroyValue(Object);
1424 })
1425 {
1426 InProp->InitializeValue(Obj.Get());
1427 }
1428
1429 void* GetObjAddress() const
1430 {
1431 return Obj.Get();
1432 }
1433
1434private:
1435 TSharedPtr<void> Obj;
1436};
1437
1438
1439/*-----------------------------------------------------------------------------
1440 TProperty.
1441-----------------------------------------------------------------------------*/
1442
1443
1444template<typename InTCppType>
1446{
1447public:
1450 enum
1451 {
1452 CPPSize = sizeof(TCppType),
1453 CPPAlignment = alignof(TCppType)
1455
1457 {
1459 }
1460
1463 {
1464 return (TCppType const*)A;
1465 }
1468 {
1469 return (TCppType*)A;
1470 }
1473 {
1474 return *GetPropertyValuePtr(A);
1475 }
1478 {
1479 return TCppType();
1480 }
1483 {
1484 return B ? GetPropertyValue(B) : GetDefaultPropertyValue();
1485 }
1488 {
1489 *GetPropertyValuePtr(A) = Value;
1490 }
1493 {
1494 return new (A) TCppType();
1495 }
1498 {
1499 GetPropertyValuePtr(A)->~TCppType();
1500 }
1501
1503 {
1504 return ::HasIntrusiveUnsetOptionalState<TCppType>();
1505 }
1506
1508 {
1509 new(Data) TOptional<TCppType>();
1510 }
1511
1513 {
1514 return reinterpret_cast<const TOptional<TCppType>*>(A)->IsSet();
1515 }
1516
1518 {
1519 reinterpret_cast<TOptional<TCppType>*>(A)->Reset();
1520 }
1521
1522protected:
1533};
1534
1535
1536template<typename InTCppType, class TInPropertyBaseClass>
1537class TProperty : public TInPropertyBaseClass, public TPropertyTypeFundamentals<InTCppType>
1538{
1539public:
1540
1542 typedef TInPropertyBaseClass Super;
1544
1549
1551 : Super(InOwner, InName, InObjectFlags)
1552 {
1553 this->SetElementSize(TTypeFundamentals::CPPSize);
1554 }
1555
1561 template <typename PropertyParamsType>
1563 : Super(InOwner, Prop, TTypeFundamentals::GetComputedFlagsPropertyFlags())
1564 {
1565 this->SetElementSize(TTypeFundamentals::CPPSize);
1566 }
1567
1568#if UE_WITH_CONSTINIT_UOBJECT
1569 template<typename... Ts>
1570 explicit consteval TProperty(
1571 // Args must be the common parameters to FProperty's constructor followed by properties unique to TInPropertyBaseClass
1572 UE::CodeGen::ConstInit::FPropertyParams InBaseParams,
1573 Ts&&... AdditionalArgs
1574 )
1575 : Super(InBaseParams.SetElementSize(TTypeFundamentals::CPPSize), Forward<Ts>(AdditionalArgs)...)
1576 {
1577 }
1578#endif
1579
1580public:
1581
1582#if WITH_EDITORONLY_DATA
1583 explicit TProperty(UField* InField)
1584 : Super(InField)
1585 {
1586 this->SetElementSize(TTypeFundamentals::CPPSize);
1587 }
1588#endif // WITH_EDITORONLY_DATA
1589
1590 // UHT interface
1591 virtual FString GetCPPType( FString* ExtendedTypeText=NULL, uint32 CPPExportFlags=0 ) const override
1592 {
1593 return FString(TTypeFundamentals::GetTypeName());
1594 }
1595 // End of UHT interface
1596
1597 // FProperty interface.
1598 virtual int32 GetMinAlignment() const override
1599 {
1600 return TTypeFundamentals::CPPAlignment;
1601 }
1602 virtual void LinkInternal(FArchive& Ar) override
1603 {
1604 this->SetElementSize(TTypeFundamentals::CPPSize);
1605 this->PropertyFlags |= TTypeFundamentals::GetComputedFlagsPropertyFlags();
1606
1607 }
1608 virtual void CopyValuesInternal( void* Dest, void const* Src, int32 Count ) const override
1609 {
1610 for (int32 Index = 0; Index < Count; Index++)
1611 {
1612 TTypeFundamentals::GetPropertyValuePtr(Dest)[Index] = TTypeFundamentals::GetPropertyValuePtr(Src)[Index];
1613 }
1614 }
1615 virtual void ClearValueInternal( void* Data ) const override
1616 {
1617 TTypeFundamentals::SetPropertyValue(Data, TTypeFundamentals::GetDefaultPropertyValue());
1618 }
1619 virtual void InitializeValueInternal( void* Dest ) const override
1620 {
1621 for (int32 i = 0; i < this->ArrayDim; ++i)
1622 {
1623 TTypeFundamentals::InitializePropertyValue((uint8*)Dest + i * static_cast<size_t>(this->GetElementSize()));
1624 }
1625 }
1626 virtual void DestroyValueInternal( void* Dest ) const override
1627 {
1628 for (int32 i = 0; i < this->ArrayDim; ++i)
1629 {
1630 TTypeFundamentals::DestroyPropertyValue((uint8*)Dest + i * static_cast<size_t>(this->GetElementSize()));
1631 }
1632 }
1633
1635 UE_FORCEINLINE_HINT TCppType const* GetPropertyValuePtr_InContainer(void const* A, int32 ArrayIndex = 0) const
1636 {
1637 return TTypeFundamentals::GetPropertyValuePtr(Super::template ContainerPtrToValuePtr<void>(A, ArrayIndex));
1638 }
1641 {
1642 return TTypeFundamentals::GetPropertyValuePtr(Super::template ContainerPtrToValuePtr<void>(A, ArrayIndex));
1643 }
1645 UE_FORCEINLINE_HINT TCppType const& GetPropertyValue_InContainer(void const* A, int32 ArrayIndex = 0) const
1646 {
1647 return *GetPropertyValuePtr_InContainer(A, ArrayIndex);
1648 }
1651 {
1652 return B ? GetPropertyValue_InContainer(B, ArrayIndex) : TTypeFundamentals::GetDefaultPropertyValue();
1653 }
1655 UE_FORCEINLINE_HINT void SetPropertyValue_InContainer(void* A, TCppType const& Value, int32 ArrayIndex = 0) const
1656 {
1657 *GetPropertyValuePtr_InContainer(A, ArrayIndex) = Value;
1658 }
1659
1661 {
1662 TInPropertyBaseClass::SetValue_InContainer(OutContainer, &InValue);
1663 }
1664
1666 {
1667 TInPropertyBaseClass::GetValue_InContainer(InContainer, OutValue);
1668 }
1669
1670 virtual bool HasIntrusiveUnsetOptionalState() const override
1671 {
1672 return TTypeFundamentals::HasIntrusiveUnsetOptionalState();
1673 }
1674
1675 virtual void InitializeIntrusiveUnsetOptionalValue(void* Data) const override
1676 {
1677 TTypeFundamentals::InitializeIntrusiveUnsetOptionalValue(Data);
1678 }
1679
1680 virtual bool IsIntrusiveOptionalValueSet(const void* Data) const override
1681 {
1682 return TTypeFundamentals::IsIntrusiveOptionalValueSet(Data);
1683 }
1684
1685 virtual void ClearIntrusiveOptionalValue(void* Data) const override
1686 {
1687 TTypeFundamentals::ClearIntrusiveOptionalValue(Data);
1688 }
1689 // End of FProperty interface
1690};
1691
1692template<typename InTCppType, class TInPropertyBaseClass>
1693class TProperty_WithEqualityAndSerializer : public TProperty<InTCppType, TInPropertyBaseClass>
1694{
1695
1696public:
1700
1705
1710
1716 TProperty_WithEqualityAndSerializer(FFieldVariant InOwner, const UECodeGen_Private::FPropertyParamsBaseWithOffset& Prop)
1717 : Super(InOwner, Prop)
1718 {
1719 }
1720
1721#if UE_WITH_CONSTINIT_UOBJECT
1722 template<typename... Ts>
1723 explicit consteval TProperty_WithEqualityAndSerializer(
1724 UE::CodeGen::ConstInit::FPropertyParams InBaseParams,
1725 Ts&&... Args
1726 )
1727 : Super(InBaseParams, Forward<Ts>(Args)...)
1728 {
1729 }
1730#endif
1731
1732#if WITH_EDITORONLY_DATA
1734 : Super(InField)
1735 {
1736 }
1737#endif // WITH_EDITORONLY_DATA
1738
1739 // FProperty interface.
1740 virtual bool Identical( const void* A, const void* B, uint32 PortFlags=0 ) const override
1741 {
1742 // `B` can be null, but we want to avoid the cost of copying a non-null `B` if we were to just use
1743 // `TTypeFundamentals::GetOptionalPropertyValue(B)`. It is important that we branch on `B` here
1744 // rather than using a ternary between the two variants of B (its own value or the default), because
1745 // `TTypeFundamentals::GetDefaultPropertyValue()` returns a non-ref, and thus doing a ternary would
1746 // also result in a copy of `B` which we are trying to avoid!
1747 if (B)
1748 {
1749 return TTypeFundamentals::GetPropertyValue(A) == TTypeFundamentals::GetPropertyValue(B);
1750 }
1751 else
1752 {
1753 return TTypeFundamentals::GetPropertyValue(A) == TTypeFundamentals::GetDefaultPropertyValue();
1754 }
1755 }
1756
1757 virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override
1758 {
1759 Slot << *TTypeFundamentals::GetPropertyValuePtr(Value);
1760 }
1761 // End of FProperty interface
1762
1763};
1764
1766{
1768
1770
1776 UE_API FNumericProperty(FFieldVariant InOwner, const UECodeGen_Private::FPropertyParamsBaseWithOffset& Prop, EPropertyFlags AdditionalPropertyFlags = CPF_None);
1777
1778#if UE_WITH_CONSTINIT_UOBJECT
1779 explicit consteval FNumericProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
1781 {
1782 }
1783#endif
1784
1785#if WITH_EDITORONLY_DATA
1787#endif // WITH_EDITORONLY_DATA
1788
1789 // FProperty interface.
1790 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* Parent, int32 PortFlags, FOutputDevice* ErrorText) const override;
1791 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
1792 // End of FProperty interface
1793
1794 // FNumericProperty interface.
1795
1797 UE_API virtual bool IsFloatingPoint() const;
1798
1800 UE_API virtual bool IsInteger() const;
1801
1802 template <typename T>
1803 bool CanHoldValue(T Value) const
1804 {
1805 if (std::is_floating_point_v<T>)
1806 {
1807 //@TODO: FLOATPRECISION: This feels wrong, it might be losing precision before it tests to see if it's going to lose precision...
1808 return CanHoldDoubleValueInternal((double)Value);
1809 }
1810 else if (std::is_signed_v<T>)
1811 {
1812 return CanHoldSignedValueInternal(Value);
1813 }
1814 else
1815 {
1816 return CanHoldUnsignedValueInternal(Value);
1817 }
1818 }
1819
1821 UE_FORCEINLINE_HINT bool IsEnum() const
1822 {
1823 return !!GetIntPropertyEnum();
1824 }
1825
1827 UE_API virtual UEnum* GetIntPropertyEnum() const;
1828
1834 UE_API virtual void SetIntPropertyValue(void* Data, uint64 Value) const;
1835
1841 UE_API virtual void SetIntPropertyValue(void* Data, int64 Value) const;
1842
1848 UE_API virtual void SetFloatingPointPropertyValue(void* Data, double Value) const;
1849
1856 UE_API virtual void SetNumericPropertyValueFromString(void* Data, TCHAR const* Value) const;
1857 UE_API virtual void SetNumericPropertyValueFromString_InContainer(void* Container, TCHAR const* Value) const;
1858
1864 UE_API virtual int64 GetSignedIntPropertyValue(void const* Data) const;
1865 UE_API virtual int64 GetSignedIntPropertyValue_InContainer(void const* Container) const;
1866
1872 UE_API virtual uint64 GetUnsignedIntPropertyValue(void const* Data) const;
1873 UE_API virtual uint64 GetUnsignedIntPropertyValue_InContainer(void const* Container) const;
1874
1880 UE_API virtual double GetFloatingPointPropertyValue(void const* Data) const;
1881
1888 UE_API virtual FString GetNumericPropertyValueToString(void const* Data) const;
1889 UE_API virtual FString GetNumericPropertyValueToString_InContainer(void const* Container) const;
1890 // End of FNumericProperty interface
1891
1892 UE_API static int64 ReadEnumAsInt64(FStructuredArchive::FSlot Slot, const UStruct* DefaultsStruct, const FPropertyTag& Tag);
1893
1894private:
1895 virtual bool CanHoldDoubleValueInternal (double Value) const PURE_VIRTUAL(FNumericProperty::CanHoldDoubleValueInternal, return false;);
1896 virtual bool CanHoldSignedValueInternal (int64 Value) const PURE_VIRTUAL(FNumericProperty::CanHoldSignedValueInternal, return false;);
1897 virtual bool CanHoldUnsignedValueInternal(uint64 Value) const PURE_VIRTUAL(FNumericProperty::CanHoldUnsignedValueInternal, return false;);
1898};
1899
1900template<typename InTCppType>
1901class TProperty_Numeric : public TProperty_WithEqualityAndSerializer<InTCppType, FNumericProperty>
1902{
1903public:
1907
1912
1917
1923 TProperty_Numeric(FFieldVariant InOwner, const UECodeGen_Private::FPropertyParamsBaseWithOffset& Prop)
1924 : Super(InOwner, Prop)
1925 {
1926 }
1927
1928#if UE_WITH_CONSTINIT_UOBJECT
1929 explicit consteval TProperty_Numeric(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
1930 : Super(InBaseParams)
1931 {
1932 }
1933#endif
1934
1935#if WITH_EDITORONLY_DATA
1937 : Super(InField)
1938 {
1939 }
1940#endif // WITH_EDITORONLY_DATA
1941
1942 // FProperty interface
1943 virtual uint32 GetValueTypeHashInternal(const void* Src) const override
1944 {
1945 return GetTypeHash(*(const InTCppType*)Src);
1946 }
1947
1948protected:
1949 template <typename OldNumericType>
1954
1955private:
1956 template <typename FromType, typename ToType>
1957 struct TConvertAndSet
1958 {
1959 TConvertAndSet(const TProperty_Numeric& Property, FStructuredArchive::FSlot Slot, void* Obj, const FPropertyTag& Tag)
1960 {
1961 FromType OldValue;
1962 Slot << OldValue;
1963 ToType NewValue = (ToType)OldValue;
1964 Property.SetPropertyValue_InContainer(Obj, NewValue, Tag.ArrayIndex);
1965
1966 UE_CLOG(
1967 ((std::is_signed_v<FromType> || std::is_floating_point_v<FromType>) && (!std::is_signed_v<ToType> && !std::is_floating_point_v<ToType>) && OldValue < 0) || ((FromType)NewValue != OldValue),
1968 LogClass,
1969 Warning,
1970 TEXT("Potential data loss during conversion of integer property %s of %s - was (%s) now (%s) - for package: %s"),
1971 *Property.GetName(),
1973 *LexToString(OldValue),
1974 *LexToString(NewValue),
1976 );
1977 }
1978 };
1979
1980 template <typename SameType>
1981 struct TConvertAndSet<SameType, SameType>
1982 {
1983 inline TConvertAndSet(const TProperty_Numeric& Property, FStructuredArchive::FSlot Slot, void* Obj, const FPropertyTag& Tag)
1984 {
1985 SameType Value;
1986 Slot << Value;
1987 Property.SetPropertyValue_InContainer(Obj, Value, Tag.ArrayIndex);
1988 }
1989 };
1990
1991public:
1992 virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override
1993 {
1994 if (const EName* TagType = Tag.Type.ToEName(); TagType && Tag.Type.GetNumber() == NAME_NO_NUMBER_INTERNAL)
1995 {
1997 switch (*TagType)
1998 {
1999 case NAME_Int8Property:
2001 return std::is_same_v<TCppType, int8> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2002
2003 case NAME_Int16Property:
2005 return std::is_same_v<TCppType, int16> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2006
2007 case NAME_IntProperty:
2009 return std::is_same_v<TCppType, int32> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2010
2011 case NAME_Int64Property:
2013 return std::is_same_v<TCppType, int64> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2014
2015 case NAME_ByteProperty:
2016 if (Tag.GetType().GetParameterCount() >= 1)
2017 {
2018 int64 PreviousValue = this->ReadEnumAsInt64(Slot, DefaultsStruct, Tag);
2019 this->SetPropertyValue_InContainer(Data, (TCppType)PreviousValue, Tag.ArrayIndex);
2021 }
2023 return std::is_same_v<TCppType, uint8> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2024
2025 case NAME_EnumProperty:
2026 {
2027 int64 PreviousValue = this->ReadEnumAsInt64(Slot, DefaultsStruct, Tag);
2028 this->SetPropertyValue_InContainer(Data, (TCppType)PreviousValue, Tag.ArrayIndex);
2030 }
2031
2034 return std::is_same_v<TCppType, uint16> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2035
2038 return std::is_same_v<TCppType, uint32> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2039
2042 return std::is_same_v<TCppType, uint64> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2043
2044 case NAME_FloatProperty:
2046 return std::is_same_v<TCppType, float> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2047
2050 return std::is_same_v<TCppType, double> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2051
2052 case NAME_BoolProperty:
2053 this->SetPropertyValue_InContainer(Data, (TCppType)Tag.BoolVal, Tag.ArrayIndex);
2054 return std::is_same_v<TCppType, bool> ? EConvertFromTypeResult::Serialized : EConvertFromTypeResult::Converted;
2055
2056 default:
2057 // We didn't convert it
2058 break;
2059 }
2061 }
2062
2064 }
2065 // End of FProperty interface
2066
2067 // FNumericProperty interface.
2068 virtual bool IsFloatingPoint() const override
2069 {
2070 return std::is_floating_point_v<TCppType>;
2071 }
2072 virtual bool IsInteger() const override
2073 {
2074 return std::is_integral_v<TCppType>;
2075 }
2076 virtual void SetIntPropertyValue(void* Data, uint64 Value) const override
2077 {
2078 check(std::is_integral_v<TCppType>);
2079 TTypeFundamentals::SetPropertyValue(Data, (TCppType)Value);
2080 }
2081 virtual void SetIntPropertyValue(void* Data, int64 Value) const override
2082 {
2083 check(std::is_integral_v<TCppType>);
2084 TTypeFundamentals::SetPropertyValue(Data, (TCppType)Value);
2085 }
2086 virtual void SetFloatingPointPropertyValue(void* Data, double Value) const override
2087 {
2088 check(std::is_floating_point_v<TCppType>);
2089 TTypeFundamentals::SetPropertyValue(Data, (TCppType)Value);
2090 }
2091 virtual void SetNumericPropertyValueFromString(void* Data, TCHAR const* Value) const override
2092 {
2093 LexFromString(*TTypeFundamentals::GetPropertyValuePtr(Data), Value);
2094 }
2101 virtual FString GetNumericPropertyValueToString(void const* Data) const override
2102 {
2103 return LexToString(TTypeFundamentals::GetPropertyValue(Data));
2104 }
2111 virtual int64 GetSignedIntPropertyValue(void const* Data) const override
2112 {
2113 check(std::is_integral_v<TCppType>);
2114 return (int64)TTypeFundamentals::GetPropertyValue(Data);
2115 }
2116 virtual int64 GetSignedIntPropertyValue_InContainer(void const* Container) const override
2117 {
2118 check(std::is_integral_v<TCppType>);
2121 return (int64)LocalValue;
2122 }
2123 virtual uint64 GetUnsignedIntPropertyValue(void const* Data) const override
2124 {
2125 check(std::is_integral_v<TCppType>);
2126 return (uint64)TTypeFundamentals::GetPropertyValue(Data);
2127 }
2129 {
2130 check(std::is_integral_v<TCppType>);
2133 return (uint64)LocalValue;
2134 }
2135 virtual double GetFloatingPointPropertyValue(void const* Data) const override
2136 {
2137 check(std::is_floating_point_v<TCppType>);
2138 return (double)TTypeFundamentals::GetPropertyValue(Data);
2139 }
2140 // End of FNumericProperty interface
2141
2142private:
2143 virtual bool CanHoldDoubleValueInternal(double Value) const
2144 {
2145 return (double)(InTCppType)Value == Value;
2146 }
2147
2148 virtual bool CanHoldSignedValueInternal(int64 Value) const
2149 {
2150 return (int64)(InTCppType)Value == Value;
2151 }
2152
2153 virtual bool CanHoldUnsignedValueInternal(uint64 Value) const
2154 {
2155 return (uint64)(InTCppType)Value == Value;
2156 }
2157};
2158
2159/*-----------------------------------------------------------------------------
2160 FByteProperty.
2161-----------------------------------------------------------------------------*/
2162
2163//
2164// Describes an unsigned byte value or 255-value enumeration variable.
2165//
2167{
2169
2170 // Variables.
2172
2174
2180 UE_API FByteProperty(FFieldVariant InOwner, const UECodeGen_Private::FBytePropertyParams& Prop);
2181
2182#if UE_WITH_CONSTINIT_UOBJECT
2183 explicit consteval FByteProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UEnum* InEnum)
2186 {
2187 }
2188#endif
2189
2190#if WITH_EDITORONLY_DATA
2192#endif // WITH_EDITORONLY_DATA
2193
2194 // UObject interface.
2195 UE_API virtual void Serialize( FArchive& Ar ) override;
2196 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
2197 UE_API virtual void GetPreloadDependencies(TArray<UObject*>& OutDeps) override;
2198 // End of UObject interface
2199
2200 // Field interface
2201 UE_API virtual void PostDuplicate(const FField& InField) override;
2202
2203 // UHT interface
2204 UE_API virtual FString GetCPPType( FString* ExtendedTypeText=NULL, uint32 CPPExportFlags=0 ) const override;
2205 // End of UHT interface
2206
2207 // FProperty interface.
2208 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
2209 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
2210protected:
2211 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
2212 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* Parent, int32 PortFlags, FOutputDevice* ErrorText) const override;
2213public:
2214 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
2215#if WITH_EDITORONLY_DATA
2216 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
2217#endif
2218 UE_API virtual bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag* Tag = nullptr) override;
2219 UE_API virtual void SaveTypeName(UE::FPropertyTypeNameBuilder& Type) const override;
2220 UE_API virtual bool CanSerializeFromTypeName(UE::FPropertyTypeName Type) const override;
2221 // End of FProperty interface
2222
2223 // FNumericProperty interface.
2224 UE_API virtual UEnum* GetIntPropertyEnum() const override;
2225 // End of FNumericProperty interface
2226
2227 // Returns the number of bits required by NetSerializeItem to encode this property (may be fewer than 8 if this byte represents an enum)
2228 UE_API uint64 GetMaxNetSerializeBits() const;
2229};
2230
2231/*-----------------------------------------------------------------------------
2232 FInt8Property.
2233-----------------------------------------------------------------------------*/
2234
2235//
2236// Describes a 8-bit signed integer variable.
2237//
2239{
2241
2243
2249 UE_API FInt8Property(FFieldVariant InOwner, const UECodeGen_Private::FInt8PropertyParams& Prop);
2250
2251#if UE_WITH_CONSTINIT_UOBJECT
2252 explicit consteval FInt8Property(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2254 {
2255 }
2256#endif
2257
2258#if WITH_EDITORONLY_DATA
2260#endif // WITH_EDITORONLY_DATA
2261};
2262
2263/*-----------------------------------------------------------------------------
2264 FInt16Property.
2265-----------------------------------------------------------------------------*/
2266
2267//
2268// Describes a 16-bit signed integer variable.
2269//
2271{
2273
2275
2281 UE_API FInt16Property(FFieldVariant InOwner, const UECodeGen_Private::FInt16PropertyParams& Prop);
2282
2283#if UE_WITH_CONSTINIT_UOBJECT
2284 explicit consteval FInt16Property(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2286 {
2287 }
2288#endif
2289
2290#if WITH_EDITORONLY_DATA
2292#endif // WITH_EDITORONLY_DATA
2293};
2294
2295
2296/*-----------------------------------------------------------------------------
2297 FIntProperty.
2298-----------------------------------------------------------------------------*/
2299
2300//
2301// Describes a 32-bit signed integer variable.
2302//
2303class FIntProperty : public TProperty_Numeric<int32>
2304{
2306
2308
2314 UE_API FIntProperty(FFieldVariant InOwner, const UECodeGen_Private::FIntPropertyParams& Prop);
2315
2316#if UE_WITH_CONSTINIT_UOBJECT
2317 explicit consteval FIntProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2319 {
2320 }
2321#endif
2322
2323#if WITH_EDITORONLY_DATA
2324 UE_API explicit FIntProperty(UField* InField);
2325#endif // WITH_EDITORONLY_DATA
2326};
2327
2328/*-----------------------------------------------------------------------------
2329 FInt64Property.
2330-----------------------------------------------------------------------------*/
2331
2332//
2333// Describes a 64-bit signed integer variable.
2334//
2336{
2338
2340
2346 UE_API FInt64Property(FFieldVariant InOwner, const UECodeGen_Private::FInt64PropertyParams& Prop);
2347
2348#if UE_WITH_CONSTINIT_UOBJECT
2349 explicit consteval FInt64Property(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2351 {
2352 }
2353#endif
2354
2355#if WITH_EDITORONLY_DATA
2357#endif // WITH_EDITORONLY_DATA
2358};
2359
2360/*-----------------------------------------------------------------------------
2361 FUInt16Property.
2362-----------------------------------------------------------------------------*/
2363
2364//
2365// Describes a 16-bit unsigned integer variable.
2366//
2368{
2370
2372
2378 UE_API FUInt16Property(FFieldVariant InOwner, const UECodeGen_Private::FUInt16PropertyParams& Prop);
2379
2380#if UE_WITH_CONSTINIT_UOBJECT
2381 explicit consteval FUInt16Property(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2383 {
2384 }
2385#endif
2386
2387#if WITH_EDITORONLY_DATA
2389#endif // WITH_EDITORONLY_DATA
2390};
2391
2392/*-----------------------------------------------------------------------------
2393 FUInt32Property.
2394-----------------------------------------------------------------------------*/
2395
2396//
2397// Describes a 32-bit unsigned integer variable.
2398//
2400{
2402
2404
2410 UE_API FUInt32Property(FFieldVariant InOwner, const UECodeGen_Private::FUInt32PropertyParams& Prop);
2411
2412#if UE_WITH_CONSTINIT_UOBJECT
2413 explicit consteval FUInt32Property(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2415 {
2416 }
2417#endif
2418
2419#if WITH_EDITORONLY_DATA
2421#endif // WITH_EDITORONLY_DATA
2422};
2423
2424/*-----------------------------------------------------------------------------
2425 FUInt64Property.
2426-----------------------------------------------------------------------------*/
2427
2428//
2429// Describes a 64-bit unsigned integer variable.
2430//
2432{
2434
2436
2442 UE_API FUInt64Property(FFieldVariant InOwner, const UECodeGen_Private::FUInt64PropertyParams& Prop);
2443
2444#if UE_WITH_CONSTINIT_UOBJECT
2445 explicit consteval FUInt64Property(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2447 {
2448 }
2449#endif
2450
2451#if WITH_EDITORONLY_DATA
2453#endif // WITH_EDITORONLY_DATA
2454};
2455
2456
2457/*-----------------------------------------------------------------------------
2458 FFloatProperty.
2459-----------------------------------------------------------------------------*/
2460
2461//
2462// Describes an IEEE 32-bit floating point variable.
2463//
2465{
2467
2469
2475 UE_API FFloatProperty(FFieldVariant InOwner, const UECodeGen_Private::FFloatPropertyParams& Prop);
2476
2477#if UE_WITH_CONSTINIT_UOBJECT
2478 explicit consteval FFloatProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2480 {
2481 }
2482#endif
2483
2484#if WITH_EDITORONLY_DATA
2486#endif // WITH_EDITORONLY_DATA
2487
2488 UE_API virtual bool Identical(const void* A, const void* B, uint32 PortFlags) const override;
2489
2490protected:
2491
2492 UE_API virtual uint32 GetValueTypeHashInternal(const void* Src) const override;
2493};
2494
2495/*-----------------------------------------------------------------------------
2496 FDoubleProperty.
2497-----------------------------------------------------------------------------*/
2498
2499//
2500// Describes an IEEE 64-bit floating point variable.
2501//
2503{
2505
2507
2513 UE_API FDoubleProperty(FFieldVariant InOwner, const UECodeGen_Private::FDoublePropertyParams& Prop);
2514
2515#if UE_WITH_CONSTINIT_UOBJECT
2516 explicit consteval FDoubleProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
2518 {
2519 }
2520#endif
2521
2522#if WITH_EDITORONLY_DATA
2524#endif // WITH_EDITORONLY_DATA
2525
2526 UE_API virtual bool Identical(const void* A, const void* B, uint32 PortFlags) const override;
2527
2528protected:
2529
2530 UE_API virtual uint32 GetValueTypeHashInternal(const void* Src) const override;
2531};
2532
2534
2535/*-----------------------------------------------------------------------------
2536 FBoolProperty.
2537-----------------------------------------------------------------------------*/
2538
2539//
2540// Describes a single bit flag variable residing in a 32-bit unsigned double word.
2541//
2543{
2545
2546 // Variables.
2547private:
2548
2550 uint8 FieldSize;
2552 uint8 ByteOffset;
2554 uint8 ByteMask;
2556 uint8 FieldMask;
2557
2558#if UE_WITH_CONSTINIT_UOBJECT
2559 // CONSTINIT_UOBJECT_TODO: Size increase
2560 void (*SetBitFunc)(void*) = nullptr;
2561#endif
2562
2563public:
2564
2566
2572 UE_API FBoolProperty(FFieldVariant InOwner, const UECodeGen_Private::FBoolPropertyParams& Prop);
2573
2574#if UE_WITH_CONSTINIT_UOBJECT
2575 explicit consteval FBoolProperty(
2576 UE::CodeGen::ConstInit::FPropertyParams InBaseParams,
2578 bool bIsNativeBool,
2579 void (*InSetBitFunc)(void*)
2580 )
2581 : Super(InBaseParams.SetElementSize(InElementSize))
2582 , FieldSize(0)
2583 , ByteOffset(0)
2584 , ByteMask(1)
2585 , FieldMask(bIsNativeBool ? 0xFF : 1)
2587 {
2588 PropertyFlags |= CPF_HasGetValueTypeHash;
2589 }
2590#endif
2591
2592#if WITH_EDITORONLY_DATA
2594#endif // WITH_EDITORONLY_DATA
2595
2596 // UObject interface.
2597 UE_API virtual void Serialize( FArchive& Ar ) override;
2598 // End of UObject interface
2599
2600 // Field interface
2601 UE_API virtual void PostDuplicate(const FField& InField) override;
2602
2603 // UHT interface
2604 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
2605 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
2606 // End of UHT interface
2607
2608 // FProperty interface.
2609 UE_API virtual void LinkInternal(FArchive& Ar) override;
2610 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
2611 UE_API virtual void SerializeItem( FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
2612 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
2613protected:
2614 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
2615 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* Parent, int32 PortFlags, FOutputDevice* ErrorText) const override;
2616public:
2617 UE_API virtual void CopyValuesInternal( void* Dest, void const* Src, int32 Count ) const override;
2618 UE_API virtual void ClearValueInternal( void* Data ) const override;
2619 UE_API virtual void InitializeValueInternal( void* Dest ) const override;
2620 UE_API virtual int32 GetMinAlignment() const override;
2621 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
2622#if WITH_EDITORONLY_DATA
2623 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
2624#endif
2625 // End of FProperty interface
2626
2627protected:
2628 void DetermineBitfieldOffsetAndMask(uint32& Offset, uint32& BitMask, void (*SetBit)(void* Obj), SIZE_T SizeOf);
2629public:
2630 // Emulate the CPP type API, see TPropertyTypeFundamentals
2631 // this is incomplete as some operations make no sense for bitfields, for example they don't have a usable address
2632 typedef bool TCppType;
2633 inline bool GetPropertyValue(void const* A) const
2634 {
2635 check(FieldSize != 0);
2636 uint8* ByteValue = (uint8*)A + ByteOffset;
2637 return !!(*ByteValue & FieldMask);
2638 }
2639 UE_FORCEINLINE_HINT bool GetPropertyValue_InContainer(void const* A, int32 ArrayIndex = 0) const
2640 {
2641 return GetPropertyValue(ContainerPtrToValuePtr<void>(A, ArrayIndex));
2642 }
2644 {
2645 return false;
2646 }
2648 {
2649 return B ? GetPropertyValue(B) : GetDefaultPropertyValue();
2650 }
2651 UE_FORCEINLINE_HINT bool GetOptionalPropertyValue_InContainer(void const* B, int32 ArrayIndex = 0) const
2652 {
2653 return B ? GetPropertyValue_InContainer(B, ArrayIndex) : GetDefaultPropertyValue();
2654 }
2655 inline void SetPropertyValue(void* A, bool Value) const
2656 {
2657 check(FieldSize != 0);
2658 uint8* ByteValue = (uint8*)A + ByteOffset;
2659 *ByteValue = ((*ByteValue) & ~FieldMask) | (Value ? ByteMask : 0);
2660 }
2661 UE_FORCEINLINE_HINT void SetPropertyValue_InContainer(void* A, bool Value, int32 ArrayIndex = 0) const
2662 {
2663 SetPropertyValue(ContainerPtrToValuePtr<void>(A, ArrayIndex), Value);
2664 }
2665 // End of the CPP type API
2666
2674 UE_API void SetBoolSize( const uint32 InSize, const bool bIsNativeBool = false, const uint32 InBitMask = 0 );
2675
2680 {
2681 return FieldMask == 0xff;
2682 }
2683
2686 {
2687 return FieldMask;
2688 }
2689
2692 {
2693 return ByteOffset;
2694 }
2695
2698 {
2699 return FieldSize;
2700 }
2701
2704 {
2705 return ByteMask;
2706 }
2707
2708
2709 UE_API uint32 GetValueTypeHashInternal(const void* Src) const override;
2710
2711 virtual bool HasIntrusiveUnsetOptionalState() const override
2712 {
2713 return false;
2714 }
2715};
2716
2717/*-----------------------------------------------------------------------------
2718 FObjectPropertyBase.
2719-----------------------------------------------------------------------------*/
2720
2721//
2722// Describes a reference variable to another object which may be nil.
2723//
2725{
2727
2728public:
2729
2730 // Variables.
2732
2734
2740 UE_API FObjectPropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParams& Prop, EPropertyFlags AdditionalPropertyFlags = CPF_None);
2741 UE_API FObjectPropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParamsWithoutClass& Prop, EPropertyFlags AdditionalPropertyFlags = CPF_None);
2742
2743#if UE_WITH_CONSTINIT_UOBJECT
2744protected:
2745 explicit consteval FObjectPropertyBase(
2746 UE::CodeGen::ConstInit::FPropertyParams InBaseParams,
2748 )
2750 , PropertyClass(ConstEval, InPropertyClass)
2751 {
2752 }
2753public:
2754#endif
2755
2756#if WITH_EDITORONLY_DATA
2758#endif // WITH_EDITORONLY_DATA
2759
2760 // UObject interface
2761 UE_API virtual void Serialize( FArchive& Ar ) override;
2762 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
2763 UE_API virtual void BeginDestroy() override;
2764 // End of UObject interface
2765
2766 // Field interface
2767 UE_API virtual void PostDuplicate(const FField& InField) override;
2768
2769 // FProperty interface
2770 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
2771 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
2772 virtual bool SupportsNetSharedSerialization() const override { return false; }
2773protected:
2774 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
2775 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
2776public:
2777 UE_API virtual FName GetID() const override;
2778 UE_API virtual void InstanceSubobjects( void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph ) override;
2779 UE_API virtual bool SameType(const FProperty* Other) const override;
2781 UE_API virtual void* ResolveVisitedPathInfo(void* Data, const FPropertyVisitorInfo& Info) const override;
2782 // End of FProperty interface
2783
2784 // FObjectPropertyBase interface
2785public:
2786
2787 UE_DEPRECATED(5.7, "GetCPPTypeCustom is deprecated, and object properties now implement GetCPPType directly.")
2788 FString GetCPPTypeCustom(FString* ExtendedTypeText, uint32 CPPExportFlags, const FString& InnerNativeTypeName) const { return {}; }
2789
2805 UE_API static bool ParseObjectPropertyValue( const FProperty* Property, UObject* OwnerObject, UClass* RequiredMetaClass, uint32 PortFlags, const TCHAR*& Buffer, TObjectPtr<UObject>& out_ResolvedValue, FUObjectSerializeContext* InSerializeContext = nullptr, bool bAllowAnyPackage = true );
2806 UE_API static TObjectPtr<UObject> FindImportedObject( const FProperty* Property, UObject* OwnerObject, UClass* ObjectClass, UClass* RequiredMetaClass, const TCHAR* Text, uint32 PortFlags = 0, FUObjectSerializeContext* InSerializeContext = nullptr, bool bAllowAnyPackage = true );
2807
2816 UE_API static FString GetExportPath(const TObjectPtr<const UObject>& Object, const UObject* Parent = nullptr, const UObject* ExportRootScope = nullptr, const uint32 PortFlags = PPF_None);
2817
2824 UE_API static FString GetExportPath(FTopLevelAssetPath ClassPathName, const FString& ObjectPathName);
2825
2826 // Helper method for sharing code with FObjectPtrProperty even though one doesn't inherit from the other
2827 UE_API static bool StaticIdentical(UObject* A, UObject* B, uint32 PortFlags);
2828
2830 {
2831 return GetObjectPropertyValue(PropertyValueAddress);
2832 }
2834 {
2835 return LoadObjectPropertyValue(ContainerPtrToValuePtr<void>(PropertyValueAddress, ArrayIndex));
2836 }
2837
2838protected:
2839 UE_API virtual void SetObjectPropertyValueUnchecked(void* PropertyValueAddress, UObject* Value) const;
2840 UE_API virtual void SetObjectPtrPropertyValueUnchecked(void* PropertyValueAddress, TObjectPtr<UObject> Ptr) const;
2841 UE_API virtual void SetObjectPropertyValueUnchecked_InContainer(void* ContainerAddress, UObject* Value, int32 ArrayIndex = 0) const;
2842 UE_API virtual void SetObjectPtrPropertyValueUnchecked_InContainer(void* ContainerAddress, TObjectPtr<UObject> Ptr, int32 ArrayIndex = 0) const;
2843public:
2844 UE_API virtual UObject* GetObjectPropertyValue(const void* PropertyValueAddress) const;
2845 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue(const void* PropertyValueAddress) const;
2846 UE_API virtual UObject* GetObjectPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const;
2847 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const;
2848
2849 UE_API void SetObjectPropertyValue(void* PropertyValueAddress, UObject* Value) const;
2850 UE_API void SetObjectPtrPropertyValue(void* PropertyValueAddress, TObjectPtr<UObject> Ptr) const;
2851 UE_API void SetObjectPropertyValue_InContainer(void* ContainerAddress, UObject* Value, int32 ArrayIndex = 0) const;
2852 UE_API void SetObjectPtrPropertyValue_InContainer(void* ContainerAddress, TObjectPtr<UObject> Ptr, int32 ArrayIndex = 0) const;
2853
2863#if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
2864 UE_API void SetPropertyClass(UClass* NewPropertyClass);
2865#else
2867#endif // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
2868
2869 UE_API virtual void CheckValidObject(void* ValueAddress, TObjectPtr<UObject> OldValue, const void* Defaults = nullptr) const;
2870 UE_API virtual bool AllowObjectTypeReinterpretationTo(const FObjectPropertyBase* Other) const;
2871
2872protected:
2873 UE_API virtual bool AllowCrossLevel() const;
2874 // End of FObjectPropertyBase interface
2875
2884 UE_API UObject* ConstructDefaultObjectValueIfNecessary(UObject* ExistingValue, FString* OutFailureReason = nullptr, const void* Defaults = nullptr) const;
2885
2886 // Disable false positive buffer overrun warning during pgoprofile linking step
2888 /* Helper functions for UObject property types that wrap the object pointer in a smart pointer */
2889 template <typename T, typename OutType>
2891 {
2892 // Outgoing values are expected to be UObject* or TObjectPtr
2893 static_assert((std::is_pointer_v<OutType> && std::is_convertible_v<OutType, const UObject*>) || TIsTObjectPtr_V<OutType>);
2894
2895 // Ensure required range is valid
2896 checkf(ArrayIndex >= 0 && ArrayCount >= 0 && ArrayIndex <= ArrayDim && ArrayCount <= ArrayDim && ArrayIndex <= ArrayDim - ArrayCount, TEXT("ArrayIndex (%d) and ArrayCount (%d) is invalid for an array of size %d"), ArrayIndex, ArrayCount, ArrayDim);
2897
2899 {
2900 if (HasGetter())
2901 {
2902 if (ArrayCount == 1)
2903 {
2904 // Slower but no mallocs. We can copy the value directly to the resulting param
2905 T Value;
2906 GetValue_InContainer(SrcAddress, &Value);
2907 *OutObjects = Value.Get();
2908 }
2909 else
2910 {
2911 // Malloc a temp value that is the size of the array. Getter will then copy the entire array to the temp value
2912 T* ValueArray = (T*)AllocateAndInitializeValue();
2914
2915 // Grab the items we care about and free the temp array
2916 int32 LocalElementSize = GetElementSize();
2917 for (int32 OutIndex = 0; OutIndex != ArrayCount; ++OutIndex)
2918 {
2919 OutObjects[OutIndex] = ValueArray[ArrayIndex + OutIndex].Get();
2920 }
2921 DestroyAndFreeValue(ValueArray);
2922 }
2923
2924 return;
2925 }
2926
2928 }
2929
2930 // Fast path - direct memory access
2931 if (ArrayCount == 1)
2932 {
2933 *OutObjects = GetObjectPropertyValue(SrcAddress);
2934 }
2935 else
2936 {
2937 int32 LocalElementSize = GetElementSize();
2938 for (int32 OutIndex = 0; OutIndex != ArrayCount; ++OutIndex)
2939 {
2940 OutObjects[OutIndex] = GetObjectPropertyValue((const uint8*)SrcAddress + OutIndex * LocalElementSize);
2941 }
2942 }
2943 }
2944 // Enable back buffer overrun warning
2946
2947 template <typename T, typename ValueType>
2948 void SetWrappedUObjectPtrValues(void* DestAddress, EPropertyMemoryAccess DestAccess, ValueType* InValues, int32 ArrayIndex, int32 ArrayCount) const
2949 {
2950 // Incoming values are expected to be UObject* or TObjectPtr
2951 static_assert((std::is_pointer_v<ValueType> && std::is_convertible_v<ValueType, const UObject*>) || TIsTObjectPtr_V<ValueType>);
2952
2953 // Ensure required range is valid
2954 checkf(ArrayIndex >= 0 && ArrayCount >= 0 && ArrayIndex <= ArrayDim && ArrayCount <= ArrayDim && ArrayIndex <= ArrayDim - ArrayCount, TEXT("ArrayIndex (%d) and ArrayCount (%d) is invalid for an array of size %d"), ArrayIndex, ArrayCount, ArrayDim);
2955
2956 if (DestAccess == EPropertyMemoryAccess::InContainer)
2957 {
2958 if (HasSetter())
2959 {
2960 if (ArrayCount == 1)
2961 {
2962 // Slower but no mallocs. We can copy a local wrapped value directly to the resulting param
2964 SetValue_InContainer(DestAddress, &WrappedValue);
2965 }
2966 else
2967 {
2968 // Malloc a temp value that is the size of the array. Getter will then copy the entire array to the temp value
2969 T* ValueArray = (T*)AllocateAndInitializeValue();
2971
2972 // Replace the items we care about
2973 int32 LocalElementSize = GetElementSize();
2974 for (int32 OutIndex = 0; OutIndex != ArrayCount; ++OutIndex)
2975 {
2976 ValueArray[ArrayIndex + OutIndex] = InValues[OutIndex];
2977 }
2978
2979 // Now copy the entire array back to the property using a setter
2980 SetValue_InContainer(DestAddress, ValueArray);
2981 DestroyAndFreeValue(ValueArray);
2982 }
2983
2984 return;
2985 }
2986
2988 }
2989
2990 // Fast path - direct memory access
2991 if (ArrayCount == 1)
2992 {
2993 SetObjectPropertyValue(DestAddress, *InValues);
2994 }
2995 else
2996 {
2997 int32 LocalElementSize = GetElementSize();
2998 for (int32 OutIndex = 0; OutIndex != ArrayCount; ++OutIndex)
2999 {
3000 SetObjectPropertyValue((uint8*)DestAddress + OutIndex * LocalElementSize, InValues[OutIndex]);
3001 }
3002 }
3003 }
3004};
3005
3006template<typename InTCppType>
3007class TFObjectPropertyBase : public TProperty<InTCppType, FObjectPropertyBase>
3008{
3009public:
3013
3018
3020 : Super(InOwner, InName, InObjectFlags)
3021 {
3022 this->PropertyClass = nullptr;
3023 }
3024
3030 TFObjectPropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParams& Prop)
3031 : Super(InOwner, Prop)
3032 {
3033 this->PropertyClass = Prop.ClassFunc ? Prop.ClassFunc() : nullptr;
3034 }
3041 TFObjectPropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParamsWithoutClass& Prop, UClass* InClass)
3042 : Super(InOwner, Prop)
3043 {
3044 this->PropertyClass = InClass;
3045 }
3046
3047#if UE_WITH_CONSTINIT_UOBJECT
3048protected:
3049 explicit consteval TFObjectPropertyBase(
3050 UE::CodeGen::ConstInit::FPropertyParams InBaseParams,
3052 )
3054 {
3055 }
3056public:
3057#endif
3058
3059#if WITH_EDITORONLY_DATA
3061 : Super(InField)
3062 {
3063 }
3064#endif // WITH_EDITORONLY_DATA
3065
3066 // FProperty interface.
3073 // End of FProperty interface
3074};
3075
3077{
3078 None = 0,
3080};
3082
3083//
3084// Describes a reference variable to another object which may be nil.
3085//
3086class FObjectProperty : public TFObjectPropertyBase<TObjectPtr<UObject>>
3087{
3089
3091
3097 UE_API FObjectProperty(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParams& Prop);
3098
3099#if UE_WITH_CONSTINIT_UOBJECT
3100 explicit consteval FObjectProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UClass* PropertyClass)
3101 : Super(InBaseParams, PropertyClass)
3102 {
3103 }
3104#endif
3105
3106#if WITH_EDITORONLY_DATA
3108#endif // WITH_EDITORONLY_DATA
3109
3110 // UHT interface
3111 UE_API virtual FString GetCPPType(FString* ExtendedTypeText, uint32 CPPExportFlags) const override;
3112 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3113 // End of UHT interface
3114
3115 // FProperty interface
3116 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
3117#if UE_WITH_REMOTE_OBJECT_HANDLE
3118 UE_API virtual bool NetSerializeItem(FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8>* MetaData = nullptr) const override;
3119#endif // UE_WITH_REMOTE_OBJECT_HANDLE
3120 UE_API virtual void EmitReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
3121 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
3122 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
3123 UE_API virtual bool AllowCrossLevel() const override;
3124private:
3125 UE_API virtual uint32 GetValueTypeHashInternal(const void* Src) const override;
3126 UE_API virtual void CopyValuesInternal(void* Dest, void const* Src, int32 Count) const override;
3127public:
3128 UE_API virtual void CopySingleValueToScriptVM( void* Dest, void const* Src ) const override;
3129 UE_API virtual void CopySingleValueFromScriptVM( void* Dest, void const* Src ) const override;
3130 UE_API virtual void CopyCompleteValueToScriptVM( void* Dest, void const* Src ) const override;
3131 UE_API virtual void CopyCompleteValueFromScriptVM( void* Dest, void const* Src ) const override;
3132 UE_API virtual void CopyCompleteValueToScriptVM_InContainer( void* OutValue, void const* InContainer ) const override;
3133 UE_API virtual void CopyCompleteValueFromScriptVM_InContainer( void* OutContainer, void const* InValue ) const override;
3134 UE_API virtual bool Identical(const void* A, const void* B, uint32 PortFlags) const override;
3135 // End of FProperty interface
3136
3137 // FObjectPropertyBase interface
3138 UE_API virtual UObject* GetObjectPropertyValue(const void* PropertyValueAddress) const override;
3139 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue(const void* PropertyValueAddress) const override;
3140 UE_API virtual UObject* GetObjectPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3141 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3142protected:
3143 UE_API virtual void SetObjectPropertyValueUnchecked(void* PropertyValueAddress, UObject* Value) const override;
3144 UE_API virtual void SetObjectPtrPropertyValueUnchecked(void* PropertyValueAddress, TObjectPtr<UObject> Ptr) const override;
3145 UE_API virtual void SetObjectPropertyValueUnchecked_InContainer(void* ContainerAddress, UObject* Value, int32 ArrayIndex = 0) const override;
3146 UE_API virtual void SetObjectPtrPropertyValueUnchecked_InContainer(void* ContainerAddress, TObjectPtr<UObject> Ptr, int32 ArrayIndex = 0) const override;
3147public:
3148 // End of FObjectPropertyBase interface
3149
3158 UE_API void PostSerializeObjectItem(FArchive& SerializingArchive, void* Value, UObject* CurrentValue, UObject* ObjectValue, EObjectPropertyOptions Options = EObjectPropertyOptions::None, const void* Defaults = nullptr) const;
3159
3161 {
3162 return reinterpret_cast<TObjectPtr<UObject>*>(const_cast<void*>(PropertyValueAddress));
3163 }
3164
3166 {
3167 return *reinterpret_cast<TObjectPtr<UObject>*>(const_cast<void*>(PropertyValueAddress));
3168 }
3169
3171 {
3172 // If an object pointer is marked as non-nullable, then nullptr can be used as an intrusive unset state
3173 // At present, no C++ properties can be marked with this flag because TOptional<UObject*> and TOptional<TObjectPtr<UObject>>
3174 // do not have an intrusive unset state from TOptional's perspective.
3175 return (PropertyFlags & CPF_NonNullable) != 0;
3176 }
3177
3178 virtual void InitializeIntrusiveUnsetOptionalValue(void* Data) const override
3179 {
3180 ClearValue(Data);
3181 }
3182
3183 virtual bool IsIntrusiveOptionalValueSet(const void* Data) const
3184 {
3185 checkSlow(!IsNative());
3186 return GetPropertyValue(Data) != nullptr;
3187 }
3188
3189 virtual void ClearIntrusiveOptionalValue(void* Data) const
3190 {
3191 checkSlow(!IsNative());
3192 ClearValue(Data);
3193 }
3194
3195 UE_API virtual void EmitIntrusiveOptionalReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
3196};
3197
3198using FObjectPtrProperty UE_DEPRECATED(5.4, "FObjectPtrProperty is deprecated using FObjectProperty instead.") = FObjectProperty;
3199
3200//
3201// Describes a reference variable to another object which may be nil, and may turn nil at any point
3202//
3203class FWeakObjectProperty : public TFObjectPropertyBase<FWeakObjectPtr>
3204{
3206
3208
3214 UE_API FWeakObjectProperty(FFieldVariant InOwner, const UECodeGen_Private::FWeakObjectPropertyParams& Prop);
3215
3216#if UE_WITH_CONSTINIT_UOBJECT
3217 explicit consteval FWeakObjectProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UClass* PropertyClass)
3218 : Super(InBaseParams, PropertyClass)
3219 {
3220 }
3221#endif
3222
3223#if WITH_EDITORONLY_DATA
3225#endif // WITH_EDITORONLY_DATA
3226
3227 // UHT interface
3228 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3229 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
3230 // End of UHT interface
3231
3232 // FProperty interface
3233 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
3234#if UE_WITH_REMOTE_OBJECT_HANDLE
3235 UE_API virtual bool Identical(const void* A, const void* B, uint32 PortFlags) const override;
3236 UE_API virtual bool NetSerializeItem(FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8>* MetaData = nullptr) const override;
3237#endif
3238protected:
3239 UE_API virtual void LinkInternal(FArchive& Ar) override;
3240private:
3241 UE_API virtual uint32 GetValueTypeHashInternal(const void* Src) const override;
3242public:
3243 UE_API virtual void CopySingleValueToScriptVM( void* Dest, void const* Src ) const override;
3244 UE_API virtual void CopySingleValueFromScriptVM( void* Dest, void const* Src ) const override;
3245 UE_API virtual void CopyCompleteValueToScriptVM( void* Dest, void const* Src ) const override;
3246 UE_API virtual void CopyCompleteValueFromScriptVM( void* Dest, void const* Src ) const override;
3247 UE_API virtual void CopyCompleteValueToScriptVM_InContainer( void* OutValue, void const* InContainer ) const override;
3248 UE_API virtual void CopyCompleteValueFromScriptVM_InContainer( void* OutContainer, void const* InValue ) const override;
3249 // End of FProperty interface
3250
3251 // FObjectProperty interface
3252 UE_API virtual UObject* GetObjectPropertyValue(const void* PropertyValueAddress) const override;
3253 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue(const void* PropertyValueAddress) const override;
3254 UE_API virtual UObject* GetObjectPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3255 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3256protected:
3257 UE_API virtual void SetObjectPropertyValueUnchecked(void* PropertyValueAddress, UObject* Value) const override;
3258 UE_API virtual void SetObjectPtrPropertyValueUnchecked(void* PropertyValueAddress, TObjectPtr<UObject> Ptr) const override;
3259 UE_API virtual void SetObjectPropertyValueUnchecked_InContainer(void* ContainerAddress, UObject* Value, int32 ArrayIndex = 0) const override;
3260 UE_API virtual void SetObjectPtrPropertyValueUnchecked_InContainer(void* ContainerAddress, TObjectPtr<UObject> Ptr, int32 ArrayIndex = 0) const override;
3261public:
3262 // End of FObjectProperty interface
3263};
3264
3265//
3266// Describes a reference variable to another object which may be nil, and will become valid or invalid at any point
3267//
3268class FLazyObjectProperty : public TFObjectPropertyBase<FLazyObjectPtr>
3269{
3271
3273
3279 UE_API FLazyObjectProperty(FFieldVariant InOwner, const UECodeGen_Private::FLazyObjectPropertyParams& Prop);
3280
3281#if WITH_EDITORONLY_DATA
3283#endif // WITH_EDITORONLY_DATA
3284
3285#if UE_WITH_CONSTINIT_UOBJECT
3286 explicit consteval FLazyObjectProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UClass* PropertyClass)
3287 : Super(InBaseParams, PropertyClass)
3288 {
3289 }
3290#endif
3291
3292 // UHT interface
3293 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3294 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
3295 // End of UHT interface
3296
3297 // FProperty interface
3298 UE_API virtual FName GetID() const override;
3299 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
3300 UE_API virtual void SerializeItem( FStructuredArchive::FSlot Slot, void* Value, void const* Defaults ) const override;
3301 UE_API virtual void CopySingleValueToScriptVM( void* Dest, void const* Src ) const override;
3302 UE_API virtual void CopySingleValueFromScriptVM( void* Dest, void const* Src ) const override;
3303 UE_API virtual void CopyCompleteValueToScriptVM( void* Dest, void const* Src ) const override;
3304 UE_API virtual void CopyCompleteValueFromScriptVM( void* Dest, void const* Src ) const override;
3305 UE_API virtual void CopyCompleteValueToScriptVM_InContainer( void* OutValue, void const* InContainer ) const override;
3306 UE_API virtual void CopyCompleteValueFromScriptVM_InContainer( void* OutContainer, void const* InValue ) const override;
3307 // End of FProperty interface
3308
3309 // FObjectProperty interface
3310 UE_API virtual UObject* GetObjectPropertyValue(const void* PropertyValueAddress) const override;
3311 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue(const void* PropertyValueAddress) const override;
3312 UE_API virtual UObject* GetObjectPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3313 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3314protected:
3315 UE_API virtual void SetObjectPropertyValueUnchecked(void* PropertyValueAddress, UObject* Value) const override;
3316 UE_API virtual void SetObjectPtrPropertyValueUnchecked(void* PropertyValueAddress, TObjectPtr<UObject> Ptr) const override;
3317 UE_API virtual void SetObjectPropertyValueUnchecked_InContainer(void* ContainerAddress, UObject* Value, int32 ArrayIndex = 0) const override;
3318 UE_API virtual void SetObjectPtrPropertyValueUnchecked_InContainer(void* ContainerAddress, TObjectPtr<UObject> Ptr, int32 ArrayIndex = 0) const override;
3319public:
3320 UE_API virtual bool AllowCrossLevel() const override;
3321private:
3322 UE_API virtual uint32 GetValueTypeHashInternal(const void* Src) const override;
3323public:
3324 // End of FObjectProperty interface
3325};
3326
3327//
3328// Describes a reference variable to another object which may be nil, and will become valid or invalid at any point
3329//
3330class FSoftObjectProperty : public TFObjectPropertyBase<FSoftObjectPtr>
3331{
3333
3335
3341 UE_API FSoftObjectProperty(FFieldVariant InOwner, const UECodeGen_Private::FSoftObjectPropertyParams& Prop);
3342
3349 UE_API FSoftObjectProperty(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParamsWithoutClass& Prop, UClass* InClass);
3350
3351#if UE_WITH_CONSTINIT_UOBJECT
3352 explicit consteval FSoftObjectProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UClass* PropertyClass)
3353 : Super(InBaseParams, PropertyClass)
3354 {
3355 }
3356#endif
3357
3358#if WITH_EDITORONLY_DATA
3360#endif // WITH_EDITORONLY_DATA
3361
3362 // UHT interface
3363 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3364 // End of UHT interface
3365
3366 // FProperty interface
3367 UE_API virtual FName GetID() const override;
3368 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
3369 UE_API virtual void SerializeItem( FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
3370 UE_API virtual bool NetSerializeItem(FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL) const override;
3371protected:
3372 UE_API virtual void LinkInternal(FArchive& Ar) override;
3373 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
3374 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
3375public:
3376 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
3377 // End of FProperty interface
3378
3379 // FObjectProperty interface
3380 UE_API virtual UObject* LoadObjectPropertyValue(const void* PropertyValueAddress) const override;
3381
3382 UE_API virtual UObject* GetObjectPropertyValue(const void* PropertyValueAddress) const override;
3383 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue(const void* PropertyValueAddress) const override;
3384 UE_API virtual UObject* GetObjectPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3385 UE_API virtual TObjectPtr<UObject> GetObjectPtrPropertyValue_InContainer(const void* ContainerAddress, int32 ArrayIndex = 0) const override;
3386protected:
3387 UE_API virtual void SetObjectPropertyValueUnchecked(void* PropertyValueAddress, UObject* Value) const override;
3388 UE_API virtual void SetObjectPtrPropertyValueUnchecked(void* PropertyValueAddress, TObjectPtr<UObject> Ptr) const override;
3389 UE_API virtual void SetObjectPropertyValueUnchecked_InContainer(void* ContainerAddress, UObject* Value, int32 ArrayIndex = 0) const override;
3390 UE_API virtual void SetObjectPtrPropertyValueUnchecked_InContainer(void* ContainerAddress, TObjectPtr<UObject> Ptr, int32 ArrayIndex = 0) const override;
3391public:
3392 UE_API virtual bool AllowCrossLevel() const override;
3393 UE_API virtual FString GetCPPType(FString* ExtendedTypeText, uint32 CPPExportFlags) const override;
3394
3395private:
3396 UE_API virtual uint32 GetValueTypeHashInternal(const void* Src) const override;
3397public:
3398 // Note: FSoftObjectProperty does not override the Copy*VM functions, as ScriptVM should store Asset as a FSoftObjectPtr not as a UObject*.
3399
3400 // End of FObjectProperty interface
3401};
3402
3403/*-----------------------------------------------------------------------------
3404 FClassProperty.
3405-----------------------------------------------------------------------------*/
3406
3407//
3408// Describes a reference variable to another object which may be nil.
3409//
3411{
3413
3414 // Variables.
3415 TObjectPtr<class UClass> MetaClass;
3416public:
3417
3419
3425 UE_API FClassProperty(FFieldVariant InOwner, const UECodeGen_Private::FClassPropertyParams& Prop);
3426
3427#if UE_WITH_CONSTINIT_UOBJECT
3428 explicit consteval FClassProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UClass* InPropertyClass, UClass* InMetaClass)
3430 , MetaClass(ConstEval, InMetaClass)
3431 {
3432 }
3433#endif
3434
3435#if WITH_EDITORONLY_DATA
3437#endif // WITH_EDITORONLY_DATA
3438
3439 // UObject interface
3440 UE_API virtual void Serialize( FArchive& Ar ) override;
3441 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
3442 UE_API virtual void BeginDestroy() override;
3443 // End of UObject interface
3444
3445 // Field Interface
3446 UE_API virtual void PostDuplicate(const FField& InField) override;
3447
3448 // UHT interface
3449 UE_API virtual FString GetCPPType(FString* ExtendedTypeText, uint32 CPPExportFlags) const override;
3450 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3451 // End of UHT interface
3452
3453 // FProperty interface
3454 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
3455 UE_API virtual bool SameType(const FProperty* Other) const override;
3456 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
3457#if WITH_EDITORONLY_DATA
3458 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
3459#endif
3460 // End of FProperty interface
3461
3462
3472#if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
3473 UE_API void SetMetaClass(UClass* NewMetaClass);
3474#else
3476#endif // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
3477};
3478
3479using FClassPtrProperty UE_DEPRECATED(5.4, "FClassPtrProperty is deprecated use FClassProperty instead.") = FClassProperty;
3480/*-----------------------------------------------------------------------------
3481 FSoftClassProperty.
3482-----------------------------------------------------------------------------*/
3483
3484//
3485// Describes a reference variable to another class which may be nil, and will become valid or invalid at any point
3486//
3488{
3490
3491 // Variables.
3492 TObjectPtr<class UClass> MetaClass;
3493public:
3494
3496
3502 UE_API FSoftClassProperty(FFieldVariant InOwner, const UECodeGen_Private::FSoftClassPropertyParams& Prop);
3503
3504#if UE_WITH_CONSTINIT_UOBJECT
3505 explicit consteval FSoftClassProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UClass* ClassClass, UClass* InMetaClass)
3507 , MetaClass(ConstEval, InMetaClass)
3508 {
3509 }
3510#endif
3511
3512#if WITH_EDITORONLY_DATA
3514#endif // WITH_EDITORONLY_DATA
3515
3516 // UHT interface
3517 UE_API virtual FString GetCPPType(FString* ExtendedTypeText, uint32 CPPExportFlags) const override;
3518 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3519 // End of UHT interface
3520
3521 // Field Interface
3522 UE_API virtual void PostDuplicate(const FField& InField) override;
3523
3524 // UObject interface
3525 UE_API virtual void Serialize( FArchive& Ar ) override;
3526 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
3527 UE_API virtual void BeginDestroy() override;
3528 // End of UObject interface
3529
3530 // FProperty interface
3531 UE_API virtual bool SameType(const FProperty* Other) const override;
3532 // End of FProperty interface
3533
3534
3544#if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
3545 UE_API void SetMetaClass(UClass* NewMetaClass);
3546#else
3548#endif // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
3549};
3550
3551/*-----------------------------------------------------------------------------
3552 FInterfaceProperty.
3553-----------------------------------------------------------------------------*/
3554
3560class FInterfaceProperty : public TProperty<FScriptInterface, FProperty>
3561{
3563
3564
3565 TObjectPtr<class UClass> InterfaceClass;
3566
3567public:
3568 typedef Super::TTypeFundamentals TTypeFundamentals;
3569 typedef TTypeFundamentals::TCppType TCppType;
3570
3572
3578 UE_API FInterfaceProperty(FFieldVariant InOwner, const UECodeGen_Private::FInterfacePropertyParams& Prop);
3579
3580#if UE_WITH_CONSTINIT_UOBJECT
3581 explicit consteval FInterfaceProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UClass* InInterfaceClass)
3583 , InterfaceClass(ConstEval, InInterfaceClass)
3584 {
3585 }
3586#endif
3587
3588#if WITH_EDITORONLY_DATA
3590#endif // WITH_EDITORONLY_DATA
3591
3592 // UHT interface
3593 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3594 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
3595 // End of UHT interface
3596
3597 // Field interface
3598 UE_API virtual void PostDuplicate(const FField& InField) override;
3599
3600 // FProperty interface
3601 UE_API virtual void LinkInternal(FArchive& Ar) override;
3602 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
3603 UE_API virtual void SerializeItem( FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
3604 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
3605 virtual bool SupportsNetSharedSerialization() const override { return false; }
3606protected:
3607 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
3608 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
3609public:
3611 UE_API virtual bool SameType(const FProperty* Other) const override;
3612#if WITH_EDITORONLY_DATA
3613 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
3614#endif
3615 // End of FProperty interface
3616
3617 // UObject interface
3618 UE_API virtual void Serialize( FArchive& Ar ) override;
3619 UE_API virtual void EmitReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
3620 UE_API virtual void BeginDestroy() override;
3621 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
3622 // End of UObject interface
3623
3633#if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
3634 UE_API void SetInterfaceClass(UClass* NewInterfaceClass);
3635#else
3637#endif // USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
3638};
3639
3640/*-----------------------------------------------------------------------------
3641 FNameProperty.
3642-----------------------------------------------------------------------------*/
3643
3644//
3645// Describes a name variable pointing into the global name table.
3646//
3647
3649{
3651public:
3654
3656
3662 UE_API FNameProperty(FFieldVariant InOwner, const UECodeGen_Private::FNamePropertyParams& Prop);
3663
3664#if UE_WITH_CONSTINIT_UOBJECT
3665 explicit consteval FNameProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
3667 {
3668 }
3669#endif
3670
3671#if WITH_EDITORONLY_DATA
3673#endif // WITH_EDITORONLY_DATA
3674
3675 // FProperty interface
3676protected:
3677 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
3678 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
3679public:
3680 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
3681 UE_API uint32 GetValueTypeHashInternal(const void* Src) const override;
3682 // End of FProperty interface
3683};
3684
3685/*-----------------------------------------------------------------------------
3686 FArrayProperty.
3687-----------------------------------------------------------------------------*/
3688
3689//
3690// Describes a dynamic array.
3691//
3692
3694
3695#if !PLATFORM_ANDROID || !PLATFORM_32BITS
3696 static_assert(sizeof(FScriptArray) == sizeof(FFreezableScriptArray) && alignof(FScriptArray) == alignof(FFreezableScriptArray), "FScriptArray and FFreezableScriptArray are expected to be layout-compatible");
3697#endif
3698
3699class FScriptArrayHelper;
3700
3701class FArrayProperty : public TProperty<FScriptArray, FProperty>
3702{
3704
3705 // Variables.
3706 EArrayPropertyFlags ArrayFlags;
3708
3709public:
3711 enum
3712 {
3713 // These need to be the same as FFreezableScriptArray
3714 CPPSize = sizeof(FScriptArray),
3715 CPPAlignment = alignof(FScriptArray)
3717
3718 using TTypeFundamentals = Super::TTypeFundamentals;
3719 using TCppType = TTypeFundamentals::TCppType;
3720
3722
3728 UE_API FArrayProperty(FFieldVariant InOwner, const UECodeGen_Private::FArrayPropertyParams& Prop);
3729
3730#if UE_WITH_CONSTINIT_UOBJECT
3731 explicit consteval FArrayProperty(
3732 UE::CodeGen::ConstInit::FPropertyParams InBaseParams, EArrayPropertyFlags InArrayFlags, FProperty* InInnerProperty
3733 )
3735 , ArrayFlags(InArrayFlags)
3737 {
3738 }
3739#endif
3740
3741 UE_API virtual ~FArrayProperty();
3742
3743#if WITH_EDITORONLY_DATA
3745#endif // WITH_EDITORONLY_DATA
3746
3747 // UObject interface
3748 UE_API virtual void Serialize( FArchive& Ar ) override;
3749 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
3750 UE_API virtual void GetPreloadDependencies(TArray<UObject*>& OutDeps) override;
3751 // End of UObject interface
3752
3753 // Field interface
3754 UE_API virtual void PostDuplicate(const FField& InField) override;
3755
3756 // UField interface
3757 UE_API virtual void AddCppProperty(FProperty* Property) override;
3758 UE_API virtual FField* GetInnerFieldByName(const FName& InName) override;
3759 UE_API virtual void GetInnerFields(TArray<FField*>& OutFields) override;
3760
3761 // End of UField interface
3762
3763 // FProperty interface
3764 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
3765 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
3766 UE_API virtual void LinkInternal(FArchive& Ar) override;
3767 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
3768 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
3769 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
3770protected:
3771 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
3772 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
3773 UE_API virtual bool ContainsClearOnFinishDestroyInternal(TArray<const FStructProperty*>& EncounteredStructProps) const override;
3774 UE_API virtual void FinishDestroyInternal(void* Data) const override;
3775public:
3776 virtual void InitializeValueInternal(void* Dest) const override
3777 {
3779 {
3780 checkf(!PLATFORM_ANDROID || !PLATFORM_32BITS, TEXT("FFreezableScriptArray is not supported on Android 32 bit platform"));
3781
3782 for (int32 i = 0; i < this->ArrayDim; ++i)
3783 {
3784 new ((uint8*)Dest + i * static_cast<size_t>(this->GetElementSize())) FFreezableScriptArray;
3785 }
3786 }
3787 else
3788 {
3789 for (int32 i = 0; i < this->ArrayDim; ++i)
3790 {
3791 new ((uint8*)Dest + i * static_cast<size_t>(this->GetElementSize())) FScriptArray;
3792 }
3793 }
3794 }
3795 UE_API virtual void CopyValuesInternal( void* Dest, void const* Src, int32 Count ) const override;
3796 UE_API virtual void ClearValueInternal( void* Data ) const override;
3797 UE_API virtual void DestroyValueInternal( void* Dest ) const override;
3798 UE_API virtual void InstanceSubobjects( void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph ) override;
3800 UE_API virtual void EmitReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
3801 UE_API virtual bool SameType(const FProperty* Other) const override;
3802 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
3803
3804 virtual int32 GetMinAlignment() const override
3805 {
3806 // This is the same as alignof(FFreezableScriptArray)
3807 return alignof(FScriptArray);
3808 }
3809
3810 UE_API virtual void* GetValueAddressAtIndex_Direct(const FProperty* Inner, void* InValueAddress, int32 Index) const override;
3811 UE_API virtual bool UseBinaryOrNativeSerialization(const FArchive& Ar) const override;
3812 UE_API virtual bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag* Tag = nullptr) override;
3813 UE_API virtual void SaveTypeName(UE::FPropertyTypeNameBuilder& Type) const override;
3814 UE_API virtual bool CanSerializeFromTypeName(UE::FPropertyTypeName Type) const override;
3816 UE_API virtual void* ResolveVisitedPathInfo(void* Data, const FPropertyVisitorInfo& Info) const override;
3817 // End of FProperty interface
3818
3819 UE_API FString GetCPPTypeCustom(FString* ExtendedTypeText, uint32 CPPExportFlags, const FString& InnerTypeText, const FString& InInnerExtendedTypeText) const;
3820
3822 UE_API static void ExportTextInnerItem(FString& ValueStr, const FProperty* Inner, const void* PropertyValue, int32 PropertySize, const void* DefaultValue, int32 DefaultSize, UObject* Parent = nullptr, int32 PortFlags = 0, UObject* ExportRootScope = nullptr);
3823
3825 UE_API static const TCHAR* ImportTextInnerItem(const TCHAR* Buffer, const FProperty* Inner, void* Data, int32 PortFlags, UObject* OwnerObject, FScriptArrayHelper* ArrayHelper = nullptr, FOutputDevice* ErrorText = (FOutputDevice*)GWarn);
3826#if WITH_EDITORONLY_DATA
3827 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
3828#endif
3829
3830 UE_API virtual bool HasIntrusiveUnsetOptionalState() const override;
3831 UE_API virtual void InitializeIntrusiveUnsetOptionalValue(void* Data) const override;
3832 UE_API virtual bool IsIntrusiveOptionalValueSet(const void* Data) const override;
3833 UE_API virtual void ClearIntrusiveOptionalValue(void* Data) const override;
3834 UE_API virtual void EmitIntrusiveOptionalReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
3835};
3836
3838
3839//@todo stever sizeof(FScriptMap) is 80 bytes, while sizeof(FFreezableScriptMap) is 56 bytes atm
3840//static_assert(sizeof(FScriptMap) == sizeof(FFreezableScriptMap) && alignof(FScriptMap) == alignof(FFreezableScriptMap), "FScriptMap and FFreezableScriptMap are expected to be layout-compatible");
3841
3842class FMapProperty : public TProperty<FScriptMap, FProperty>
3843{
3845
3846 // Properties representing the key type and value type of the contained pairs
3847 FProperty* KeyProp;
3848 FProperty* ValueProp;
3849 FScriptMapLayout MapLayout;
3850 EMapPropertyFlags MapFlags;
3851
3852 template <typename CallableType>
3853 auto WithScriptMap(void* InMap, CallableType&& Callable) const
3854 {
3856 {
3857 return Callable((FFreezableScriptMap*)InMap);
3858 }
3859 else
3860 {
3861 return Callable((FScriptMap*)InMap);
3862 }
3863 }
3864
3865public:
3866 using TTypeFundamentals = Super::TTypeFundamentals;
3867 using TCppType = TTypeFundamentals::TCppType;
3868
3870
3876 UE_API FMapProperty(FFieldVariant InOwner, const UECodeGen_Private::FMapPropertyParams& Prop);
3877
3878#if UE_WITH_CONSTINIT_UOBJECT
3879 explicit consteval FMapProperty(
3880 UE::CodeGen::ConstInit::FPropertyParams InBaseParams,
3888 )
3890 , KeyProp(InKeyProperty)
3891 , ValueProp(InValueProperty)
3892 , MapLayout()
3893 , MapFlags(InMapFlags)
3894 {
3896 }
3897#endif
3898
3899#if WITH_EDITORONLY_DATA
3900 UE_API explicit FMapProperty(UField* InField);
3901#endif // WITH_EDITORONLY_DATA
3902
3903 UE_API virtual ~FMapProperty();
3904
3905 // UObject interface
3906 UE_API virtual void Serialize(FArchive& Ar) override;
3907 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
3908 UE_API virtual void GetPreloadDependencies(TArray<UObject*>& OutDeps) override;
3909 // End of UObject interface
3910
3911 // Field Interface
3912 UE_API virtual void PostDuplicate(const FField& InField) override;
3913 UE_API virtual FField* GetInnerFieldByName(const FName& InName) override;
3914 UE_API virtual void GetInnerFields(TArray<FField*>& OutFields) override;
3915
3916 // UField interface
3917 UE_API virtual void AddCppProperty(FProperty* Property) override;
3918 // End of UField interface
3919
3920 // FProperty interface
3921 UE_API virtual FString GetCPPMacroType(FString& ExtendedTypeText) const override;
3922 UE_API virtual FString GetCPPType(FString* ExtendedTypeText, uint32 CPPExportFlags) const override;
3923 UE_API virtual void LinkInternal(FArchive& Ar) override;
3924 UE_API virtual bool Identical(const void* A, const void* B, uint32 PortFlags) const override;
3925 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
3926 UE_API virtual bool NetSerializeItem(FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL) const override;
3927protected:
3928 UE_API virtual void ExportText_Internal(FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const override;
3931 UE_API virtual void FinishDestroyInternal(void* Data) const override;
3932public:
3933 virtual void InitializeValueInternal(void* Dest) const override
3934 {
3936 {
3937 checkf(false, TEXT("FFreezableScriptMap is not supported at the moment"));
3938
3939 for (int32 i = 0; i < this->ArrayDim; ++i)
3940 {
3941 new ((uint8*)Dest + i * static_cast<size_t>(this->GetElementSize())) FFreezableScriptMap;
3942 }
3943 }
3944 else
3945 {
3946 for (int32 i = 0; i < this->ArrayDim; ++i)
3947 {
3948 new ((uint8*)Dest + i * static_cast<size_t>(this->GetElementSize())) FScriptMap;
3949 }
3950 }
3951 }
3952 UE_API virtual void CopyValuesInternal(void* Dest, void const* Src, int32 Count) const override;
3953 UE_API virtual void ClearValueInternal(void* Data) const override;
3954 UE_API virtual void DestroyValueInternal(void* Dest) const override;
3955 UE_API virtual void InstanceSubobjects(void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph) override;
3958 UE_API virtual bool SameType(const FProperty* Other) const override;
3959 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
3960 UE_API virtual void* GetValueAddressAtIndex_Direct(const FProperty* Inner, void* InValueAddress, int32 LogicalIndex) const override;
3961 UE_API virtual bool UseBinaryOrNativeSerialization(const FArchive& Ar) const override;
3962 UE_API virtual bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag* Tag = nullptr) override;
3963 UE_API virtual void SaveTypeName(UE::FPropertyTypeNameBuilder& Type) const override;
3964 UE_API virtual bool CanSerializeFromTypeName(UE::FPropertyTypeName Type) const override;
3966 UE_API virtual void* ResolveVisitedPathInfo(void* Data, const FPropertyVisitorInfo& Info) const override;
3967 // End of FProperty interface
3968
3969 UE_API FString GetCPPTypeCustom(FString* ExtendedTypeText, uint32 CPPExportFlags, const FString& KeyTypeText, const FString& InKeyExtendedTypeText, const FString& ValueTypeText, const FString& InValueExtendedTypeText) const;
3970
3971 /*
3972 * Helper function to get the number of key/value pairs inside of a map.
3973 * Used by the garbage collector where for performance reasons the provided map pointer is not guarded
3974 */
3975 int32 GetNum(void* InMap) const
3976 {
3977 return WithScriptMap(InMap, [](auto* Map) { return Map->Num(); });
3978 }
3979
3980 /*
3981 * Helper function to get the sizeof of the map's key/value pair.
3982 * Used by the garbage collector.
3983 */
3985 {
3986 return MapLayout.SetLayout.Size;
3987 }
3988
3989 /*
3990 * Helper function to check if the specified index of a key/value pair in the underlying set is valid.
3991 * Used by the garbage collector where for performance reasons the provided map pointer is not guarded
3992 */
3994 {
3995 return WithScriptMap(InMap, [InternalIndex](auto* Map) { return Map->IsValidIndex(InternalIndex); });
3996 }
3997
3998 /*
3999 * Helper function to get the pointer to a key/value pair at the specified index.
4000 * Used by the garbage collector where for performance reasons the provided map pointer is not guarded
4001 */
4003 {
4004 return WithScriptMap(InMap, [this, InternalIndex](auto* Map) { return (uint8*)Map->GetData(InternalIndex, MapLayout); });
4005 }
4006
4008 {
4009 return KeyProp;
4010 }
4011
4013 {
4014 return ValueProp;
4015 }
4016#if WITH_EDITORONLY_DATA
4017 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
4018#endif
4019
4020 UE_API virtual bool HasIntrusiveUnsetOptionalState() const override;
4021 UE_API virtual void InitializeIntrusiveUnsetOptionalValue(void* Data) const override;
4022 UE_API virtual bool IsIntrusiveOptionalValueSet(const void* Data) const override;
4023 UE_API virtual void ClearIntrusiveOptionalValue(void* Data) const override;
4025};
4026
4027class FSetProperty : public TProperty<FScriptSet, FProperty>
4028{
4030
4031 // Properties representing the key type and value type of the contained pairs
4032 FProperty* ElementProp;
4033 FScriptSetLayout SetLayout;
4034
4035public:
4036 using TTypeFundamentals = Super::TTypeFundamentals;
4037 using TCppType = TTypeFundamentals::TCppType;
4038
4040
4046 UE_API FSetProperty(FFieldVariant InOwner, const UECodeGen_Private::FSetPropertyParams& Prop);
4047
4048#if UE_WITH_CONSTINIT_UOBJECT
4049 explicit consteval FSetProperty(
4050 UE::CodeGen::ConstInit::FPropertyParams InBaseParams,
4054 )
4056 , ElementProp(InElementProperty)
4057 , SetLayout(FScriptSet::GetScriptLayout(InElementPropertySize, InElementPropertyAlignment))
4058 {
4059 }
4060#endif
4061
4062
4063#if WITH_EDITORONLY_DATA
4064 UE_API explicit FSetProperty(UField* InField);
4065#endif // WITH_EDITORONLY_DATA
4066
4067 UE_API virtual ~FSetProperty();
4068
4069 // UObject interface
4070 UE_API virtual void Serialize(FArchive& Ar) override;
4071 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
4072 UE_API virtual void GetPreloadDependencies(TArray<UObject*>& OutDeps) override;
4073 // End of UObject interface
4074
4075 // Field interface
4076 UE_API virtual void PostDuplicate(const FField& InField) override;
4077 UE_API virtual FField* GetInnerFieldByName(const FName& InName) override;
4078 UE_API virtual void GetInnerFields(TArray<FField*>& OutFields) override;
4079
4080 // UField interface
4081 UE_API virtual void AddCppProperty(FProperty* Property) override;
4082 // End of UField interface
4083
4084 // FProperty interface
4085 UE_API virtual FString GetCPPMacroType(FString& ExtendedTypeText) const override;
4086 UE_API virtual FString GetCPPType(FString* ExtendedTypeText, uint32 CPPExportFlags) const override;
4087 UE_API virtual void LinkInternal(FArchive& Ar) override;
4088 UE_API virtual bool Identical(const void* A, const void* B, uint32 PortFlags) const override;
4089 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
4090 UE_API virtual bool NetSerializeItem(FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL) const override;
4091protected:
4092 UE_API virtual void ExportText_Internal(FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const override;
4093 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
4094 UE_API virtual bool ContainsClearOnFinishDestroyInternal(TArray<const FStructProperty*>& EncounteredStructProps) const override;
4095 UE_API virtual void FinishDestroyInternal(void* Data) const override;
4096public:
4097 UE_API virtual void CopyValuesInternal(void* Dest, void const* Src, int32 Count) const override;
4098 UE_API virtual void ClearValueInternal(void* Data) const override;
4099 UE_API virtual void DestroyValueInternal(void* Dest) const override;
4100 UE_API virtual void InstanceSubobjects(void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph) override;
4102 UE_API virtual void EmitReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
4103 UE_API virtual bool SameType(const FProperty* Other) const override;
4104 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
4105 UE_API virtual void* GetValueAddressAtIndex_Direct(const FProperty* Inner, void* InValueAddress, int32 LogicalIndex) const override;
4106 UE_API virtual bool UseBinaryOrNativeSerialization(const FArchive& Ar) const override;
4107 UE_API virtual bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag* Tag = nullptr) override;
4108 UE_API virtual void SaveTypeName(UE::FPropertyTypeNameBuilder& Type) const override;
4109 UE_API virtual bool CanSerializeFromTypeName(UE::FPropertyTypeName Type) const override;
4111 UE_API virtual void* ResolveVisitedPathInfo(void* Data, const FPropertyVisitorInfo& Info) const override;
4112 // End of FProperty interface
4113
4114 UE_API FString GetCPPTypeCustom(FString* ExtendedTypeText, uint32 CPPExportFlags, const FString& ElementTypeText, const FString& InElementExtendedTypeText) const;
4115
4116 /*
4117 * Helper function to get the number of elements inside of a set.
4118 * Used by the garbage collector where for performance reasons the provided set pointer is not guarded
4119 */
4120 int32 GetNum(void* InSet) const
4121 {
4123 return Set->Num();
4124 }
4125
4126 /*
4127 * Helper function to get the size of the set element.
4128 * Used by the garbage collector.
4129 */
4131 {
4132 return SetLayout.Size;
4133 }
4134
4135 /*
4136 * Helper function to check if the specified index of an element is valid.
4137 * Used by the garbage collector where for performance reasons the provided set pointer is not guarded
4138 */
4140 {
4143 }
4144
4145 /*
4146 * Helper function to get the pointer to an element at the specified index.
4147 * Used by the garbage collector where for performance reasons the provided set pointer is not guarded
4148 */
4150 {
4152 return (uint8*)Set->GetData(InternalIndex, SetLayout);
4153 }
4154
4156 {
4157 return ElementProp;
4158 }
4159
4160#if WITH_EDITORONLY_DATA
4161 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
4162#endif
4163
4164 UE_API virtual bool HasIntrusiveUnsetOptionalState() const override;
4165 UE_API virtual void InitializeIntrusiveUnsetOptionalValue(void* Data) const override;
4166 UE_API virtual bool IsIntrusiveOptionalValueSet(const void* Data) const override;
4167 UE_API virtual void ClearIntrusiveOptionalValue(void* Data) const override;
4168 UE_API virtual void EmitIntrusiveOptionalReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
4169};
4170
4175{
4176 enum EInternal { Internal };
4177
4178 template <typename CallableType>
4179 auto WithScriptArray(CallableType&& Callable) const
4180 {
4182 {
4183 return Callable(FreezableArray);
4184 }
4185 else
4186 {
4187 return Callable(HeapArray);
4188 }
4189 }
4190
4191public:
4198 : FScriptArrayHelper(Internal, InProperty->Inner, InArray, InProperty->Inner->GetElementSize(), InProperty->Inner->GetMinAlignment(), InProperty->ArrayFlags)
4199 {
4200 }
4201
4208 {
4209 return Index >= 0 && Index < Num();
4210 }
4215 inline int32 Num() const
4216 {
4217 int32 Result = WithScriptArray([](auto* Array) { return Array->Num(); });
4218 checkSlow(Result >= 0);
4219 return Result;
4220 }
4226 inline int32 NumUnchecked() const
4227 {
4228 int32 Result = WithScriptArray([](auto* Array) { return Array->NumUnchecked(); });
4229 return Result;
4230 }
4237 {
4238 if (!Num())
4239 {
4240 checkSlow(!Index);
4241 return NULL;
4242 }
4243 checkSlow(IsValidIndex(Index));
4244 return (uint8*)WithScriptArray([](auto* Array) { return Array->GetData(); }) + Index * static_cast<size_t>(ElementSize);
4245 }
4253 {
4254 return GetRawPtr(Index);
4255 }
4261 {
4262 check(Count>=0);
4263 checkSlow(Num() >= 0);
4264 EmptyValues(Count);
4265 AddValues(Count);
4266 }
4272 {
4273 check(Count>=0);
4274 checkSlow(Num() >= 0);
4275 EmptyValues(Count);
4276 AddUninitializedValues(Count);
4277 }
4285 {
4286 check(Index>=0);
4287 checkSlow(Num() >= 0);
4288 if (Index >= Num())
4289 {
4290 AddValues(Index - Num() + 1);
4291 return true;
4292 }
4293 return false;
4294 }
4300 {
4301 if (Count < 0)
4302 {
4303 UE::Core::Private::OnInvalidArrayNum(Count);
4304 }
4305
4306 int32 OldNum = Num();
4307 if (Count > OldNum)
4308 {
4309 AddValues(Count - OldNum);
4310 }
4311 else if (Count < OldNum)
4312 {
4313 RemoveValues(Count, OldNum - Count);
4314 }
4315 }
4322 {
4323 const int32 OldNum = AddUninitializedValues(Count);
4325 return OldNum;
4326 }
4332 {
4333 return AddValues(1);
4334 }
4341 {
4342 check(Count>=0);
4343 checkSlow(Num() >= 0);
4344 const int32 OldNum = WithScriptArray([this, Count](auto* Array) { return Array->Add(Count, ElementSize, ElementAlignment); });
4345 return OldNum;
4346 }
4352 {
4353 return AddUninitializedValues(1);
4354 }
4361 {
4362 check(Count>=0);
4363 check(Index>=0 && Index <= Num());
4364 WithScriptArray([this, Index, Count](auto* Array) { Array->Insert(Index, Count, ElementSize, ElementAlignment); });
4366 }
4371 void EmptyValues(int32 Slack = 0)
4372 {
4373 checkSlow(Slack>=0);
4374 const int32 OldNum = NumUnchecked();
4375 if (OldNum)
4376 {
4378 }
4379 if (OldNum || Slack)
4380 {
4381 WithScriptArray([this, Slack](auto* Array) { Array->Empty(Slack, ElementSize, ElementAlignment); });
4382 }
4383 }
4390 {
4391 check(Count>=0);
4392 check(Index>=0 && Index + Count <= Num());
4394 WithScriptArray([this, Index, Count](auto* Array) { Array->Remove(Index, Count, ElementSize, ElementAlignment); });
4395 }
4396
4403 {
4404 check(Count>=0);
4405 check(Index>=0);
4406 ClearItems(Index, Count);
4407 }
4408
4415 {
4416 WithScriptArray([this, A, B](auto* Array) { Array->SwapMemory(A, B, ElementSize); });
4417 }
4418
4425 {
4427 // FScriptArray::MoveAssign does not call destructors for our elements, so do that before calling it.
4428 DestructItems(0, Num());
4429 WithScriptArray([this, InOtherArray](auto* Array) { Array->MoveAssign(*static_cast<decltype(Array)>(InOtherArray), ElementSize, ElementAlignment); });
4430 }
4431
4436 void CountBytes( FArchive& Ar ) const
4437 {
4438 WithScriptArray([this, &Ar](auto* Array) { Array->CountBytes(Ar, ElementSize); });
4439 }
4440
4445 {
4446 WithScriptArray([](auto* Array) { DestructItem(Array); });
4447 }
4448
4453
4454private:
4456 : InnerProperty(InInnerProperty)
4457 , ElementSize(InElementSize)
4458 , ElementAlignment(InElementAlignment)
4459 , ArrayFlags(InArrayFlags)
4460 {
4461 //@todo, we are casting away the const here
4463 {
4464 FreezableArray = (FFreezableScriptArray*)InArray;
4465 }
4466 else
4467 {
4468 HeapArray = (FScriptArray*)InArray;
4469 }
4470
4471 check(ElementSize > 0);
4472 check(InnerProperty);
4473 }
4474
4481 {
4482 checkSlow(Count >= 0);
4483 checkSlow(Index >= 0);
4484 checkSlow(Index <= Num());
4485 checkSlow(Index + Count <= Num());
4486 if (Count > 0)
4487 {
4488 uint8* Dest = GetRawPtr(Index);
4489 if (InnerProperty->PropertyFlags & CPF_ZeroConstructor)
4490 {
4491 FMemory::Memzero(Dest, Count * static_cast<size_t>(ElementSize));
4492 }
4493 else
4494 {
4495 for (int32 LoopIndex = 0; LoopIndex < Count; LoopIndex++, Dest += ElementSize)
4496 {
4497 InnerProperty->InitializeValue(Dest);
4498 }
4499 }
4500 }
4501 }
4508 {
4509 if (!(InnerProperty->PropertyFlags & (CPF_IsPlainOldData | CPF_NoDestructor)))
4510 {
4511 checkSlow(Count >= 0);
4512 checkSlow(Index >= 0);
4513 checkSlow(Index + Count <= Num());
4514 if (Count > 0)
4515 {
4516 uint8* Dest = GetRawPtr(Index);
4517 for (int32 LoopIndex = 0; LoopIndex < Count; LoopIndex++, Dest += ElementSize)
4518 {
4519 InnerProperty->DestroyValue(Dest);
4520 }
4521 }
4522 }
4523 }
4529 void ClearItems(int32 Index, int32 Count)
4530 {
4531 checkSlow(Count >= 0);
4532 checkSlow(Index >= 0);
4533 checkSlow(Index < Num());
4534 checkSlow(Index + Count <= Num());
4535 if (Count > 0)
4536 {
4537 uint8* Dest = GetRawPtr(Index);
4538 if ((InnerProperty->PropertyFlags & (CPF_ZeroConstructor | CPF_NoDestructor)) == (CPF_ZeroConstructor | CPF_NoDestructor))
4539 {
4540 FMemory::Memzero(Dest, Count * static_cast<size_t>(ElementSize));
4541 }
4542 else
4543 {
4544 for (int32 LoopIndex = 0; LoopIndex < Count; LoopIndex++, Dest += ElementSize)
4545 {
4546 InnerProperty->ClearValue(Dest);
4547 }
4548 }
4549 }
4550 }
4551
4552 const FProperty* InnerProperty;
4553 union
4554 {
4557 };
4558 int32 ElementSize;
4559 uint32 ElementAlignment;
4560 EArrayPropertyFlags ArrayFlags;
4561};
4562
4576
4586template<typename ContainerType>
4588{
4590 {
4591 Advance();
4592 }
4593
4595 {
4596 const int32 MaxIndex = Container.GetMaxIndex();
4597 if (MaxIndex == Container.Num())
4598 {
4600 LogicalIndex = InLogicalIndex;
4601 return;
4602 }
4603
4604 do
4605 {
4606 Advance();
4607 }
4608 while (LogicalIndex < InLogicalIndex && InternalIndex < MaxIndex);
4609 }
4610
4612 {
4613 Advance();
4614 return *this;
4615 }
4616
4618 {
4619 const TScriptContainerIterator Temp(*this);
4620 Advance();
4621 return Temp;
4622 }
4623
4624 explicit operator bool() const
4625 {
4626 return Container.IsValidIndex(InternalIndex);
4627 }
4628
4630 {
4631 return InternalIndex;
4632 }
4633
4635 {
4636 return LogicalIndex;
4637 }
4638
4639 UE_DEPRECATED(5.4, "Use Iterator directly, GetInternalIndex or GetLogicalIndex instead.")
4640 int32 operator*() const
4641 {
4642 return InternalIndex;
4643 }
4644
4645private:
4646 const ContainerType& Container;
4648 int32 LogicalIndex = INDEX_NONE;
4649
4650 void Advance()
4651 {
4652 ++InternalIndex;
4653 const int32 MaxIndex = Container.GetMaxIndex();
4654 while (InternalIndex < MaxIndex && !Container.IsValidIndex(InternalIndex))
4655 {
4656 ++InternalIndex;
4657 }
4658
4659 ++LogicalIndex;
4660 }
4661};
4662
4678{
4679 enum EInternal { Internal };
4680
4681 friend class FMapProperty;
4682
4683 template <typename CallableType>
4684 auto WithScriptMap(CallableType&& Callable) const
4685 {
4687 {
4688 return Callable(FreezableMap);
4689 }
4690 else
4691 {
4692 return Callable(HeapMap);
4693 }
4694 }
4695
4696public:
4704 : FScriptMapHelper(Internal, InProperty->KeyProp, InProperty->ValueProp, InMap, InProperty->MapLayout, InProperty->MapFlags)
4705 {
4706 }
4707
4712
4714
4716 {
4717 return FIterator(*this);
4718 }
4719
4721 {
4722 return FIterator(*this, InLogicalIndex);
4723 }
4724
4733 {
4734 return WithScriptMap([InternalIndex](auto* Map) { return Map->IsValidIndex(InternalIndex); });
4735 }
4736
4742 inline int32 Num() const
4743 {
4744 int32 Result = WithScriptMap([](auto* Map) { return Map->Num(); });
4745 checkSlow(Result >= 0);
4746 return Result;
4747 }
4748
4754 inline int32 NumUnchecked() const
4755 {
4756 int32 Result = WithScriptMap([](auto* Map) { return Map->NumUnchecked(); });
4757 checkSlow(Result >= 0);
4758 return Result;
4759 }
4760
4766 inline int32 GetMaxIndex() const
4767 {
4768 return WithScriptMap([](auto* Map)
4769 {
4770 int32 Result = Map->GetMaxIndex();
4771 checkSlow(Result >= Map->Num());
4772 return Result;
4773 });
4774 }
4775
4784 {
4785 return WithScriptMap([this, InternalIndex](auto* Map) -> uint8*
4786 {
4787 if (Map->Num() == 0)
4788 {
4789 checkf(InternalIndex == 0, TEXT("Legacy implementation was only allowing requesting InternalIndex 0 on an empty container."));
4790 return nullptr;
4791 }
4792
4793 checkf(IsValidIndex(InternalIndex), TEXT("Invalid internal index. Use IsValidIndex before calling this method."));
4794 return (uint8*)Map->GetData(InternalIndex, MapLayout);
4795 });
4796 }
4797
4806 {
4807 return const_cast<FScriptMapHelper*>(this)->GetPairPtr(InternalIndex);
4808 }
4809
4820 {
4821 return WithScriptMap([this, InternalIndex](auto* Map) -> uint8*
4822 {
4823 if (Map->Num() == 0)
4824 {
4825 checkf(InternalIndex == 0, TEXT("Legacy implementation was only allowing requesting InternalIndex 0 on an empty container."));
4826 return nullptr;
4827 }
4828
4829 checkf(IsValidIndex(InternalIndex), TEXT("Invalid internal index. Use IsValidIndex before calling this method."));
4830 return (uint8*)Map->GetData(InternalIndex, MapLayout);
4831 });
4832 }
4833
4842 {
4843 return WithScriptMap([this, InternalIndex](auto* Map) -> uint8*
4844 {
4845 if (Map->Num() == 0)
4846 {
4847 checkf(InternalIndex == 0, TEXT("Legacy implementation was only allowing requesting InternalIndex 0 on an empty container."));
4848 return nullptr;
4849 }
4850
4851 checkf(IsValidIndex(InternalIndex), TEXT("Invalid internal index. Use IsValidIndex before calling this method."));
4852 return (uint8*)Map->GetData(InternalIndex, MapLayout) + MapLayout.ValueOffset;
4853 });
4854 }
4855
4863 inline uint8* GetPairPtr(const FIterator Iterator)
4864 {
4865 return WithScriptMap([this, Iterator](auto* Map) -> uint8*
4866 {
4867 checkf(Iterator, TEXT("Invalid Iterator. Test Iterator before calling this method."));
4868 return (uint8*)Map->GetData(Iterator.GetInternalIndex(), MapLayout);
4869 });
4870 }
4871
4879 UE_FORCEINLINE_HINT const uint8* GetPairPtr(const FIterator Iterator) const
4880 {
4881 return const_cast<FScriptMapHelper*>(this)->GetPairPtr(Iterator);
4882 }
4883
4893 inline uint8* GetKeyPtr(const FIterator Iterator)
4894 {
4895 return WithScriptMap([this, Iterator](auto* Map) -> uint8*
4896 {
4897 checkf(Iterator, TEXT("Invalid Iterator. Test Iterator before calling this method."));
4898 return (uint8*)Map->GetData(Iterator.GetInternalIndex(), MapLayout);
4899 });
4900 }
4901
4911 UE_FORCEINLINE_HINT const uint8* GetKeyPtr(const FIterator Iterator) const
4912 {
4913 return const_cast<FScriptMapHelper*>(this)->GetKeyPtr(Iterator);
4914 }
4915
4923 inline uint8* GetValuePtr(const FIterator Iterator)
4924 {
4925 return WithScriptMap([this, Iterator](auto* Map) -> uint8*
4926 {
4927 checkf(Iterator, TEXT("Invalid Iterator. Test Iterator before calling this method."));
4928 return (uint8*)Map->GetData(Iterator.GetInternalIndex(), MapLayout) + MapLayout.ValueOffset;
4929 });
4930 }
4931
4939 UE_FORCEINLINE_HINT const uint8* GetValuePtr(const FIterator Iterator) const
4940 {
4941 return const_cast<FScriptMapHelper*>(this)->GetValuePtr(Iterator);
4942 }
4943
4951 {
4952 const int32 InternalIndex = FindInternalIndex(N);
4953 return (InternalIndex != INDEX_NONE) ? GetPairPtrWithoutCheck(InternalIndex) : nullptr;
4954 }
4955
4963 {
4964 const int32 InternalIndex = FindInternalIndex(N);
4965 return (InternalIndex != INDEX_NONE) ? GetKeyPtrWithoutCheck(InternalIndex) : nullptr;
4966 }
4967
4975 {
4976 const int32 InternalIndex = FindInternalIndex(N);
4977 return (InternalIndex != INDEX_NONE) ? GetValuePtrWithoutCheck(InternalIndex) : nullptr;
4978 }
4979
4987 {
4988 const int32 InternalIndex = FindInternalIndex(N);
4989 return (InternalIndex != INDEX_NONE) ? GetPairPtrWithoutCheck(InternalIndex) : nullptr;
4990 }
4991
4999 {
5001 // FScriptArray::MoveAssign does not call destructors for our elements, so do that before calling it.
5002 DestructItems(0, Num());
5003 return WithScriptMap([this, InOtherMap](auto* Map)
5004 {
5005 Map->MoveAssign(*(decltype(Map))InOtherMap, MapLayout);
5006 });
5007 }
5008
5015 {
5016 return WithScriptMap([this](auto* Map)
5017 {
5018 checkSlow(Map->Num() >= 0);
5019
5020 return Map->AddUninitialized(MapLayout);
5021 });
5022 }
5023
5028 void EmptyValues(int32 Slack = 0)
5029 {
5030 checkSlow(Slack >= 0);
5031
5032 int32 OldNum = NumUnchecked();
5033 if (OldNum)
5034 {
5036 }
5037 if (OldNum || Slack)
5038 {
5039 return WithScriptMap([this, Slack](auto* Map)
5040 {
5041 Map->Empty(Slack, MapLayout);
5042 });
5043 }
5044 }
5045
5053 {
5054 return WithScriptMap([this](auto* Map)
5055 {
5056 checkSlow(Map->Num() >= 0);
5057
5058 int32 Result = Map->AddUninitialized(MapLayout);
5059 ConstructItem(Result);
5060
5061 return Result;
5062 });
5063 }
5064
5071 {
5072 return KeyProp;
5073 }
5074
5081 {
5082 return ValueProp;
5083 }
5084
5091 {
5092 return WithScriptMap([this, InternalIndex, Count](auto* Map)
5093 {
5094 check(Map->IsValidIndex(InternalIndex));
5095
5096 // Checking against max as sparse sets may want to remove a range including invalid items, so num is not a correct validation here
5098
5099#if UE_USE_COMPACT_SET_AS_DEFAULT
5100 auto GetHashKey = [this](const void* ElementKey)
5101 {
5102 return KeyProp->GetValueTypeHash(ElementKey);
5103 };
5104
5105 auto DestroyElement = [this](void* Element)
5106 {
5108 {
5109 KeyProp->DestroyValue(Element);
5110 }
5111 void* ValuePtr = (uint8*)Element + MapLayout.ValueOffset;
5112 if (!(ValueProp->PropertyFlags & (CPF_IsPlainOldData | CPF_NoDestructor)))
5113 {
5114 ValueProp->DestroyValue(ValuePtr);
5115 }
5116 };
5117
5118 // Last element will get swapped into current spot, so go in reverse so everything moves safely
5120 {
5121 Map->RemoveAt(Index, MapLayout, GetHashKey, DestroyElement);
5122 }
5123#else
5125 for (int32 LocalCount = Count, LocalIndex = InternalIndex; LocalCount; ++LocalIndex)
5126 {
5127 if (Map->IsValidIndex(LocalIndex))
5128 {
5129 Map->RemoveAt(LocalIndex, MapLayout);
5130 --LocalCount;
5131 }
5132 }
5133#endif
5134 });
5135 }
5136
5141 COREUOBJECT_API void Rehash();
5142
5149 {
5150 return WithScriptMap([this, LogicalIdx](auto* Map) -> int32
5151 {
5154 {
5155 return INDEX_NONE;
5156 }
5157
5158 // if map is compact, use random access
5159 if (Num() == GetMaxIndex())
5160 {
5161 return IsValidIndex(LogicalIdx) ? LogicalIdx : INDEX_NONE;
5162 }
5163
5164 int32 MaxIndex = Map->GetMaxIndex();
5165 for (int32 Actual = 0; Actual < MaxIndex; ++Actual)
5166 {
5167 if (Map->IsValidIndex(Actual))
5168 {
5169 if (LocalLogicalIdx == 0)
5170 {
5171 return Actual;
5172 }
5174 }
5175 }
5176 return INDEX_NONE;
5177 });
5178 }
5179
5186 {
5187 return WithScriptMap([this, InternalIdx](auto* Map) -> int32
5188 {
5189 if( !IsValidIndex(InternalIdx) )
5190 {
5191 return INDEX_NONE;
5192 }
5193
5194 // if map is compact, use random access
5195 if (GetMaxIndex() == Num())
5196 {
5197 return InternalIdx;
5198 }
5199
5200 int32 LogicalIndex = InternalIdx;
5201 for (int i = 0; i < InternalIdx; ++i)
5202 {
5203 if (!IsValidIndex(i))
5204 {
5205 LogicalIndex--;
5206 }
5207 }
5208
5209 return LogicalIndex;
5210 });
5211 }
5212
5213
5223 {
5224 return WithScriptMap([this, PairWithKeyToFind, &IndexHint](auto* Map) -> int32
5225 {
5226 int32 MapMax = Map->GetMaxIndex();
5227 if (MapMax == 0)
5228 {
5229 return INDEX_NONE;
5230 }
5231
5232 if (IndexHint >= MapMax)
5233 {
5234 IndexHint = 0;
5235 }
5236
5237 check(IndexHint >= 0);
5238
5239 FProperty* LocalKeyProp = this->KeyProp; // prevent aliasing in loop below
5240
5242 for (;;)
5243 {
5244 if (Map->IsValidIndex(InternalIndex))
5245 {
5246 const void* PairToSearch = Map->GetData(InternalIndex, MapLayout);
5248 {
5249 return InternalIndex;
5250 }
5251 }
5252
5253 ++InternalIndex;
5254 if (InternalIndex == MapMax)
5255 {
5256 InternalIndex = 0;
5257 }
5258
5259 if (InternalIndex == IndexHint)
5260 {
5261 return INDEX_NONE;
5262 }
5263 }
5264 });
5265 }
5266
5276 {
5277 const int32 InternalIndex = FindMapIndexWithKey(PairWithKeyToFind, IndexHint);
5278 uint8* Result = (InternalIndex >= 0) ? GetPairPtrWithoutCheck(InternalIndex) : nullptr;
5279 return Result;
5280 }
5281
5284 {
5285 const int32 InternalIndex = WithScriptMap([this, KeyPtr, LocalKeyPropForCapture = this->KeyProp](auto* Map)
5286 {
5287 return Map->FindPairIndex(
5288 KeyPtr,
5289 MapLayout,
5290 [LocalKeyPropForCapture](const void* ElementKey) { return LocalKeyPropForCapture->GetValueTypeHash(ElementKey); },
5291 [LocalKeyPropForCapture](const void* A, const void* B) { return LocalKeyPropForCapture->Identical(A, B); }
5292 );
5293 });
5294 return InternalIndex;
5295 }
5296
5299 {
5300 const int32 InternalIndex = FindMapPairIndexFromHash(KeyPtr);
5301 uint8* Result = (InternalIndex >= 0) ? GetPairPtrWithoutCheck(InternalIndex) : nullptr;
5302 return Result;
5303 }
5304
5307 {
5308 return WithScriptMap([this, KeyPtr, LocalKeyPropForCapture = this->KeyProp](auto* Map)
5309 {
5310 return Map->FindValue(
5311 KeyPtr,
5312 MapLayout,
5313 [LocalKeyPropForCapture](const void* ElementKey) { return LocalKeyPropForCapture->GetValueTypeHash(ElementKey); },
5314 [LocalKeyPropForCapture](const void* A, const void* B) { return LocalKeyPropForCapture->Identical(A, B); }
5315 );
5316 });
5317 }
5318
5320 void AddPair(const void* KeyPtr, const void* ValuePtr)
5321 {
5322 return WithScriptMap([this, KeyPtr, ValuePtr, LocalKeyPropForCapture = this->KeyProp, LocalValuePropForCapture = this->ValueProp](auto* Map)
5323 {
5324 Map->Add(
5325 KeyPtr,
5326 ValuePtr,
5327 MapLayout,
5328 [LocalKeyPropForCapture](const void* ElementKey) { return LocalKeyPropForCapture->GetValueTypeHash(ElementKey); },
5329 [LocalKeyPropForCapture](const void* A, const void* B) { return LocalKeyPropForCapture->Identical(A, B); },
5331 {
5332 if (LocalKeyPropForCapture->PropertyFlags & CPF_ZeroConstructor)
5333 {
5335 }
5336 else
5337 {
5338 LocalKeyPropForCapture->InitializeValue(NewElementKey);
5339 }
5340
5341 LocalKeyPropForCapture->CopySingleValueToScriptVM(NewElementKey, KeyPtr);
5342 },
5343 [LocalValuePropForCapture, ValuePtr](void* NewElementValue)
5344 {
5345 if (LocalValuePropForCapture->PropertyFlags & CPF_ZeroConstructor)
5346 {
5348 }
5349 else
5350 {
5351 LocalValuePropForCapture->InitializeValue(NewElementValue);
5352 }
5353
5354 LocalValuePropForCapture->CopySingleValueToScriptVM(NewElementValue, ValuePtr);
5355 },
5357 {
5358 LocalValuePropForCapture->CopySingleValueToScriptVM(ExistingElementValue, ValuePtr);
5359 },
5361 {
5363 {
5364 LocalKeyPropForCapture->DestroyValue(ElementKey);
5365 }
5366 },
5368 {
5370 {
5372 }
5373 }
5374 );
5375 });
5376 }
5377
5378
5386 void* FindOrAdd(const void* KeyPtr)
5387 {
5388 return WithScriptMap([this, KeyPtr, LocalKeyPropForCapture = this->KeyProp, LocalValuePropForCapture = this->ValueProp](auto* Map)
5389 {
5390 return Map->FindOrAdd(
5391 KeyPtr,
5392 MapLayout,
5393 [LocalKeyPropForCapture](const void* ElementKey) { return LocalKeyPropForCapture->GetValueTypeHash(ElementKey); },
5394 [LocalKeyPropForCapture](const void* A, const void* B) { return LocalKeyPropForCapture->Identical(A, B); },
5396 {
5397 if (LocalKeyPropForCapture->PropertyFlags & CPF_ZeroConstructor)
5398 {
5400 }
5401 else
5402 {
5403 LocalKeyPropForCapture->InitializeValue(NewElementKey);
5404 }
5405
5406 LocalKeyPropForCapture->CopySingleValue(NewElementKey, KeyPtr);
5407
5408 if (LocalValuePropForCapture->PropertyFlags & CPF_ZeroConstructor)
5409 {
5411 }
5412 else
5413 {
5414 LocalValuePropForCapture->InitializeValue(NewElementValue);
5415 }
5416 }
5417 );
5418 });
5419 }
5420
5421
5423 bool RemovePair(const void* KeyPtr)
5424 {
5425 return WithScriptMap([this, KeyPtr, LocalKeyPropForCapture = this->KeyProp](auto* Map)
5426 {
5427 if (uint8* Entry = Map->FindValue(
5428 KeyPtr,
5429 MapLayout,
5430 [LocalKeyPropForCapture](const void* ElementKey) { return LocalKeyPropForCapture->GetValueTypeHash(ElementKey); },
5431 [LocalKeyPropForCapture](const void* A, const void* B) { return LocalKeyPropForCapture->Identical(A, B); }
5432 ))
5433 {
5434 int32 Idx = (int32)((Entry - (uint8*)Map->GetData(0, MapLayout)) / MapLayout.SetLayout.Size);
5435 RemoveAt(Idx);
5436 return true;
5437 }
5438 else
5439 {
5440 return false;
5441 }
5442 });
5443 }
5444
5456
5457private:
5459 : KeyProp (InKeyProp)
5460 , ValueProp(InValueProp)
5461 , MapLayout(InMapLayout)
5462 , MapFlags (InMapFlags)
5463 {
5465
5466 //@todo, we are casting away the const here
5468 {
5469 FreezableMap = (FFreezableScriptMap*)InMap;
5470 }
5471 else
5472 {
5473 HeapMap = (FScriptMap*)InMap;
5474 }
5475
5476 check(KeyProp && ValueProp);
5477 }
5478
5485 void ConstructItem(int32 InternalIndex)
5486 {
5487 check(IsValidIndex(InternalIndex));
5488
5489 bool bZeroKey = !!(KeyProp ->PropertyFlags & CPF_ZeroConstructor);
5490 bool bZeroValue = !!(ValueProp->PropertyFlags & CPF_ZeroConstructor);
5491
5492 void* Dest = WithScriptMap([this, InternalIndex](auto* Map) { return Map->GetData(InternalIndex, MapLayout); });
5493
5494 if (bZeroKey || bZeroValue)
5495 {
5496 // If any nested property needs zeroing, just pre-zero the whole space
5497 FMemory::Memzero(Dest, MapLayout.SetLayout.Size);
5498 }
5499
5500 if (!bZeroKey)
5501 {
5502 KeyProp->InitializeValue_InContainer(Dest);
5503 }
5504
5505 if (!bZeroValue)
5506 {
5507 ValueProp->InitializeValue_InContainer(Dest);
5508 }
5509 }
5510
5515 {
5516 check(InternalIndex >= 0);
5517 check(Count >= 0);
5518
5519 if (Count == 0)
5520 {
5521 return;
5522 }
5523
5526
5528 {
5529 uint32 Stride = MapLayout.SetLayout.Size;
5530 uint8* PairPtr = WithScriptMap([this, InternalIndex](auto* Map) { return (uint8*)Map->GetData(InternalIndex, MapLayout); });
5531 if (bDestroyKeys)
5532 {
5533 if (bDestroyValues)
5534 {
5535 for (; Count; ++InternalIndex)
5536 {
5537 if (IsValidIndex(InternalIndex))
5538 {
5541 --Count;
5542 }
5543 PairPtr += Stride;
5544 }
5545 }
5546 else
5547 {
5548 for (; Count; ++InternalIndex)
5549 {
5550 if (IsValidIndex(InternalIndex))
5551 {
5553 --Count;
5554 }
5555 PairPtr += Stride;
5556 }
5557 }
5558 }
5559 else
5560 {
5561 for (; Count; ++InternalIndex)
5562 {
5563 if (IsValidIndex(InternalIndex))
5564 {
5566 --Count;
5567 }
5568 PairPtr += Stride;
5569 }
5570 }
5571 }
5572 }
5573
5581 UE_FORCEINLINE_HINT uint8* GetPairPtrWithoutCheck(int32 InternalIndex)
5582 {
5583 return WithScriptMap([this, InternalIndex](auto* Map) { return (uint8*)Map->GetData(InternalIndex, MapLayout); });
5584 }
5585
5593 UE_FORCEINLINE_HINT const uint8* GetPairPtrWithoutCheck(int32 InternalIndex) const
5594 {
5595 return const_cast<FScriptMapHelper*>(this)->GetPairPtrWithoutCheck(InternalIndex);
5596 }
5597
5605 UE_FORCEINLINE_HINT uint8* GetKeyPtrWithoutCheck(int32 InternalIndex)
5606 {
5607 return WithScriptMap([this, InternalIndex](auto* Map) { return (uint8*)Map->GetData(InternalIndex, MapLayout); });
5608 }
5609
5617 UE_FORCEINLINE_HINT const uint8* GetKeyPtrWithoutCheck(int32 InternalIndex) const
5618 {
5619 return const_cast<FScriptMapHelper*>(this)->GetKeyPtrWithoutCheck(InternalIndex);
5620 }
5621
5629 UE_FORCEINLINE_HINT uint8* GetValuePtrWithoutCheck(int32 InternalIndex)
5630 {
5631 return WithScriptMap([this, InternalIndex](auto* Map) { return (uint8*)Map->GetData(InternalIndex, MapLayout) + MapLayout.ValueOffset; });
5632 }
5633
5641 UE_FORCEINLINE_HINT const uint8* GetValuePtrWithoutCheck(int32 InternalIndex) const
5642 {
5643 return const_cast<FScriptMapHelper*>(this)->GetValuePtrWithoutCheck(InternalIndex);
5644 }
5645
5646public:
5649 union
5650 {
5653 };
5656};
5657
5666
5682{
5683 friend class FSetProperty;
5684
5685public:
5686
5688
5690 {
5691 return FIterator(*this);
5692 }
5693
5695 {
5696 return FIterator(*this, InLogicalIndex);
5697 }
5698
5706 : FScriptSetHelper(InProperty->ElementProp, InSet, InProperty->SetLayout)
5707 {
5708 }
5709
5711 : ElementProp(InElementProp)
5712 , Set((FScriptSet*)InSet) //@todo, we are casting away the const here
5713 , SetLayout(InLayout)
5714 {
5715 check(ElementProp);
5716 }
5717
5726 {
5727 return Set->IsValidIndex(InternalIndex);
5728 }
5729
5735 inline int32 Num() const
5736 {
5737 const int32 Result = Set->Num();
5738 checkSlow(Result >= 0);
5739 return Result;
5740 }
5741
5747 inline int32 NumUnchecked() const
5748 {
5749 const int32 Result = Set->NumUnchecked();
5750 return Result;
5751 }
5752
5758 inline int32 GetMaxIndex() const
5759 {
5760 const int32 Result = Set->GetMaxIndex();
5761 checkSlow(Result >= Num());
5762 return Result;
5763 }
5764
5772 static inline int32 Num(const void* Target)
5773 {
5774 const int32 Result = ((const FScriptSet*)Target)->Num();
5775 checkSlow(Result >= 0);
5776 return Result;
5777 }
5778
5787 {
5788 if (Num() == 0)
5789 {
5790 checkf(InternalIndex == 0, TEXT("Legacy implementation was only allowing requesting InternalIndex 0 on an empty container."));
5791 return nullptr;
5792 }
5793
5794 checkf(IsValidIndex(InternalIndex), TEXT("Invalid internal index. Use IsValidIndex before calling this method."));
5795 return (uint8*)Set->GetData(InternalIndex, SetLayout);
5796 }
5797
5806 {
5807 return const_cast<FScriptSetHelper*>(this)->GetElementPtr(InternalIndex);
5808 }
5809
5817 inline uint8* GetElementPtr(const FIterator Iterator)
5818 {
5819 checkf(Iterator, TEXT("Invalid Iterator. Test Iterator before calling this method."));
5820 return (uint8*)Set->GetData(Iterator.GetInternalIndex(), SetLayout);
5821 }
5822
5831 {
5832 return const_cast<FScriptSetHelper*>(this)->GetElementPtr(Iterator);
5833 }
5834
5842 {
5843 const int32 InternalIndex = FindInternalIndex(N);
5844 return (InternalIndex != INDEX_NONE) ? GetElementPtrWithoutCheck(InternalIndex) : nullptr;
5845 }
5846
5854 {
5855 const int32 InternalIndex = FindInternalIndex(N);
5856 return (InternalIndex != INDEX_NONE) ? GetElementPtrWithoutCheck(InternalIndex) : nullptr;
5857 }
5858
5866 {
5869 Set->MoveAssign(*OtherSet, SetLayout);
5870 }
5871
5878 {
5879 checkSlow(Num() >= 0);
5880
5881 return Set->AddUninitialized(SetLayout);
5882 }
5883
5888 void EmptyElements(int32 Slack = 0)
5889 {
5890 checkSlow(Slack >= 0);
5891
5892 int32 OldNum = NumUnchecked();
5893 if (OldNum)
5894 {
5896 }
5897 if (OldNum || Slack)
5898 {
5899 Set->Empty(Slack, SetLayout);
5900 }
5901 }
5902
5910 {
5911 checkSlow(Num() >= 0);
5912
5913 int32 Result = AddUninitializedValue();
5914 ConstructItem(Result);
5915
5916 return Result;
5917 }
5918
5923 {
5924 return ElementProp;
5925 }
5926
5933 {
5934 check(IsValidIndex(InternalIndex));
5935
5936 // Checking against max as sparse sets may want to remove a range including invalid items, so num is not a correct validation here
5938
5939#if UE_USE_COMPACT_SET_AS_DEFAULT
5940 auto GetHashKey = [this](const void* ElementKey)
5941 {
5942 return ElementProp->GetValueTypeHash(ElementKey);
5943 };
5944
5945 auto DestroyElement = [this](void* Element)
5946 {
5947 if (!(ElementProp->PropertyFlags & (CPF_IsPlainOldData | CPF_NoDestructor)))
5948 {
5949 ElementProp->DestroyValue(Element);
5950 }
5951 };
5952
5953 // Last element will get swapped into current spot, so go in reverse so everything moves safely
5955 {
5956 Set->RemoveAt(Index, SetLayout, GetHashKey, DestroyElement);
5957 }
5958#else
5960 for (; Count; ++InternalIndex)
5961 {
5962 if (IsValidIndex(InternalIndex))
5963 {
5964 Set->RemoveAt(InternalIndex, SetLayout);
5965 --Count;
5966 }
5967 }
5968#endif
5969 }
5970
5975 COREUOBJECT_API void Rehash();
5976
5983 {
5985 {
5986 return INDEX_NONE;
5987 }
5988
5989 // if set is compact, use random access
5990 if (Num() == GetMaxIndex())
5991 {
5992 return IsValidIndex(LogicalIdx) ? LogicalIdx : INDEX_NONE;
5993 }
5994
5995 int32 MaxIndex = GetMaxIndex();
5996 for (int32 Actual = 0; Actual < MaxIndex; ++Actual)
5997 {
5998 if (IsValidIndex(Actual))
5999 {
6000 if (LogicalIdx == 0)
6001 {
6002 return Actual;
6003 }
6004 --LogicalIdx;
6005 }
6006 }
6007 return INDEX_NONE;
6008 }
6009
6016 {
6017 if (!IsValidIndex(InternalIdx))
6018 {
6019 return INDEX_NONE;
6020 }
6021
6022 // if set is compact, use random access
6023 if (GetMaxIndex() == Num())
6024 {
6025 return InternalIdx;
6026 }
6027
6028 int32 LogicalIndex = InternalIdx;
6029 for (int i = 0; i < InternalIdx; ++i)
6030 {
6031 if (!IsValidIndex(i))
6032 {
6033 LogicalIndex--;
6034 }
6035 }
6036
6037 return LogicalIndex;
6038 }
6039
6049 {
6050 const int32 SetMax = GetMaxIndex();
6051 if (SetMax == 0)
6052 {
6053 return INDEX_NONE;
6054 }
6055
6056 if (IndexHint >= SetMax)
6057 {
6058 IndexHint = 0;
6059 }
6060
6061 check(IndexHint >= 0);
6062
6063 FProperty* LocalKeyProp = this->ElementProp; // prevent aliasing in loop below
6064
6066 for (;;)
6067 {
6068 if (IsValidIndex(InternalIndex))
6069 {
6070 const void* ElementToCheck = GetElementPtrWithoutCheck(InternalIndex);
6071 if (LocalKeyProp->Identical(ElementToFind, ElementToCheck))
6072 {
6073 return InternalIndex;
6074 }
6075 }
6076
6077 ++InternalIndex;
6078 if (InternalIndex == SetMax)
6079 {
6080 InternalIndex = 0;
6081 }
6082
6083 if (InternalIndex == IndexHint)
6084 {
6085 return INDEX_NONE;
6086 }
6087 }
6088 }
6089
6099 {
6100 const int32 InternalIndex = FindElementIndex(ElementToFind, IndexHint);
6101 uint8* Result = (InternalIndex >= 0 ? GetElementPtrWithoutCheck(InternalIndex) : nullptr);
6102 return Result;
6103 }
6104
6107 {
6109 return Set->FindIndex(
6111 SetLayout,
6112 [LocalElementPropForCapture](const void* Element) { return LocalElementPropForCapture->GetValueTypeHash(Element); },
6113 [LocalElementPropForCapture](const void* A, const void* B) { return LocalElementPropForCapture->Identical(A, B); }
6114 );
6115 }
6116
6119 {
6120 const int32 InternalIndex = FindElementIndexFromHash(ElementToFind);
6121 uint8* Result = (InternalIndex >= 0 ? GetElementPtrWithoutCheck(InternalIndex) : nullptr);
6122 return Result;
6123 }
6124
6126 void AddElement(const void* ElementToAdd)
6127 {
6130 Set->Add(
6132 SetLayout,
6133 [LocalElementPropForCapture](const void* Element) { return LocalElementPropForCapture->GetValueTypeHash(Element); },
6134 [LocalElementPropForCapture](const void* A, const void* B) { return LocalElementPropForCapture->Identical(A, B); },
6136 {
6138 {
6140 }
6141 else
6142 {
6143 LocalElementPropForCapture->InitializeValue(NewElement);
6144 }
6145
6146 LocalElementPropForCapture->CopySingleValueToScriptVM(NewElement, ElementToAdd);
6147 },
6148 [LocalElementPropForCapture](void* Element)
6149 {
6151 {
6152 LocalElementPropForCapture->DestroyValue(Element);
6153 }
6154 }
6155 );
6156 }
6157
6160 {
6162 int32 FoundIndex = Set->FindIndex(
6164 SetLayout,
6165 [LocalElementPropForCapture](const void* Element) { return LocalElementPropForCapture->GetValueTypeHash(Element); },
6166 [LocalElementPropForCapture](const void* A, const void* B) { return LocalElementPropForCapture->Identical(A, B); }
6167 );
6168 if (FoundIndex != INDEX_NONE)
6169 {
6170 RemoveAt(FoundIndex);
6171 return true;
6172 }
6173 else
6174 {
6175 return false;
6176 }
6177 }
6178
6193
6194private:
6196 : ElementProp(nullptr)
6197 , Set(nullptr)
6198 , SetLayout(FScriptSet::GetScriptLayout(0, 1))
6199 {}
6200
6207 void ConstructItem(int32 InternalIndex)
6208 {
6209 check(IsValidIndex(InternalIndex));
6210
6211 bool bZeroElement = !!(ElementProp->PropertyFlags & CPF_ZeroConstructor);
6212 uint8* Dest = GetElementPtrWithoutCheck(InternalIndex);
6213
6214 if (bZeroElement)
6215 {
6216 // If any nested property needs zeroing, just pre-zero the whole space
6217 FMemory::Memzero(Dest, SetLayout.Size);
6218 }
6219
6220 if (!bZeroElement)
6221 {
6222 ElementProp->InitializeValue_InContainer(Dest);
6223 }
6224 }
6225
6230 {
6231 check(InternalIndex >= 0);
6232 check(Count >= 0);
6233
6234 if (Count == 0)
6235 {
6236 return;
6237 }
6238
6240
6241 if (bDestroyElements)
6242 {
6243 uint32 Stride = SetLayout.Size;
6244 uint8* ElementPtr = GetElementPtrWithoutCheck(InternalIndex);
6245
6246 for (; Count; ++InternalIndex)
6247 {
6248 if (IsValidIndex(InternalIndex))
6249 {
6251 --Count;
6252 }
6253 ElementPtr += Stride;
6254 }
6255 }
6256 }
6257
6265 UE_FORCEINLINE_HINT uint8* GetElementPtrWithoutCheck(int32 InternalIndex)
6266 {
6267 return (uint8*)Set->GetData(InternalIndex, SetLayout);
6268 }
6269
6277 UE_FORCEINLINE_HINT const uint8* GetElementPtrWithoutCheck(int32 InternalIndex) const
6278 {
6279 return const_cast<FScriptSetHelper*>(this)->GetElementPtrWithoutCheck(InternalIndex);
6280 }
6281
6282public:
6286};
6287
6296
6297/*-----------------------------------------------------------------------------
6298 FStructProperty.
6299-----------------------------------------------------------------------------*/
6300
6301//
6302// Describes a structure variable embedded in (as opposed to referenced by)
6303// an object.
6304//
6306{
6308
6309 // Variables.
6311public:
6313
6319 UE_API FStructProperty(FFieldVariant InOwner, const UECodeGen_Private::FStructPropertyParams& Prop);
6320
6321#if UE_WITH_CONSTINIT_UOBJECT
6322 explicit consteval FStructProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, int32 StructSize, UScriptStruct* InScriptStruct)
6323 : Super(InBaseParams.SetElementSize(StructSize))
6325 {
6326 }
6327#endif
6328
6329#if WITH_EDITORONLY_DATA
6331#endif // WITH_EDITORONLY_DATA
6332
6333 // UObject interface
6334 UE_API virtual void Serialize( FArchive& Ar ) override;
6335 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
6336 UE_API virtual void GetPreloadDependencies(TArray<UObject*>& OutDeps) override;
6337 // End of UObject interface
6338
6339 // Field interface
6340 UE_API virtual void PostDuplicate(const FField& InField) override;
6341
6342 // FProperty interface
6343 UE_API virtual FString GetCPPMacroType( FString& ExtendedTypeText ) const override;
6344 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
6345 UE_API virtual void LinkInternal(FArchive& Ar) override;
6346 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
6347 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
6348 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
6349 UE_API virtual bool SupportsNetSharedSerialization() const override;
6350protected:
6351 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
6352 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
6353 UE_API virtual bool ContainsClearOnFinishDestroyInternal(TArray<const FStructProperty*>& EncounteredStructProps) const override;
6354 UE_API virtual void FinishDestroyInternal(void* Data) const override;
6355public:
6356 UE_API virtual void CopyValuesInternal( void* Dest, void const* Src, int32 Count ) const override;
6357 UE_API virtual void ClearValueInternal( void* Data ) const override;
6358 UE_API virtual void DestroyValueInternal( void* Dest ) const override;
6359 UE_API virtual void InitializeValueInternal( void* Dest ) const override;
6360 UE_API virtual void InstanceSubobjects( void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph ) override;
6361 UE_API virtual int32 GetMinAlignment() const override;
6363 UE_API virtual void EmitReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
6364 UE_API virtual bool SameType(const FProperty* Other) const override;
6365 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
6366#if WITH_EDITORONLY_DATA
6367 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
6368#endif
6369 UE_API virtual bool UseBinaryOrNativeSerialization(const FArchive& Ar) const override;
6370 UE_API virtual bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag* Tag = nullptr) override;
6371 UE_API virtual void SaveTypeName(UE::FPropertyTypeNameBuilder& Type) const override;
6372 UE_API virtual bool CanSerializeFromTypeName(UE::FPropertyTypeName Type) const override;
6374 UE_API virtual void* ResolveVisitedPathInfo(void* Data, const FPropertyVisitorInfo& Info) const override;
6375 // End of FProperty interface
6376
6377 UE_API bool FindInnerPropertyInstance(FName PropertyName, const void* Data, const FProperty*& OutProp, const void*& OutData) const;
6378
6379 UE_API virtual bool HasIntrusiveUnsetOptionalState() const override;
6380 UE_API virtual void InitializeIntrusiveUnsetOptionalValue(void* Data) const override;
6381 UE_API virtual bool IsIntrusiveOptionalValueSet(const void* Data) const override;
6382 UE_API virtual void ClearIntrusiveOptionalValue(void* Data) const override;
6383 UE_API virtual void EmitIntrusiveOptionalReferenceInfo(UE::GC::FSchemaBuilder& Schema, int32 BaseOffset, TArray<const FStructProperty*>& EncounteredStructProps, UE::GC::FPropertyStack& DebugPath) override;
6384
6385private:
6386 UE_API virtual uint32 GetValueTypeHashInternal(const void* Src) const;
6387};
6388
6389/*-----------------------------------------------------------------------------
6390 FDelegateProperty.
6391-----------------------------------------------------------------------------*/
6392
6396class FDelegateProperty : public TProperty<FScriptDelegate, FProperty>
6397{
6399
6400
6401 TObjectPtr<UFunction> SignatureFunction;
6402public:
6403
6404 using TTypeFundamentals = Super::TTypeFundamentals;
6405 using TCppType = TTypeFundamentals::TCppType;
6406
6408
6414 UE_API FDelegateProperty(FFieldVariant InOwner, const UECodeGen_Private::FDelegatePropertyParams& Prop);
6415
6416#if UE_WITH_CONSTINIT_UOBJECT
6417 explicit consteval FDelegateProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UFunction* InSignatureFunction)
6419 , SignatureFunction(ConstEval, InSignatureFunction)
6420 {
6421 }
6422#endif
6423
6424#if WITH_EDITORONLY_DATA
6426#endif // WITH_EDITORONLY_DATA
6427
6428 // UObject interface
6429 UE_API virtual void Serialize( FArchive& Ar ) override;
6430 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
6431 UE_API virtual void BeginDestroy() override;
6432 // End of UObject interface
6433
6434 // Field interface
6435 UE_API virtual void PostDuplicate(const FField& InField) override;
6436
6437 // FProperty interface
6438 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
6439 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
6440 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
6441 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
6442protected:
6443 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
6444 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
6445public:
6447 UE_API virtual void InstanceSubobjects( void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph ) override;
6448 UE_API virtual bool SameType(const FProperty* Other) const override;
6449#if WITH_EDITORONLY_DATA
6450 UE_API virtual void AppendSchemaHash(FBlake3& Builder, bool bSkipEditorOnly) const override;
6451#endif
6452 // End of FProperty interface
6453};
6454
6455
6456/*-----------------------------------------------------------------------------
6457 FMulticastDelegateProperty.
6458-----------------------------------------------------------------------------*/
6459
6464{
6466
6467
6468 TObjectPtr<UFunction> SignatureFunction;
6469
6470public:
6471
6473
6479 UE_API FMulticastDelegateProperty(FFieldVariant InOwner, const UECodeGen_Private::FMulticastDelegatePropertyParams& Prop, EPropertyFlags AdditionalPropertyFlags = CPF_None);
6480
6481#if UE_WITH_CONSTINIT_UOBJECT
6482 explicit consteval FMulticastDelegateProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UFunction* InSignatureFunction)
6484 , SignatureFunction(ConstEval, InSignatureFunction)
6485 {
6486 }
6487#endif
6488
6489#if WITH_EDITORONLY_DATA
6491#endif // WITH_EDITORONLY_DATA
6492
6493 // UObject interface
6494 UE_API virtual void Serialize( FArchive& Ar ) override;
6495 UE_API virtual void BeginDestroy() override;
6496 UE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
6497 // End of UObject interface
6498
6499 // Field interface
6500 UE_API virtual void PostDuplicate(const FField& InField) override;
6501
6502 // FProperty interface
6503 UE_API virtual FString GetCPPType( FString* ExtendedTypeText, uint32 CPPExportFlags ) const override;
6504 UE_API virtual bool Identical( const void* A, const void* B, uint32 PortFlags ) const override;
6505 UE_API virtual bool NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData = NULL ) const override;
6506protected:
6507 UE_API virtual void ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const override;
6508public:
6510 UE_API virtual void InstanceSubobjects( void* Data, void const* DefaultData, TNotNull<UObject*> Owner, struct FObjectInstancingGraph* InstanceGraph ) override;
6511 UE_API virtual bool SameType(const FProperty* Other) const override;
6512 UE_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
6513 // End of FProperty interface
6514
6516 virtual void SetMulticastDelegate(void* PropertyValue, FMulticastScriptDelegate ScriptDelegate) const PURE_VIRTUAL(FMulticastDelegateProperty::SetMulticastDelegate, );
6517
6518 virtual void AddDelegate(FScriptDelegate ScriptDelegate, UObject* Parent = nullptr, void* PropertyValue = nullptr) const PURE_VIRTUAL(FMulticastDelegateProperty::AddDelegate, );
6519 virtual void RemoveDelegate(const FScriptDelegate& ScriptDelegate, UObject* Parent = nullptr, void* PropertyValue = nullptr) const PURE_VIRTUAL(FMulticastDelegateProperty::RemoveDelegate, );
6520 virtual void ClearDelegate(UObject* Parent = nullptr, void* PropertyValue = nullptr) const PURE_VIRTUAL(FMulticastDelegateProperty::ClearDelegate, );
6521
6522protected:
6524
6526 virtual FMulticastScriptDelegate& GetMulticastScriptDelegate(const void* PropertyValue, int32 Index) const PURE_VIRTUAL(FMulticastDelegateProperty::GetMulticastScriptDelegate, return EmptyDelegate;);
6527
6528
6529 UE_API const TCHAR* ImportText_Add( const TCHAR* Buffer, void* PropertyValue, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText ) const;
6530 UE_API const TCHAR* ImportText_Remove( const TCHAR* Buffer, void* PropertyValue, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText ) const;
6531
6532 UE_API const TCHAR* ImportDelegateFromText(FMulticastScriptDelegate& MulticastDelegate, const TCHAR* Buffer, UObject* OwnerObject, FOutputDevice* ErrorText) const;
6533};
6534
6535template<class InTCppType>
6537{
6538public:
6543 : Super(InOwner, InName)
6544 {
6545 this->SignatureFunction = InSignatureFunction;
6546 }
6547
6549 : Super(InOwner, InName, InObjectFlags)
6550 {
6551 this->SignatureFunction = nullptr;
6552 }
6553
6558
6564 TProperty_MulticastDelegate(FFieldVariant InOwner, const UECodeGen_Private::FMulticastDelegatePropertyParams& Prop)
6565 : Super(InOwner, Prop)
6566 {
6567 this->SignatureFunction = Prop.SignatureFunctionFunc ? Prop.SignatureFunctionFunc() : nullptr;
6568 }
6569
6570#if UE_WITH_CONSTINIT_UOBJECT
6571 explicit consteval TProperty_MulticastDelegate(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UFunction* InSignatureFunction)
6573 {
6574 }
6575#endif
6576
6577#if WITH_EDITORONLY_DATA
6579 : Super(InField)
6580 {
6581 }
6582#endif // WITH_EDITORONLY_DATA
6583
6584 // FProperty interface.
6589 // End of FProperty interface
6590};
6591
6593{
6595
6596public:
6597
6602
6608 UE_API FMulticastInlineDelegateProperty(FFieldVariant InOwner, const UECodeGen_Private::FMulticastDelegatePropertyParams& Prop);
6609
6610#if UE_WITH_CONSTINIT_UOBJECT
6611 explicit consteval FMulticastInlineDelegateProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UFunction* InSignatureFunction)
6613 {
6614 }
6615#endif
6616
6617#if WITH_EDITORONLY_DATA
6620 {
6621 }
6622#endif // WITH_EDITORONLY_DATA
6623
6624 // FProperty interface
6625 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
6626 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
6627 // End of FProperty interface
6628
6629 // FMulticastDelegateProperty interface
6630 UE_API virtual const FMulticastScriptDelegate* GetMulticastDelegate(const void* PropertyValue) const override;
6631 UE_API virtual void SetMulticastDelegate(void* PropertyValue, FMulticastScriptDelegate ScriptDelegate) const override;
6632
6633 UE_API virtual void AddDelegate(FScriptDelegate ScriptDelegate, UObject* Parent = nullptr, void* PropertyValue = nullptr) const override;
6634 UE_API virtual void RemoveDelegate(const FScriptDelegate& ScriptDelegate, UObject* Parent = nullptr, void* PropertyValue = nullptr) const override;
6635 UE_API virtual void ClearDelegate(UObject* Parent = nullptr, void* PropertyValue = nullptr) const override;
6636
6637protected:
6638 UE_API virtual FMulticastScriptDelegate& GetMulticastScriptDelegate(const void* PropertyValue, int32 Index) const;
6639 // End of FMulticastDelegateProperty interface
6640};
6641
6643{
6645
6646public:
6647
6652
6658 UE_API FMulticastSparseDelegateProperty(FFieldVariant InOwner, const UECodeGen_Private::FMulticastDelegatePropertyParams& Prop);
6659
6660#if UE_WITH_CONSTINIT_UOBJECT
6661 explicit consteval FMulticastSparseDelegateProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams, UFunction* InSignatureFunction)
6663 {
6664 }
6665#endif
6666
6667#if WITH_EDITORONLY_DATA
6670 {
6671 }
6672#endif // WITH_EDITORONLY_DATA
6673
6674 // FProperty interface
6675 UE_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
6676 UE_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
6677 UE_API virtual bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag* Tag = nullptr) override;
6678 // End of FProperty interface
6679
6680 // FMulticastDelegateProperty interface
6681 UE_API virtual const FMulticastScriptDelegate* GetMulticastDelegate(const void* PropertyValue) const override;
6682 UE_API virtual void SetMulticastDelegate(void* PropertyValue, FMulticastScriptDelegate ScriptDelegate) const override;
6683
6684 UE_API virtual void AddDelegate(FScriptDelegate ScriptDelegate, UObject* Parent = nullptr, void* PropertyValue = nullptr) const override;
6685 UE_API virtual void RemoveDelegate(const FScriptDelegate& ScriptDelegate, UObject* Parent = nullptr, void* PropertyValue = nullptr) const override;
6686 UE_API virtual void ClearDelegate(UObject* Parent = nullptr, void* PropertyValue = nullptr) const override;
6687
6688protected:
6689 UE_API virtual FMulticastScriptDelegate& GetMulticastScriptDelegate(const void* PropertyValue, int32 Index) const;
6690 // End of FMulticastDelegateProperty interface
6691
6692private:
6693 UE_API virtual void SerializeItemInternal(FArchive& Ar, void* Value, void const* Defaults) const;
6694};
6695
6698{
6701
6704
6707
6710
6714 , ArrayIndex(InArrayIndex)
6715 , SubPropertyList(nullptr)
6716 , PropertyListNext(nullptr)
6717 {
6718 }
6719
6722 {
6723 if (Node)
6724 {
6725 Node = Node->PropertyListNext;
6726 }
6727
6728 return Node ? Node->Property : nullptr;
6729 }
6730};
6731
6732
6737class FEditPropertyChain : public TDoubleLinkedList<FProperty*>
6738{
6739
6740public:
6742 FEditPropertyChain() : ActivePropertyNode(NULL), ActiveMemberPropertyNode(NULL), bFilterAffectedInstances(false) {}
6743
6752 UE_API bool SetActivePropertyNode( FProperty* NewActiveProperty );
6753
6763 UE_API bool SetActiveMemberPropertyNode( FProperty* NewActiveMemberProperty );
6764
6768 template<typename T>
6770 {
6771 bFilterAffectedInstances = true;
6772 AffectedInstances = Forward<T>(InAffectedInstances);
6773 }
6774
6778 UE_API bool IsArchetypeInstanceAffected( UObject* InInstance ) const;
6779
6783 UE_API TDoubleLinkedListNode* GetActiveNode() const;
6784
6790 UE_API TDoubleLinkedListNode* GetActiveMemberNode() const;
6791
6792protected:
6797 TDoubleLinkedListNode* ActivePropertyNode;
6798
6805 TDoubleLinkedListNode* ActiveMemberPropertyNode;
6806
6811
6816
6826 UE_API virtual void SetListSize( int32 NewListSize );
6827};
6828
6829
6830//-----------------------------------------------------------------------------
6831//EPropertyNodeFlags - Flags used internally by property editors
6832//-----------------------------------------------------------------------------
6834{
6835 typedef uint32 Type;
6836
6837 //default value. Add new enums to add new functionality.
6838 inline const Type Unspecified = 1 << 0;
6839 //Array Add
6840 inline const Type ArrayAdd = 1 << 1;
6841 //Array Remove
6842 inline const Type ArrayRemove = 1 << 2;
6843 //Array Clear
6844 inline const Type ArrayClear = 1 << 3;
6845 //Value Set
6846 inline const Type ValueSet = 1 << 4;
6847 //Duplicate
6848 inline const Type Duplicate = 1 << 5;
6849 //Interactive, e.g. dragging a slider. Will be followed by a ValueSet when finished.
6850 inline const Type Interactive = 1 << 6;
6851 //Redirected. Used when property references are updated due to content hot-reloading, or an asset being replaced during asset deletion (aka, asset consolidation).
6852 inline const Type Redirected = 1 << 7;
6853 // Array Item Moved Within the Array
6854 inline const Type ArrayMove = 1 << 8;
6855 // Edit Condition State has changed
6856 inline const Type ToggleEditable = 1 << 9;
6857 //
6858 inline const Type ResetToDefault = 1 << 10;
6859};
6860
6865{
6875
6880
6885 {
6886 ArrayIndicesPerObject = InArrayIndices;
6887 }
6888
6892 template<typename T>
6894 {
6895 bFilterChangedInstances = true;
6896 InstancesChanged = Forward<T>(InInstancesChanged);
6897 }
6898
6900 {
6901 if (!(ArrayIndicesPerObject.IsValidIndex(InObjectIteratorIndex)))
6902 {
6903 return false;
6904 }
6905
6906 OutArrayIndicesPerObject = ArrayIndicesPerObject[InObjectIteratorIndex];
6907 return true;
6908 }
6909
6914 int32 GetArrayIndex(const FString& InName) const
6915 {
6916 //default to unknown index
6917 int32 Retval = -1;
6918 if (ArrayIndicesPerObject.IsValidIndex(ObjectIteratorIndex))
6919 {
6920 const int32* ValuePtr = ArrayIndicesPerObject[ObjectIteratorIndex].Find(InName);
6921 if (ValuePtr)
6922 {
6923 Retval = *ValuePtr;
6924 }
6925 }
6926 return Retval;
6927 }
6928
6934 {
6935 return !bFilterChangedInstances || InstancesChanged.Contains(InInstance);
6936 }
6937
6941 int32 GetNumObjectsBeingEdited() const { return TopLevelObjects.Num(); }
6942
6949 const UObject* GetObjectBeingEdited(int32 Index) const { return TopLevelObjects[Index]; }
6950
6955 {
6956 return (Property != nullptr) ? Property->GetFName() : NAME_None;
6957 }
6958
6963 {
6964 return (MemberProperty != nullptr) ? MemberProperty->GetFName() : NAME_None;
6965 }
6966
6971
6977
6978 // The kind of change event that occurred
6980
6981 // Used by the param system to say which object is receiving the event in the case of multi-select
6983private:
6984 //In the property window, multiple objects can be selected at once. In the case of adding/inserting to an array, each object COULD have different indices for the new entries in the array
6985 TArrayView<const TMap<FString, int32>> ArrayIndicesPerObject;
6986
6987 //In the property window, multiple objects can be selected at once. In this case we want to know if an instance was updated for this operation (used in array/set/map context)
6988 TSet<UObject*> InstancesChanged;
6989
6990 //Assume all archetype instances were changed unless a set of changed instances is provided.
6991 bool bFilterChangedInstances;
6992
6994 TArrayView<const UObject* const> TopLevelObjects;
6995};
6996
7009
7010namespace UEProperty_Private
7011{
7016}
7017
7018/*-----------------------------------------------------------------------------
7019TFieldIterator.
7020-----------------------------------------------------------------------------*/
7021
7024{
7025 None = 0,
7026 IncludeSuper = 1<<0, // Include super class
7027 IncludeDeprecated = 1<<1, // Include deprecated properties
7028 IncludeInterfaces = 1<<2, // Include interfaces
7029
7031
7033};
7035
7057
7058template <class FieldType>
7060{
7061 check(false);
7062 return nullptr;
7063}
7064
7065template <>
7067{
7068 return Owner->Children;
7069}
7070
7071template <>
7073{
7074 return Owner->ChildProperties;
7075}
7076
7077
7078//
7079// For iterating through a linked list of fields.
7080//
7081template <class T>
7083{
7084private:
7086 const UStruct* Struct;
7088 typename T::BaseFieldClass* Field;
7090 int32 InterfaceIndex;
7092 const bool bIncludeSuper;
7094 const bool bIncludeDeprecated;
7096 const bool bIncludeInterface;
7097
7098public:
7109
7118
7120 UE_FORCEINLINE_HINT explicit operator bool() const
7121 {
7122 return Field != NULL;
7123 }
7126 {
7127 return !(bool)*this;
7128 }
7129
7130 inline bool operator==(const TFieldIterator<T>& Rhs) const { return Field == Rhs.Field; }
7131 inline bool operator!=(const TFieldIterator<T>& Rhs) const { return Field != Rhs.Field; }
7132
7133 inline void operator++()
7134 {
7136 Field = Field->Next;
7137 IterateToNext();
7138 }
7139 inline T* operator*()
7140 {
7142 return (T*)Field;
7143 }
7144 inline const T* operator*() const
7145 {
7147 return (const T*)Field;
7148 }
7149 inline T* operator->()
7150 {
7152 return (T*)Field;
7153 }
7154 inline const UStruct* GetStruct()
7155 {
7156 return Struct;
7157 }
7158protected:
7159 inline void IterateToNext()
7160 {
7161 typename T::BaseFieldClass* CurrentField = Field;
7162 const UStruct* CurrentStruct = Struct;
7163
7164 while (CurrentStruct)
7165 {
7166 for (; CurrentField; CurrentField = CurrentField->Next)
7167 {
7168 typename T::FieldTypeClass* FieldClass = CurrentField->GetClass();
7169
7170 if (!FieldClass->HasAllCastFlags(T::StaticClassCastFlags()))
7171 {
7172 continue;
7173 }
7174
7175 if (FieldClass->HasAllCastFlags(CASTCLASS_FProperty))
7176 {
7178 if (Prop->HasAllPropertyFlags(CPF_Deprecated) && !bIncludeDeprecated)
7179 {
7180 continue;
7181 }
7182 }
7183
7184 Struct = CurrentStruct;
7186 return;
7187 }
7188
7189 if (bIncludeInterface)
7190 {
7191 // We shouldn't be able to get here for non-classes
7192 UClass* CurrentClass = (UClass*)CurrentStruct;
7193 ++InterfaceIndex;
7194 if (InterfaceIndex < CurrentClass->Interfaces.Num())
7195 {
7196 FImplementedInterface& Interface = CurrentClass->Interfaces[InterfaceIndex];
7198 continue;
7199 }
7200 }
7201
7202 if (bIncludeSuper)
7203 {
7204 CurrentStruct = CurrentStruct->GetInheritanceSuper();
7205 if (CurrentStruct)
7206 {
7208 InterfaceIndex = -1;
7209 continue;
7210 }
7211 }
7212
7213 break;
7214 }
7215
7216 Struct = CurrentStruct;
7218 }
7219};
7220
7221template <typename T>
7243
7244/*-----------------------------------------------------------------------------
7245 Field templates.
7246-----------------------------------------------------------------------------*/
7247
7248template <UE::CDerivedFrom<UField> T>
7250{
7251 static_assert(sizeof(T) > 0, "T must not be an incomplete type");
7252
7253 // We know that a "none" field won't exist in this Struct
7254 if (FieldName.IsNone())
7255 {
7256 return nullptr;
7257 }
7258
7259 // Search by comparing FNames (INTs), not strings
7260 for (TFieldIterator<T>It(Owner, IterationFlags); It; ++It)
7261 {
7262 if (It->GetFName() == FieldName)
7263 {
7264 return *It;
7265 }
7266 }
7267
7268 // If we didn't find it, return no field
7269 return nullptr;
7270}
7271
7272template <UE::CDerivedFrom<UField> T>
7274{
7275 static_assert(sizeof(T) > 0, "T must not be an incomplete type");
7276
7277 // lookup the string name in the Name hash
7278 FName Name(FieldName, FNAME_Find);
7280}
7281
7282template <UE::CDerivedFrom<FField> T>
7284{
7285 static_assert(sizeof(T) > 0, "T must not be an incomplete type");
7286
7287 // We know that a "none" field won't exist in this Struct
7288 if (FieldName.IsNone())
7289 {
7290 return nullptr;
7291 }
7292
7293 // Search by comparing FNames (INTs), not strings
7294 for (TFieldIterator<T>It(Owner, IterationFlags); It; ++It)
7295 {
7296 if (It->GetFName() == FieldName)
7297 {
7298 return *It;
7299 }
7300 }
7301
7302 // If we didn't find it, return no field
7303 return nullptr;
7304}
7305
7306template <UE::CDerivedFrom<FField> T>
7308{
7309 static_assert(sizeof(T) > 0, "T must not be an incomplete type");
7310
7311 // lookup the string name in the Name hash
7312 FName Name(FieldName, FNAME_Find);
7314}
7315
7318{
7319 // Look for properties first as they're most often the runtime thing higher level code wants to find
7321 if (!Result)
7322 {
7323 Result = FindUField<UField>(Owner, FieldName, IterationFlags);
7324 }
7325 return Result;
7326}
7327
7330{
7331 // lookup the string name in the Name hash
7332 FName Name(FieldName, FNAME_Find);
7334}
7335
7336template <UE::CDerivedFrom<UField> T>
7341
7342template <UE::CDerivedFrom<UField> T>
7347
7348template <UE::CDerivedFrom<FField> T>
7350{
7351 return FindFProperty<T>(Owner, FieldName, IterationFlags);
7352}
7353
7354template <UE::CDerivedFrom<FField> T>
7356{
7357 return FindFProperty<T>(Owner, FieldName, IterationFlags);
7358}
7359
7366template<typename T>
7367T* FindFieldChecked( const UStruct* Scope, FName FieldName )
7368{
7369 if ( FieldName != NAME_None && Scope != NULL )
7370 {
7371 const UStruct* InitialScope = Scope;
7372 for ( ; Scope != NULL; Scope = dynamic_cast<const UStruct*>(Scope->GetOuter()) )
7373 {
7374 for ( TFieldIterator<T> It(Scope); It; ++It )
7375 {
7376 if ( It->GetFName() == FieldName )
7377 {
7378 return *It;
7379 }
7380 }
7381 }
7382
7383 UE_LOG( LogType, Fatal, TEXT("Failed to find %s %s in %s"), *T::StaticClass()->GetName(), *FieldName.ToString(), *InitialScope->GetFullName() );
7384 }
7385
7386 return NULL;
7387}
7388
7389/*-----------------------------------------------------------------------------*
7390 * PropertyValueIterator
7391 *-----------------------------------------------------------------------------*/
7392
7395{
7396 NoRecursion = 0, // Don't recurse at all, only do top level properties
7397 FullRecursion = 1, // Recurse into containers and structs
7398};
7399
7402{
7403public:
7405
7418
7421 : PropertyClass(nullptr)
7423 , DeprecatedPropertyFlags(EFieldIteratorFlags::IncludeDeprecated)
7424 , bSkipRecursionOnce(false)
7425 {
7426 }
7427
7429 inline explicit operator bool() const
7430 {
7431 // If nothing left in the stack, iteration is complete
7432 if (PropertyIteratorStack.Num() > 0)
7433 {
7434 return true;
7435 }
7436 return false;
7437 }
7438
7440 {
7441 return PropertyIteratorStack == Rhs.PropertyIteratorStack;
7442 }
7443
7445 {
7446 return !(PropertyIteratorStack == Rhs.PropertyIteratorStack);
7447 }
7448
7450 inline const BasePairType& operator*() const
7451 {
7452 const FPropertyValueStackEntry& Entry = PropertyIteratorStack.Last();
7453 return Entry.GetPropertyValue();
7454 }
7455
7456 inline const BasePairType* operator->() const
7457 {
7458 const FPropertyValueStackEntry& Entry = PropertyIteratorStack.Last();
7459 return &Entry.GetPropertyValue();
7460 }
7461
7464 {
7465 return (*this)->Key;
7466 }
7467
7469 UE_FORCEINLINE_HINT const void* Value() const
7470 {
7471 return (*this)->Value;
7472 }
7473
7476 {
7477 IterateToNext();
7478 }
7479
7482 {
7483 bSkipRecursionOnce = true;
7484 }
7485
7491 COREUOBJECT_API void GetPropertyChain(TArray<const FProperty*>& PropertyChain) const;
7492
7506 COREUOBJECT_API FString GetPropertyPathDebugString() const;
7507
7508private:
7509 enum class EPropertyValueFlags : uint8
7510 {
7511 None = 0x0,
7512 IsMatch = 0x01,
7513
7514 IsOptional = 0x08,
7515 IsArray = 0x10,
7516 IsMap = 0x20,
7517 IsSet = 0x40,
7518 IsStruct = 0x80,
7519
7520 // When adding a new 'container' (needs to be recursed into) flag here, add it to the EPropertyValueFlags_ContainerMask macro too.
7521 };
7522 FRIEND_ENUM_CLASS_FLAGS(EPropertyValueFlags)
7523
7524 struct FPropertyValueStackEntry
7525 {
7527 const void* Owner = nullptr;
7528
7530 typedef TPair<BasePairType, EPropertyValueFlags> BasePairAndFlags;
7531 typedef TArray<BasePairAndFlags, TInlineAllocator<8>> FValueArrayType;
7532 FValueArrayType ValueArray;
7533
7535 int32 ValueIndex = -1;
7536
7538 int32 NextValueIndex = 0;
7539
7540 FPropertyValueStackEntry(const void* InValue)
7541 : Owner(InValue)
7542 {}
7543
7545 : Owner(InValue)
7546 {}
7547
7548 UE_FORCEINLINE_HINT bool operator==(const FPropertyValueStackEntry& Rhs) const
7549 {
7550 return Owner == Rhs.Owner && ValueIndex == Rhs.ValueIndex;
7551 }
7552
7553 UE_FORCEINLINE_HINT const BasePairType& GetPropertyValue() const
7554 {
7555 // Index has to be valid to get this far
7556 return ValueArray[ValueIndex].Key;
7557 }
7558 };
7559
7562
7564 FFieldClass* PropertyClass = nullptr;
7565
7567 const EPropertyValueIteratorFlags RecursionFlags;
7568
7571
7573 bool bSkipRecursionOnce = false;
7574
7576 bool bMatchAll = false;
7577
7579 EPropertyValueFlags GetPropertyValueFlags(const FProperty* Property) const;
7580
7582 void FillStructProperties(const UStruct* Struct, FPropertyValueStackEntry& Entry);
7583
7588 bool NextValue(EPropertyValueIteratorFlags RecursionFlags);
7589
7591 COREUOBJECT_API void IterateToNext();
7592};
7593
7595template <class T>
7636
7638template <class T>
7661
7665inline bool UObject::IsBasedOnArchetype( const UObject* const SomeObject ) const
7666{
7667 checkfSlow(this, TEXT("IsBasedOnArchetype() is called on a null pointer. Fix the call site."));
7668 if ( SomeObject != this )
7669 {
7670 for ( UObject* Template = GetArchetype(); Template; Template = Template->GetArchetype() )
7671 {
7672 if ( SomeObject == Template )
7673 {
7674 return true;
7675 }
7676 }
7677 }
7678
7679 return false;
7680}
7681
7682
7683/*-----------------------------------------------------------------------------
7684 C++ property macros.
7685-----------------------------------------------------------------------------*/
7686
7687static_assert(sizeof(bool) == sizeof(uint8), "Bool is not one byte.");
7688
7690#define CPP_ARRAY_DIM(ArrayName, ClassName) \
7691 (sizeof(((ClassName*)0)->ArrayName) / sizeof(((ClassName*)0)->ArrayName[0]))
7692
7693#undef UE_API
7694
7695#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_7
7696#include "HAL/PlatformMath.h"
7697#include "Math/NumericLimits.h"
7698#include "Math/UnrealMathUtility.h"
7699#include "Templates/EnableIf.h"
7700#include "Templates/Greater.h"
7702#include "Templates/IsIntegral.h"
7703#include "Templates/IsSigned.h"
7704#include "UObject/StrProperty.h"
7705#endif
7706
7707// Types extracted from UnrealType.h that need to be in their own header because of the rule that .generated.h must be the last included file
7708#include "PropertyWrapper.h"
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define NULL
Definition oodle2base.h:134
constexpr bool operator!(EUpdateTransformFlags Value)
Definition ActorComponent.h:116
#define PLATFORM_ANDROID
Definition AndroidPlatform.h:14
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define checkfSlow(expr, format,...)
Definition AssertionMacros.h:333
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
CORE_API FFeedbackContext * GWarn
Definition CoreGlobals.cpp:53
#define GIsEditor
Definition CoreGlobals.h:233
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
#define UE_INTERNAL
Definition CoreMiscDefines.h:345
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define WITH_METADATA
Definition CoreMiscDefines.h:32
@ ConstEval
Definition CoreMiscDefines.h:161
ELifetimeCondition
Definition CoreNetTypes.h:20
#define DECLARE_FIELD_API(TClass, TSuperClass, TStaticFlags, TRequiredAPI)
Definition Field.h:257
FieldType * FindFProperty(const TCHAR *InFieldPath)
Definition Field.h:1257
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
#define PLATFORM_32BITS
Definition Platform.h:682
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::UTF8CHAR UTF8CHAR
An 8-bit character containing a UTF8 (Unicode, 8-bit, variable-width) code unit.
Definition Platform.h:1137
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
FORCEINLINE constexpr void DestructItem(ElementType *Element)
Definition MemoryOps.h:56
FORCEINLINE constexpr void DestructItems(ElementType *Element, SizeType Count)
Definition MemoryOps.h:81
FORCEINLINE void ConstructItems(void *Dest, const SourceElementType *Source, SizeType Count)
Definition MemoryOps.h:108
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
#define FRIEND_ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:17
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PGO_LINK_DISABLE_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:71
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#define PGO_LINK_ENABLE_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:75
const TCHAR * LexToString(EAnalyticsRecordEventMode Mode)
Definition IAnalyticsProvider.cpp:5
void LexFromString(EAudioFeature &OutFeature, const TCHAR *String)
Definition IOSAppDelegate.cpp:163
constexpr bool HasIntrusiveUnsetOptionalState()
Definition IntrusiveUnsetOptionalState.h:85
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
#define UE_CLOG(Condition, CategoryName, Verbosity, Format,...)
Definition LogMacros.h:298
#define UE_LOG(CategoryName, Verbosity, Format,...)
Definition LogMacros.h:270
@ Num
Definition MetalRHIPrivate.h:234
#define PRAGMA_DISABLE_SWITCH_UNHANDLED_ENUM_CASE_WARNINGS
Definition MSVCPlatformCompilerPreSetup.h:105
#define PRAGMA_RESTORE_SWITCH_UNHANDLED_ENUM_CASE_WARNINGS
Definition MSVCPlatformCompilerPreSetup.h:111
T TNotNull
Definition NotNull.h:307
#define NAME_NO_NUMBER_INTERNAL
Definition NameTypes.h:157
@ FNAME_Find
Definition NameTypes.h:209
const bool
Definition NetworkReplayStreaming.h:178
#define MAX_int32
Definition NumericLimits.h:25
#define CPF_AllFlags
Definition ObjectMacros.h:506
@ CASTCLASS_FArrayProperty
Definition ObjectMacros.h:357
@ CASTCLASS_FNumericProperty
Definition ObjectMacros.h:360
@ CASTCLASS_FFloatProperty
Definition ObjectMacros.h:344
@ CASTCLASS_FIntProperty
Definition ObjectMacros.h:343
@ CASTCLASS_FBoolProperty
Definition ObjectMacros.h:353
@ CASTCLASS_FDelegateProperty
Definition ObjectMacros.h:359
@ CASTCLASS_FUInt64Property
Definition ObjectMacros.h:345
@ CASTCLASS_FMulticastSparseDelegateProperty
Definition ObjectMacros.h:387
@ CASTCLASS_FInterfaceProperty
Definition ObjectMacros.h:348
@ CASTCLASS_FNameProperty
Definition ObjectMacros.h:349
@ CASTCLASS_FMapProperty
Definition ObjectMacros.h:382
@ CASTCLASS_FDoubleProperty
Definition ObjectMacros.h:368
@ CASTCLASS_FByteProperty
Definition ObjectMacros.h:342
@ CASTCLASS_FSetProperty
Definition ObjectMacros.h:383
@ CASTCLASS_FClassProperty
Definition ObjectMacros.h:346
@ CASTCLASS_FSoftObjectProperty
Definition ObjectMacros.h:365
@ CASTCLASS_FMulticastDelegateProperty
Definition ObjectMacros.h:361
@ CASTCLASS_FWeakObjectProperty
Definition ObjectMacros.h:363
@ CASTCLASS_FInt64Property
Definition ObjectMacros.h:358
@ CASTCLASS_FUInt16Property
Definition ObjectMacros.h:354
@ CASTCLASS_FInt8Property
Definition ObjectMacros.h:337
@ CASTCLASS_FInt16Property
Definition ObjectMacros.h:367
@ CASTCLASS_FObjectProperty
Definition ObjectMacros.h:352
@ CASTCLASS_FStructProperty
Definition ObjectMacros.h:356
@ CASTCLASS_FMulticastInlineDelegateProperty
Definition ObjectMacros.h:386
@ CASTCLASS_FSoftClassProperty
Definition ObjectMacros.h:369
@ CASTCLASS_FObjectPropertyBase
Definition ObjectMacros.h:362
@ CASTCLASS_FProperty
Definition ObjectMacros.h:351
@ CASTCLASS_FUInt32Property
Definition ObjectMacros.h:347
@ CASTCLASS_FLazyObjectProperty
Definition ObjectMacros.h:364
EPropertyFlags
Definition ObjectMacros.h:416
@ CPF_Net
Property is relevant to network replication.
Definition ObjectMacros.h:424
@ CPF_Deprecated
Property is deprecated. Read it from an archive, but don't save it.
Definition ObjectMacros.h:448
@ CPF_ContainsInstancedReference
Property contains component references.
Definition ObjectMacros.h:458
@ CPF_ZeroConstructor
memset is fine for construction
Definition ObjectMacros.h:428
@ CPF_NoDestructor
No destructor.
Definition ObjectMacros.h:455
@ CPF_InstancedReference
Property is a component references.
Definition ObjectMacros.h:438
@ CPF_HasGetValueTypeHash
This property can generate a meaningful hash value.
Definition ObjectMacros.h:470
@ CPF_IsPlainOldData
If this is set, then the property can be memcopied instead of CopyCompleteValue / CopySingleValue.
Definition ObjectMacros.h:449
@ CPF_NonNullable
Object property can never be null.
Definition ObjectMacros.h:431
@ CPF_None
Definition ObjectMacros.h:417
EMapPropertyFlags
Definition ObjectMacros.h:525
EArrayPropertyFlags
Definition ObjectMacros.h:514
#define CPF_DevelopmentAssets
Definition ObjectMacros.h:499
EObjectFlags
Definition ObjectMacros.h:552
EPropertyObjectReferenceType
Definition ObjectMacros.h:533
EInternal
Definition ObjectMacros.h:175
@ EC_InternalUseOnlyConstructor
Definition ObjectMacros.h:175
bool IsInteger(EPixelFormat PixelFormat)
Definition PixelFormat.h:343
@ PPF_UseDeprecatedProperties
Definition PropertyPortFlags.h:117
@ PPF_None
Definition PropertyPortFlags.h:15
EPropertyVisitorControlFlow
Definition PropertyVisitor.h:15
UClass * StaticClass()
Definition ReflectedTypeAccessors.h:13
@ IsStruct
Indicates the property is eligible for shared serialization.
#define UE_API
Definition SColorGradingComponentViewer.h:12
auto GetData(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Get())
Definition StringConv.h:802
decltype(auto) Visit(Func &&Callable, Variants &&... Args)
Definition TVariant.h:271
@ Unspecified
EName
Definition UnrealNames.h:16
UE_FORCEINLINE_HINT T BitMask(uint32 Count)
T * FindUField(const UStruct *Owner, FName FieldName, EFieldIterationFlags IterationFlags=EFieldIterationFlags::Default)
Definition UnrealType.h:7249
EPropertyValueIteratorFlags
Definition UnrealType.h:7395
TScriptArray< TMemoryImageAllocator< DEFAULT_ALIGNMENT > > FFreezableScriptArray
Definition UnrealType.h:3693
#define UE_API
Definition UnrealType.h:65
T * FindFieldChecked(const UStruct *Scope, FName FieldName)
Definition UnrealType.h:7367
TScriptMap< FMemoryImageSetAllocator > FFreezableScriptMap
Definition UnrealType.h:3837
EObjectPropertyOptions
Definition UnrealType.h:3077
EPropertyPointerType
Definition UnrealType.h:156
EFieldIterationFlags
Definition UnrealType.h:7024
EPropertyMemoryAccess
Definition UnrealType.h:142
FieldType * GetChildFieldsFromStruct(const UStruct *Owner)
Definition UnrealType.h:7059
EPropertyExportCPPFlags
Definition UnrealType.h:106
@ CPPF_NoConst
Definition UnrealType.h:118
@ CPPF_BlueprintCppBackend
Definition UnrealType.h:124
@ CPPF_NoRef
Definition UnrealType.h:120
@ CPPF_NoStaticArray
Definition UnrealType.h:122
@ CPPF_ArgumentOrReturnValue
Definition UnrealType.h:112
@ CPPF_OptionalValue
Definition UnrealType.h:110
@ CPPF_CustomTypeName
Definition UnrealType.h:116
@ CPPF_Implementation
Definition UnrealType.h:114
@ CPPF_NoTObjectPtr
Definition UnrealType.h:126
@ CPPF_None
Definition UnrealType.h:108
FFieldVariant FindUFieldOrFProperty(const UStruct *Owner, FName FieldName, EFieldIterationFlags IterationFlags=EFieldIterationFlags::Default)
Definition UnrealType.h:7317
EConvertFromTypeResult
Definition UnrealType.h:130
uint32 Offset
Definition VulkanMemory.cpp:4033
int32 InternalIndex
Definition VulkanMemory.cpp:4036
if(Failed) console_printf("Failed.\n")
UEBinkAudioDecodeInterface * Interface
Definition binka_ue_decode_test.cpp:24
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
UE_FORCEINLINE_HINT uint32 GetPortFlags() const
Definition Archive.h:474
virtual CORE_API FString GetArchiveName() const
Definition Archive.cpp:335
Definition UnrealType.h:3702
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:3718
virtual int32 GetMinAlignment() const override
Definition UnrealType.h:3804
TTypeFundamentals::TCppType TCppType
Definition UnrealType.h:3719
virtual void InitializeValueInternal(void *Dest) const override
Definition UnrealType.h:3776
Definition Blake3.h:94
Definition UnrealType.h:2543
UE_FORCEINLINE_HINT bool IsNativeBool() const
Definition UnrealType.h:2679
virtual bool HasIntrusiveUnsetOptionalState() const override
Definition UnrealType.h:2711
bool TCppType
Definition UnrealType.h:2632
UE_FORCEINLINE_HINT bool GetPropertyValue_InContainer(void const *A, int32 ArrayIndex=0) const
Definition UnrealType.h:2639
FORCEINLINE uint8 GetByteMask() const
Definition UnrealType.h:2703
void SetPropertyValue(void *A, bool Value) const
Definition UnrealType.h:2655
static UE_FORCEINLINE_HINT bool GetDefaultPropertyValue()
Definition UnrealType.h:2643
UE_FORCEINLINE_HINT bool GetOptionalPropertyValue_InContainer(void const *B, int32 ArrayIndex=0) const
Definition UnrealType.h:2651
UE_FORCEINLINE_HINT void SetPropertyValue_InContainer(void *A, bool Value, int32 ArrayIndex=0) const
Definition UnrealType.h:2661
UE_FORCEINLINE_HINT uint8 GetFieldMask() const
Definition UnrealType.h:2685
UE_FORCEINLINE_HINT bool GetOptionalPropertyValue(void const *B) const
Definition UnrealType.h:2647
FORCEINLINE uint8 GetBoolFieldSize() const
Definition UnrealType.h:2697
UE_FORCEINLINE_HINT uint8 GetByteOffset() const
Definition UnrealType.h:2691
bool GetPropertyValue(void const *A) const
Definition UnrealType.h:2633
Definition UnrealType.h:2167
Definition UnrealType.h:3411
UE_FORCEINLINE_HINT void SetMetaClass(UClass *NewMetaClass)
Definition UnrealType.h:3475
Definition UnrealType.h:1416
FDefaultConstructedPropertyElement(const FProperty *InProp)
Definition UnrealType.h:1419
void * GetObjAddress() const
Definition UnrealType.h:1429
Definition UnrealType.h:6397
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:6404
TTypeFundamentals::TCppType TCppType
Definition UnrealType.h:6405
Definition UnrealType.h:2503
Definition UnrealType.h:6738
TSet< UObject * > AffectedInstances
Definition UnrealType.h:6810
void SetAffectedArchetypeInstances(T &&InAffectedInstances)
Definition UnrealType.h:6769
FEditPropertyChain()
Definition UnrealType.h:6742
TDoubleLinkedListNode * ActiveMemberPropertyNode
Definition UnrealType.h:6805
TDoubleLinkedListNode * ActivePropertyNode
Definition UnrealType.h:6797
bool bFilterAffectedInstances
Definition UnrealType.h:6815
Definition Field.h:66
Definition Field.h:353
Definition Field.h:556
bool IsA() const
Definition Field.h:738
FString GetName() const
Definition Field.h:848
virtual COREUOBJECT_API void GetPreloadDependencies(TArray< UObject * > &OutDeps)
Definition Field.cpp:465
T * GetOwner() const
Definition Field.h:810
COREUOBJECT_API FString GetFullName() const
Definition Field.cpp:599
FFieldVariant Owner
Definition Field.h:600
virtual FField * GetInnerFieldByName(const FName &InName)
Definition Field.h:890
virtual COREUOBJECT_API void AddReferencedObjects(FReferenceCollector &Collector)
Definition Field.cpp:474
FFieldClass * GetClass() const
Definition Field.h:722
virtual void GetInnerFields(TArray< FField * > &OutFields)
Definition Field.h:896
COREUOBJECT_API UClass * GetOwnerClass() const
Definition Field.cpp:372
virtual COREUOBJECT_API void AddCppProperty(FProperty *Property)
Definition Field.cpp:560
COREUOBJECT_API bool IsValidLowLevel() const
Definition Field.cpp:517
Definition UnrealType.h:2465
Definition UnrealType.h:2271
Definition UnrealType.h:2336
Definition UnrealType.h:2239
Definition UnrealType.h:2304
Definition UnrealType.h:3561
virtual bool SupportsNetSharedSerialization() const override
Definition UnrealType.h:3605
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:3568
TTypeFundamentals::TCppType TCppType
Definition UnrealType.h:3569
UE_FORCEINLINE_HINT void SetInterfaceClass(UClass *NewInterfaceClass)
Definition UnrealType.h:3636
Definition UnrealType.h:3269
Definition UnrealType.h:3843
bool IsValidIndex(void *InMap, int32 InternalIndex) const
Definition UnrealType.h:3993
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:3866
int32 GetNum(void *InMap) const
Definition UnrealType.h:3975
virtual void InitializeValueInternal(void *Dest) const override
Definition UnrealType.h:3933
int32 GetPairStride() const
Definition UnrealType.h:3984
const FProperty * GetKeyProperty() const
Definition UnrealType.h:4007
uint8 * GetPairPtr(void *InMap, int32 InternalIndex) const
Definition UnrealType.h:4002
TTypeFundamentals::TCppType TCppType
Definition UnrealType.h:3867
const FProperty * GetValueProperty() const
Definition UnrealType.h:4012
Definition UnrealType.h:6464
virtual const FMulticastScriptDelegate * GetMulticastDelegate(const void *PropertyValue) const PURE_VIRTUAL(FMulticastDelegateProperty
Definition UnrealType.h:6515
Definition UnrealType.h:6593
FMulticastInlineDelegateProperty(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition UnrealType.h:6598
Definition UnrealType.h:6643
FMulticastSparseDelegateProperty(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition UnrealType.h:6648
Definition UnrealType.h:3649
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:3652
TTypeFundamentals::TCppType TCppType
Definition UnrealType.h:3653
Definition NameTypes.h:617
CORE_API FString ToString() const
Definition UnrealNames.cpp:3537
FORCEINLINE bool IsNone() const
Definition NameTypes.h:827
Definition UnrealType.h:1766
Definition UnrealType.h:2725
UE_FORCEINLINE_HINT UObject * LoadObjectPropertyValue_InContainer(const void *PropertyValueAddress, int32 ArrayIndex=0) const
Definition UnrealType.h:2833
virtual bool SupportsNetSharedSerialization() const override
Definition UnrealType.h:2772
PGO_LINK_DISABLE_WARNINGS void GetWrappedUObjectPtrValues(OutType *OutObjects, const void *SrcAddress, EPropertyMemoryAccess SrcAccess, int32 ArrayIndex, int32 ArrayCount) const
Definition UnrealType.h:2890
TObjectPtr< class UClass > PropertyClass
Definition UnrealType.h:2731
UE_FORCEINLINE_HINT void SetPropertyClass(UClass *NewPropertyClass)
Definition UnrealType.h:2866
virtual UObject * LoadObjectPropertyValue(const void *PropertyValueAddress) const
Definition UnrealType.h:2829
PGO_LINK_ENABLE_WARNINGS void SetWrappedUObjectPtrValues(void *DestAddress, EPropertyMemoryAccess DestAccess, ValueType *InValues, int32 ArrayIndex, int32 ArrayCount) const
Definition UnrealType.h:2948
Definition UnrealType.h:3087
virtual bool IsIntrusiveOptionalValueSet(const void *Data) const
Definition UnrealType.h:3183
TObjectPtr< UObject > * GetObjectPtrPropertyValuePtr(const void *PropertyValueAddress) const
Definition UnrealType.h:3160
virtual void InitializeIntrusiveUnsetOptionalValue(void *Data) const override
Definition UnrealType.h:3178
virtual bool HasIntrusiveUnsetOptionalState() const
Definition UnrealType.h:3170
TObjectPtr< UObject > & GetObjectPtrPropertyValueRef(const void *PropertyValueAddress) const
Definition UnrealType.h:3165
virtual void ClearIntrusiveOptionalValue(void *Data) const
Definition UnrealType.h:3189
Definition OutputDevice.h:133
Definition UnrealType.h:1372
Definition UnrealType.h:7402
const BasePairType & operator*() const
Definition UnrealType.h:7450
const BasePairType * operator->() const
Definition UnrealType.h:7456
FPropertyValueIterator()
Definition UnrealType.h:7420
UE_FORCEINLINE_HINT const void * Value() const
Definition UnrealType.h:7469
UE_FORCEINLINE_HINT bool operator!=(const FPropertyValueIterator &Rhs) const
Definition UnrealType.h:7444
UE_FORCEINLINE_HINT const FProperty * Key() const
Definition UnrealType.h:7463
UE_FORCEINLINE_HINT bool operator==(const FPropertyValueIterator &Rhs) const
Definition UnrealType.h:7439
UE_FORCEINLINE_HINT void operator++()
Definition UnrealType.h:7475
UE_FORCEINLINE_HINT void SkipRecursiveProperty()
Definition UnrealType.h:7481
Definition UnrealType.h:174
bool ShouldDuplicateValue() const
Definition UnrealType.h:1219
static COREUOBJECT_API FName FindRedirectedPropertyName(const UStruct *ObjectStruct, FName OldName)
Definition Property.cpp:2308
virtual COREUOBJECT_API void SaveTypeName(UE::FPropertyTypeNameBuilder &Type) const
Definition Property.cpp:2433
COREUOBJECT_API FString GetNameCPP() const
Definition Property.cpp:982
virtual bool HasIntrusiveUnsetOptionalState() const PURE_VIRTUAL(FProperty virtual COREUOBJECT_API void InitializeIntrusiveUnsetOptionalValue(void *Data) const
Definition Property.cpp:2363
COREUOBJECT_API void GetSingleValue_InContainer(const void *InContainer, void *OutValue, int32 ArrayIndex) const
Definition Property.cpp:1337
UE_FORCEINLINE_HINT bool ExportText_InContainer(int32 Index, FString &ValueStr, const void *Data, const void *Delta, UObject *Parent, int32 PortFlags, UObject *ExportRootScope=nullptr) const
Definition UnrealType.h:724
void SerializeBinProperty(FStructuredArchive::FSlot Slot, void *Data, int32 ArrayIdx=-1)
Definition UnrealType.h:538
FProperty * PostConstructLinkNext
Definition UnrealType.h:238
virtual COREUOBJECT_API uint32 GetValueTypeHashInternal(const void *Src) const
Definition Property.cpp:2357
void FinishDestroy(void *Data) const
Definition UnrealType.h:1070
void FinishDestroy_InContainer(void *Data) const
Definition UnrealType.h:1087
virtual COREUOBJECT_API void CopySingleValueToScriptVM(void *Dest, void const *Src) const
Definition Property.cpp:883
UE_FORCEINLINE_HINT FProperty * GetRepOwner()
Definition UnrealType.h:1306
virtual COREUOBJECT_API void LinkInternal(FArchive &Ar)
Definition Property.cpp:1202
EPropertyFlags PropertyFlags
Definition UnrealType.h:182
COREUOBJECT_API bool ExportText_Direct(FString &ValueStr, const void *Data, const void *Delta, UObject *Parent, int32 PortFlags, UObject *ExportRootScope=nullptr) const
Definition Property.cpp:995
void DestroyValue(void *Dest) const
Definition UnrealType.h:1025
const TCHAR * ImportText_Direct(const TCHAR *Buffer, void *PropertyPtr, UObject *OwnerObject, int32 PortFlags, FOutputDevice *ErrorText=(FOutputDevice *) GWarn) const
Definition UnrealType.h:623
COREUOBJECT_API bool ValidateImportFlags(uint32 PortFlags, FOutputDevice *ErrorText=NULL) const
Definition Property.cpp:959
UE_FORCEINLINE_HINT ValueType * ContainerPtrToValuePtr(UObject *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:799
void ClearValue(void *Data) const
Definition UnrealType.h:988
UE_FORCEINLINE_HINT int32 GetOffset_ReplaceWith_ContainerPtrToValuePtr() const
Definition UnrealType.h:464
UE_FORCEINLINE_HINT void CopyCompleteValue_InContainer(void *Dest, void const *Src) const
Definition UnrealType.h:927
COREUOBJECT_API EPropertyVisitorControlFlow Visit(const FPropertyVisitorData &Data, const TFunctionRef< EPropertyVisitorControlFlow(const FPropertyVisitorPath &, const FPropertyVisitorData &)> InFunc) const
Definition Property.cpp:1222
UE_FORCEINLINE_HINT ValueType * ContainerPtrToValuePtr(void *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:804
virtual COREUOBJECT_API bool IsIntrusiveOptionalValueSet(const void *Data) const
Definition Property.cpp:2368
COREUOBJECT_API void SetElementSize(int32 NewSize)
Definition Property.cpp:721
FProperty * PropertyLinkNext
Definition UnrealType.h:211
virtual COREUOBJECT_API FString GetCPPMacroType(FString &ExtendedTypeText) const
Definition Property.cpp:987
COREUOBJECT_API void PerformOperationWithSetter(void *OutContainer, void *DirectPropertyAddress, TFunctionRef< void(void *)> DirectValueAccessFunc) const
Definition Property.cpp:1364
FProperty * GetOwnerProperty()
Definition UnrealType.h:1244
virtual COREUOBJECT_API void EmitReferenceInfo(UE::GC::FSchemaBuilder &Schema, int32 BaseOffset, TArray< const FStructProperty * > &EncounteredStructProps, UE::GC::FPropertyStack &DebugPath)
Definition GarbageCollection.cpp:6669
virtual COREUOBJECT_API int32 GetMinAlignment() const
Definition Property.cpp:1193
void CopyCompleteValue(void *Dest, void const *Src) const
Definition UnrealType.h:913
UE_FORCEINLINE_HINT void ClearPropertyFlags(EPropertyFlags NewFlags)
Definition UnrealType.h:1275
UE_FORCEINLINE_HINT void SetPropertyFlags(EPropertyFlags NewFlags)
Definition UnrealType.h:1271
virtual COREUOBJECT_API bool SameType(const FProperty *Other) const
Definition Property.cpp:1277
const FProperty * GetOwnerProperty() const
Definition UnrealType.h:1254
virtual COREUOBJECT_API void CopyCompleteValueToScriptVM(void *Dest, void const *Src) const
Definition Property.cpp:888
int32 Link(FArchive &Ar)
Definition UnrealType.h:474
UE_FORCEINLINE_HINT int32 GetOffset_ForUFunction() const
Definition UnrealType.h:449
virtual COREUOBJECT_API void * ResolveVisitedPathInfo(void *Data, const FPropertyVisitorInfo &Info) const
Definition Property.cpp:1245
void * PointerToValuePtr(void const *ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, int32 ArrayIndex=0) const
Definition UnrealType.h:777
virtual COREUOBJECT_API void * GetValueAddressAtIndex_Direct(const FProperty *Inner, void *InValueAddress, int32 Index) const
Definition Property.cpp:1301
virtual void virtual ExportText_Internal(FString &ValueStr, const void *PropertyValueOrContainer, EPropertyPointerType PointerType, const void *DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope=nullptr) const PURE_VIRTUAL(FProperty const TCHAR ImportText_Internal)(const TCHAR *Buffer, void *ContainerOrPropertyPtr, EPropertyPointerType PointerType, UObject *OwnerObject, int32 PortFlags, FOutputDevice *ErrorText) const PURE_VIRTUAL(FProperty
Definition UnrealType.h:719
virtual COREUOBJECT_API bool UseBinaryOrNativeSerialization(const FArchive &Ar) const
Definition Property.cpp:2421
virtual COREUOBJECT_API bool LoadTypeName(UE::FPropertyTypeName Type, const FPropertyTag *Tag=nullptr)
Definition Property.cpp:2426
COREUOBJECT_API void Init()
Definition Property.cpp:798
int32 GetElementSize() const
Definition UnrealType.h:291
UE_FORCEINLINE_HINT ValueType const * ContainerPtrToValuePtr(UObject const *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:809
virtual FString GetCPPType(FString *ExtendedTypeText=NULL, uint32 CPPExportFlags=0) const PURE_VIRTUAL(FProperty
Definition UnrealType.h:339
friend class UEProperty_Private::FProperty_DoNotUse
Definition UnrealType.h:418
COREUOBJECT_API uint32 GetValueTypeHash(const void *Src) const
Definition Property.cpp:2345
UE_FORCEINLINE_HINT bool ContainsInstancedObjectProperty() const
Definition UnrealType.h:1193
virtual void CallGetter(const void *Container, void *OutValue) const
Definition UnrealType.h:376
virtual COREUOBJECT_API FName GetID() const
Definition Property.cpp:1184
virtual bool HasSetterOrGetter() const
Definition UnrealType.h:358
const ValueType * ContainerPtrToValuePtrForDefaults(const UStruct *ContainerClass, const void *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:849
virtual COREUOBJECT_API void PostDuplicate(const FField &InField) override
Definition Property.cpp:869
void LinkWithoutChangingOffset(FArchive &Ar)
Definition UnrealType.h:469
static COREUOBJECT_API const TCHAR * ImportSingleProperty(const TCHAR *Str, void *DestData, const UStruct *ObjectStruct, UObject *SubobjectOuter, int32 PortFlags, FOutputDevice *Warn, TArray< struct FDefinedProperty > &DefinedProperties)
Definition Property.cpp:1581
COREUOBJECT_API void PerformOperationWithGetter(void *OutContainer, const void *DirectPropertyAddress, TFunctionRef< void(const void *)> DirectValueAccessFunc) const
Definition Property.cpp:1394
virtual COREUOBJECT_API void ClearValueInternal(void *Data) const
Definition Property.cpp:929
COREUOBJECT_API void SetOffset_Internal(int32 NewOffset)
Definition Property.cpp:1272
COREUOBJECT_API void SetSingleValue_InContainer(void *OutContainer, const void *InValue, int32 ArrayIndex) const
Definition Property.cpp:1308
UE_FORCEINLINE_HINT int32 GetOffset_ForGC() const
Definition UnrealType.h:454
FProperty * DestructorLinkNext
Definition UnrealType.h:228
UE_FORCEINLINE_HINT int32 GetSize() const
Definition UnrealType.h:1206
virtual COREUOBJECT_API void CopyCompleteValueToScriptVM_InContainer(void *OutValue, void const *InContainer) const
Definition Property.cpp:903
virtual COREUOBJECT_API bool ContainsObjectReference(TArray< const FStructProperty * > &EncounteredStructProps, EPropertyObjectReferenceType InReferenceType=EPropertyObjectReferenceType::Strong) const
Definition GarbageCollection.cpp:6521
void ExportTextItem_InContainer(FString &ValueStr, const void *Container, const void *DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope=nullptr) const
Definition UnrealType.h:590
COREUOBJECT_API void * AllocateAndInitializeValue() const
Definition Property.cpp:1282
COREUOBJECT_API bool ShouldSerializeValue(FArchive &Ar) const
Definition Property.cpp:1025
virtual COREUOBJECT_API void ClearIntrusiveOptionalValue(void *Data) const
Definition Property.cpp:2374
const ValueType * ContainerPtrToValuePtrForDefaults(const UStruct *ContainerClass, const UObject *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:840
virtual COREUOBJECT_API void CopySingleValueFromScriptVM(void *Dest, void const *Src) const
Definition Property.cpp:893
virtual bool Identical(const void *A, const void *B, uint32 PortFlags=0) const PURE_VIRTUAL(FProperty
Definition UnrealType.h:515
UE_FORCEINLINE_HINT bool IsEditorOnlyProperty() const
Definition UnrealType.h:1318
COREUOBJECT_API bool ShouldPort(uint32 PortFlags=0) const
Definition Property.cpp:1135
void CopySingleValue(void *Dest, void const *Src) const
Definition UnrealType.h:879
bool Identical_InContainer(const void *A, const void *B, int32 ArrayIndex=0, uint32 PortFlags=0) const
Definition UnrealType.h:526
UE_FORCEINLINE_HINT bool IsInContainer(const UStruct *ContainerClass) const
Definition UnrealType.h:863
void InitializeValue_InContainer(void *Dest) const
Definition UnrealType.h:1126
UE_FORCEINLINE_HINT EPropertyFlags GetPropertyFlags() const
Definition UnrealType.h:1267
virtual bool HasGetter() const
Definition UnrealType.h:353
virtual COREUOBJECT_API void FinishDestroyInternal(void *Data) const
Definition Property.cpp:947
virtual COREUOBJECT_API bool ContainsClearOnFinishDestroyInternal(TArray< const FStructProperty * > &EncounteredStructProps) const
Definition Property.cpp:942
UE_FORCEINLINE_HINT bool HasAnyPropertyFlags(uint64 FlagsToCheck) const
Definition UnrealType.h:1286
FProperty * NextRef
Definition UnrealType.h:216
virtual COREUOBJECT_API void EmitIntrusiveOptionalReferenceInfo(UE::GC::FSchemaBuilder &Schema, int32 BaseOffset, TArray< const FStructProperty * > &EncounteredStructProps, UE::GC::FPropertyStack &DebugPath)
Definition Property.cpp:2379
virtual void CallSetter(void *Container, const void *InValue) const
Definition UnrealType.h:367
virtual COREUOBJECT_API void CopyCompleteValueFromScriptVM_InContainer(void *OutContainer, void const *InValue) const
Definition Property.cpp:916
virtual COREUOBJECT_API EConvertFromTypeResult ConvertFromType(const FPropertyTag &Tag, FStructuredArchive::FSlot Slot, uint8 *Data, const UStruct *DefaultsStruct, const uint8 *Defaults)
Definition Property.cpp:1207
COREUOBJECT_API void DestroyAndFreeValue(void *InMemory) const
Definition Property.cpp:1292
virtual COREUOBJECT_API void InitializeValueInternal(void *Dest) const
Definition Property.cpp:937
const TCHAR * ImportText_InContainer(const TCHAR *Buffer, void *Container, UObject *OwnerObject, int32 PortFlags, FOutputDevice *ErrorText=(FOutputDevice *) GWarn) const
Definition UnrealType.h:604
virtual COREUOBJECT_API bool SupportsNetSharedSerialization() const
Definition Property.cpp:1113
virtual COREUOBJECT_API void CopyCompleteValueFromScriptVM(void *Dest, void const *Src) const
Definition Property.cpp:898
void DestroyValue_InContainer(void *Dest) const
Definition UnrealType.h:1038
void SerializeNonMatchingBinProperty(FStructuredArchive::FSlot Slot, void *Data, void const *DefaultData, UStruct *DefaultStruct)
Definition UnrealType.h:561
ELifetimeCondition GetBlueprintReplicationCondition() const
Definition UnrealType.h:1326
virtual COREUOBJECT_API void DestroyValueInternal(void *Dest) const
Definition Property.cpp:933
virtual COREUOBJECT_API bool CanSerializeFromTypeName(UE::FPropertyTypeName Type) const
Definition Property.cpp:2438
uint16 RepIndex
Definition UnrealType.h:183
void SetValue_InContainer(void *OutContainer, const void *InValue) const
Definition UnrealType.h:633
void GetValue_InContainer(void const *InContainer, void *OutValue) const
Definition UnrealType.h:644
ValueType * ContainerPtrToValuePtrForDefaults(const UStruct *ContainerClass, void *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:831
FName RepNotifyFunc
Definition UnrealType.h:240
void InitializeValue(void *Dest) const
Definition UnrealType.h:1108
UE_FORCEINLINE_HINT ValueType const * ContainerPtrToValuePtr(void const *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:814
friend class FMapProperty
Definition UnrealType.h:417
bool ContainsFinishDestroy(TArray< const FStructProperty * > &EncounteredStructProps) const
Definition UnrealType.h:1053
void ClearValue_InContainer(void *Data, int32 ArrayIndex=0) const
Definition UnrealType.h:1005
bool ContainsWeakObjectReference() const
Definition UnrealType.h:1181
void ExportTextItem_Direct(FString &ValueStr, const void *PropertyValue, const void *DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope=nullptr) const
Definition UnrealType.h:585
void SetBlueprintReplicationCondition(ELifetimeCondition InBlueprintReplicationCondition)
Definition UnrealType.h:1327
UE_FORCEINLINE_HINT bool HasAllPropertyFlags(uint64 FlagsToCheck) const
Definition UnrealType.h:1297
UE_FORCEINLINE_HINT int32 GetOffset_ForInternal() const
Definition UnrealType.h:459
UE_FORCEINLINE_HINT bool IsInContainer(int32 ContainerSize) const
Definition UnrealType.h:858
virtual COREUOBJECT_API void CopyValuesInternal(void *Dest, void const *Src, int32 Count) const
Definition Property.cpp:2352
ValueType * ContainerPtrToValuePtrForDefaults(const UStruct *ContainerClass, UObject *ContainerPtr, int32 ArrayIndex=0) const
Definition UnrealType.h:822
virtual COREUOBJECT_API void InstanceSubobjects(void *Data, void const *DefaultData, TNotNull< UObject * > Owner, struct FObjectInstancingGraph *InstanceGraph)
Definition Property.cpp:1189
virtual void SerializeItem(FStructuredArchive::FSlot Slot, void *Value, void const *Defaults=NULL) const PURE_VIRTUAL(FProperty virtual COREUOBJECT_API boo NetSerializeItem)(FArchive &Ar, UPackageMap *Map, void *Data, TArray< uint8 > *MetaData=NULL) const
Definition UnrealType.h:582
virtual bool HasSetter() const
Definition UnrealType.h:348
UE_FORCEINLINE_HINT int32 GetOffset_ForDebug() const
Definition UnrealType.h:444
Definition UObjectGlobals.h:2492
Definition UnrealType.h:4564
UE_FORCEINLINE_HINT FScriptArrayHelper_InContainer(const FArrayProperty *InProperty, const UObject *InContainer, int32 FixedArrayIndex=0)
Definition UnrealType.h:4571
UE_FORCEINLINE_HINT FScriptArrayHelper_InContainer(const FArrayProperty *InProperty, const void *InContainer, int32 FixedArrayIndex=0)
Definition UnrealType.h:4566
Definition UnrealType.h:4175
int32 AddUninitializedValues(int32 Count)
Definition UnrealType.h:4340
void EmptyAndAddUninitializedValues(int32 Count)
Definition UnrealType.h:4271
void EmptyValues(int32 Slack=0)
Definition UnrealType.h:4371
UE_FORCEINLINE_HINT uint8 * GetElementPtr(int32 Index=0)
Definition UnrealType.h:4252
FScriptArray * HeapArray
Definition UnrealType.h:4555
void MoveAssign(void *InOtherArray)
Definition UnrealType.h:4424
void CountBytes(FArchive &Ar) const
Definition UnrealType.h:4436
void SwapValues(int32 A, int32 B)
Definition UnrealType.h:4414
UE_FORCEINLINE_HINT int32 AddValue()
Definition UnrealType.h:4331
int32 Num() const
Definition UnrealType.h:4215
void ClearValues(int32 Index, int32 Count=1)
Definition UnrealType.h:4402
int32 AddValues(int32 Count)
Definition UnrealType.h:4321
bool ExpandForIndex(int32 Index)
Definition UnrealType.h:4284
uint8 * GetRawPtr(int32 Index=0)
Definition UnrealType.h:4236
void DestroyContainer_Unsafe()
Definition UnrealType.h:4444
void EmptyAndAddValues(int32 Count)
Definition UnrealType.h:4260
void InsertValues(int32 Index, int32 Count=1)
Definition UnrealType.h:4360
UE_FORCEINLINE_HINT FScriptArrayHelper(const FArrayProperty *InProperty, const void *InArray)
Definition UnrealType.h:4197
UE_FORCEINLINE_HINT bool IsValidIndex(int32 Index) const
Definition UnrealType.h:4207
int32 NumUnchecked() const
Definition UnrealType.h:4226
static FScriptArrayHelper CreateHelperFormInnerProperty(const FProperty *InInnerProperty, const void *InArray, EArrayPropertyFlags InArrayFlags=EArrayPropertyFlags::None)
Definition UnrealType.h:4449
FFreezableScriptArray * FreezableArray
Definition UnrealType.h:4556
void Resize(int32 Count)
Definition UnrealType.h:4299
UE_FORCEINLINE_HINT int32 AddUninitializedValue()
Definition UnrealType.h:4351
void RemoveValues(int32 Index, int32 Count=1)
Definition UnrealType.h:4389
Definition ScriptArray.h:328
Definition UnrealType.h:5659
UE_FORCEINLINE_HINT FScriptMapHelper_InContainer(const FMapProperty *InProperty, const void *InArray, int32 FixedArrayIndex=0)
Definition UnrealType.h:5661
Definition UnrealType.h:4678
FProperty * ValueProp
Definition UnrealType.h:5648
void RemoveAt(int32 InternalIndex, int32 Count=1)
Definition UnrealType.h:5090
FScriptMapHelper(FProperty *InKeyProp, FProperty *InValueProp, const void *InMap, const FScriptMapLayout &InMapLayout, EMapPropertyFlags InMapFlags)
Definition UnrealType.h:4708
uint8 * GetKeyPtr(const FIterator Iterator)
Definition UnrealType.h:4893
uint8 * GetValuePtr(const FIterator Iterator)
Definition UnrealType.h:4923
UE_FORCEINLINE_HINT const uint8 * GetPairPtr(const int32 InternalIndex) const
Definition UnrealType.h:4805
void MoveAssign(void *InOtherMap)
Definition UnrealType.h:4998
uint8 * FindValueFromHash(const void *KeyPtr)
Definition UnrealType.h:5306
EMapPropertyFlags MapFlags
Definition UnrealType.h:5655
int32 FindMapIndexWithKey(const void *PairWithKeyToFind, int32 IndexHint=0) const
Definition UnrealType.h:5222
int32 NumUnchecked() const
Definition UnrealType.h:4754
uint8 * GetPairPtr(const FIterator Iterator)
Definition UnrealType.h:4863
uint8 * FindNthKeyPtr(int32 N)
Definition UnrealType.h:4962
uint8 * GetValuePtr(int32 InternalIndex)
Definition UnrealType.h:4841
UE_FORCEINLINE_HINT const uint8 * GetPairPtr(const FIterator Iterator) const
Definition UnrealType.h:4879
uint8 * FindMapPairPtrFromHash(const void *KeyPtr)
Definition UnrealType.h:5298
uint8 * FindNthValuePtr(int32 N)
Definition UnrealType.h:4974
int32 FindLogicalIndex(int32 InternalIdx) const
Definition UnrealType.h:5185
int32 GetMaxIndex() const
Definition UnrealType.h:4766
FScriptMapLayout MapLayout
Definition UnrealType.h:5654
const uint8 * FindNthPairPtr(int32 N) const
Definition UnrealType.h:4986
uint8 * FindMapPairPtrWithKey(const void *PairWithKeyToFind, int32 IndexHint=0)
Definition UnrealType.h:5275
FIterator CreateIterator() const
Definition UnrealType.h:4715
uint8 * FindNthPairPtr(int32 N)
Definition UnrealType.h:4950
int32 FindMapPairIndexFromHash(const void *KeyPtr)
Definition UnrealType.h:5283
int32 FindInternalIndex(int32 LogicalIdx) const
Definition UnrealType.h:5148
void * FindOrAdd(const void *KeyPtr)
Definition UnrealType.h:5386
int32 AddDefaultValue_Invalid_NeedsRehash()
Definition UnrealType.h:5052
bool RemovePair(const void *KeyPtr)
Definition UnrealType.h:5423
FIterator CreateIterator(const int32 InLogicalIndex) const
Definition UnrealType.h:4720
int32 AddUninitializedValue()
Definition UnrealType.h:5014
FProperty * GetKeyProperty() const
Definition UnrealType.h:5070
UE_FORCEINLINE_HINT const uint8 * GetValuePtr(const FIterator Iterator) const
Definition UnrealType.h:4939
FProperty * KeyProp
Definition UnrealType.h:5647
UE_FORCEINLINE_HINT bool IsValidIndex(int32 InternalIndex) const
Definition UnrealType.h:4732
static FScriptMapHelper CreateHelperFormInnerProperties(FProperty *InKeyProperty, FProperty *InValProperty, const void *InMap, EMapPropertyFlags InMapFlags=EMapPropertyFlags::None)
Definition UnrealType.h:5445
void EmptyValues(int32 Slack=0)
Definition UnrealType.h:5028
FProperty * GetValueProperty() const
Definition UnrealType.h:5080
uint8 * GetKeyPtr(int32 InternalIndex)
Definition UnrealType.h:4819
UE_FORCEINLINE_HINT const uint8 * GetKeyPtr(const FIterator Iterator) const
Definition UnrealType.h:4911
FFreezableScriptMap * FreezableMap
Definition UnrealType.h:5652
FScriptMap * HeapMap
Definition UnrealType.h:5651
uint8 * GetPairPtr(int32 InternalIndex)
Definition UnrealType.h:4783
int32 Num() const
Definition UnrealType.h:4742
FScriptMapHelper(const FMapProperty *InProperty, const void *InMap)
Definition UnrealType.h:4703
void AddPair(const void *KeyPtr, const void *ValuePtr)
Definition UnrealType.h:5320
Definition Map.h:421
Definition UnrealType.h:6289
UE_FORCEINLINE_HINT FScriptSetHelper_InContainer(const FSetProperty *InProperty, const void *InArray, int32 FixedArrayIndex=0)
Definition UnrealType.h:6291
Definition UnrealType.h:5682
FScriptSetHelper(FProperty *InElementProp, const void *InSet, const FScriptSetLayout &InLayout)
Definition UnrealType.h:5710
UE_FORCEINLINE_HINT const uint8 * GetElementPtr(int32 InternalIndex) const
Definition UnrealType.h:5805
FScriptSetHelper(const FSetProperty *InProperty, const void *InSet)
Definition UnrealType.h:5705
int32 FindElementIndex(const void *ElementToFind, int32 IndexHint=0) const
Definition UnrealType.h:6048
uint8 * FindElementPtrFromHash(const void *ElementToFind)
Definition UnrealType.h:6118
FProperty * ElementProp
Definition UnrealType.h:6283
int32 AddDefaultValue_Invalid_NeedsRehash()
Definition UnrealType.h:5909
int32 AddUninitializedValue()
Definition UnrealType.h:5877
static int32 Num(const void *Target)
Definition UnrealType.h:5772
uint8 * GetElementPtr(const FIterator Iterator)
Definition UnrealType.h:5817
uint8 * FindElementPtr(const void *ElementToFind, int32 IndexHint=0)
Definition UnrealType.h:6098
int32 FindInternalIndex(int32 LogicalIdx) const
Definition UnrealType.h:5982
FScriptSet * Set
Definition UnrealType.h:6284
void AddElement(const void *ElementToAdd)
Definition UnrealType.h:6126
FIterator CreateIterator() const
Definition UnrealType.h:5689
void MoveAssign(void *InOtherSet)
Definition UnrealType.h:5865
bool RemoveElement(const void *ElementToRemove)
Definition UnrealType.h:6159
int32 Num() const
Definition UnrealType.h:5735
FScriptSetLayout SetLayout
Definition UnrealType.h:6285
int32 GetMaxIndex() const
Definition UnrealType.h:5758
void EmptyElements(int32 Slack=0)
Definition UnrealType.h:5888
int32 NumUnchecked() const
Definition UnrealType.h:5747
uint8 * FindNthElementPtr(int32 N)
Definition UnrealType.h:5841
FProperty * GetElementProperty() const
Definition UnrealType.h:5922
void RemoveAt(int32 InternalIndex, int32 Count=1)
Definition UnrealType.h:5932
int32 FindElementIndexFromHash(const void *ElementToFind) const
Definition UnrealType.h:6106
int32 FindLogicalIndex(int32 InternalIdx) const
Definition UnrealType.h:6015
uint8 * GetElementPtr(int32 InternalIndex)
Definition UnrealType.h:5786
UE_FORCEINLINE_HINT bool IsValidIndex(int32 InternalIndex) const
Definition UnrealType.h:5725
UE_FORCEINLINE_HINT const uint8 * GetElementPtr(const FIterator Iterator) const
Definition UnrealType.h:5830
static FScriptSetHelper CreateHelperFormElementProperty(FProperty *InElementProperty, const void *InSet)
Definition UnrealType.h:6179
FIterator CreateIterator(const int32 InLogicalIndex) const
Definition UnrealType.h:5694
const uint8 * FindNthElementPtr(int32 N) const
Definition UnrealType.h:5853
Definition SerializedPropertyScope.h:13
Definition UnrealType.h:4028
int32 GetStride() const
Definition UnrealType.h:4130
const FProperty * GetElementProperty() const
Definition UnrealType.h:4155
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:4036
int32 GetNum(void *InSet) const
Definition UnrealType.h:4120
TTypeFundamentals::TCppType TCppType
Definition UnrealType.h:4037
bool IsValidIndex(void *InSet, int32 InternalIndex) const
Definition UnrealType.h:4139
uint8 * GetElementPtr(void *InSet, int32 InternalIndex) const
Definition UnrealType.h:4149
Definition UnrealType.h:3488
UE_FORCEINLINE_HINT void SetMetaClass(UClass *NewMetaClass)
Definition UnrealType.h:3547
Definition UnrealType.h:3331
Definition UnrealType.h:6306
Definition StructuredArchiveSlots.h:52
UE_API FStructuredArchiveStream EnterStream()
Definition StructuredArchiveSlots.h:263
Definition StructuredArchiveSlots.h:193
Definition UnrealType.h:2368
Definition UnrealType.h:2400
Definition UnrealType.h:2432
Definition UnrealType.h:3204
Definition ArrayView.h:139
Definition Array.h:670
Definition List.h:439
Definition EnumAsByte.h:22
Definition UnrealType.h:3008
virtual bool ContainsObjectReference(TArray< const FStructProperty * > &EncounteredStructProps, EPropertyObjectReferenceType InReferenceType=EPropertyObjectReferenceType::Strong) const override
Definition UnrealType.h:3067
InTCppType TCppType
Definition UnrealType.h:3011
TFObjectPropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParamsWithoutClass &Prop, UClass *InClass)
Definition UnrealType.h:3041
TProperty< InTCppType, FObjectPropertyBase > Super
Definition UnrealType.h:3010
TFObjectPropertyBase(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition UnrealType.h:3019
TFObjectPropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FObjectPropertyParams &Prop)
Definition UnrealType.h:3030
TFObjectPropertyBase(EInternal InInernal, FFieldClass *InClass)
Definition UnrealType.h:3014
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:3012
Definition UnrealType.h:7083
TFieldIterator(const UStruct *InStruct, EFieldIterationFlags InIterationFlags=EFieldIterationFlags::Default)
Definition UnrealType.h:7099
TFieldIterator(const UStruct *InStruct, EFieldIteratorFlags::SuperClassFlags InSuperClassFlags, EFieldIteratorFlags::DeprecatedPropertyFlags InDeprecatedFieldFlags=EFieldIteratorFlags::IncludeDeprecated, EFieldIteratorFlags::InterfaceClassFlags InInterfaceFieldFlags=EFieldIteratorFlags::ExcludeInterfaces)
Definition UnrealType.h:7111
bool operator==(const TFieldIterator< T > &Rhs) const
Definition UnrealType.h:7130
const T * operator*() const
Definition UnrealType.h:7144
T * operator*()
Definition UnrealType.h:7139
void operator++()
Definition UnrealType.h:7133
bool operator!=(const TFieldIterator< T > &Rhs) const
Definition UnrealType.h:7131
const UStruct * GetStruct()
Definition UnrealType.h:7154
void IterateToNext()
Definition UnrealType.h:7159
T * operator->()
Definition UnrealType.h:7149
Definition AssetRegistryState.h:50
Definition UnrealString.h.inl:34
Definition ScriptDelegates.h:509
Definition UnrealType.h:1446
static UE_FORCEINLINE_HINT void SetPropertyValue(void *A, TCppType const &Value)
Definition UnrealType.h:1487
static UE_FORCEINLINE_HINT bool HasIntrusiveUnsetOptionalState()
Definition UnrealType.h:1502
static UE_FORCEINLINE_HINT TCppType const & GetPropertyValue(void const *A)
Definition UnrealType.h:1472
static UE_FORCEINLINE_HINT void DestroyPropertyValue(void *A)
Definition UnrealType.h:1497
static UE_FORCEINLINE_HINT bool IsIntrusiveOptionalValueSet(const void *A)
Definition UnrealType.h:1512
static UE_FORCEINLINE_HINT TCppType GetOptionalPropertyValue(void const *B)
Definition UnrealType.h:1482
static UE_FORCEINLINE_HINT void InitializeIntrusiveUnsetOptionalValue(void *Data)
Definition UnrealType.h:1507
static EPropertyFlags GetComputedFlagsPropertyFlags()
Definition UnrealType.h:1524
static UE_FORCEINLINE_HINT TCppType * InitializePropertyValue(void *A)
Definition UnrealType.h:1492
static UE_FORCEINLINE_HINT void ClearIntrusiveOptionalValue(void *A)
Definition UnrealType.h:1517
static UE_FORCEINLINE_HINT TCppType * GetPropertyValuePtr(void *A)
Definition UnrealType.h:1467
InTCppType TCppType
Definition UnrealType.h:1449
static UE_FORCEINLINE_HINT TCppType const * GetPropertyValuePtr(void const *A)
Definition UnrealType.h:1462
static UE_FORCEINLINE_HINT TCHAR const * GetTypeName()
Definition UnrealType.h:1456
static UE_FORCEINLINE_HINT TCppType GetDefaultPropertyValue()
Definition UnrealType.h:1477
Definition UnrealType.h:7597
UE_FORCEINLINE_HINT const PairType & operator*() const
Definition UnrealType.h:7620
UE_FORCEINLINE_HINT const T * Key() const
Definition UnrealType.h:7631
UE_FORCEINLINE_HINT const PairType * operator->() const
Definition UnrealType.h:7625
TPropertyValueIterator(const UStruct *InStruct, const void *InStructValue, EPropertyValueIteratorFlags InRecursionFlags=EPropertyValueIteratorFlags::FullRecursion, EFieldIteratorFlags::DeprecatedPropertyFlags InDeprecatedPropertyFlags=EFieldIteratorFlags::IncludeDeprecated)
Definition UnrealType.h:7609
TPropertyValueIterator()=default
Definition UnrealType.h:6537
TProperty_MulticastDelegate(EInternal InInernal, FFieldClass *InClass)
Definition UnrealType.h:6554
TProperty_MulticastDelegate(FFieldVariant InOwner, const FName &InName, UFunction *InSignatureFunction=nullptr)
Definition UnrealType.h:6542
TProperty_MulticastDelegate(FFieldVariant InOwner, const UECodeGen_Private::FMulticastDelegatePropertyParams &Prop)
Definition UnrealType.h:6564
TProperty< InTCppType, FMulticastDelegateProperty > Super
Definition UnrealType.h:6539
virtual FString GetCPPType(FString *ExtendedTypeText, uint32 CPPExportFlags) const override
Definition UnrealType.h:6585
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:6541
InTCppType TCppType
Definition UnrealType.h:6540
TProperty_MulticastDelegate(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition UnrealType.h:6548
Definition UnrealType.h:1902
virtual double GetFloatingPointPropertyValue(void const *Data) const override
Definition UnrealType.h:2135
virtual FString GetNumericPropertyValueToString(void const *Data) const override
Definition UnrealType.h:2101
virtual uint32 GetValueTypeHashInternal(const void *Src) const override
Definition UnrealType.h:1943
virtual int64 GetSignedIntPropertyValue(void const *Data) const override
Definition UnrealType.h:2111
virtual int64 GetSignedIntPropertyValue_InContainer(void const *Container) const override
Definition UnrealType.h:2116
UE_FORCEINLINE_HINT void ConvertFromArithmeticValue(FStructuredArchive::FSlot Slot, void *Obj, const FPropertyTag &Tag) const
Definition UnrealType.h:1950
virtual FString GetNumericPropertyValueToString_InContainer(void const *Container) const override
Definition UnrealType.h:2105
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:1906
virtual void SetIntPropertyValue(void *Data, int64 Value) const override
Definition UnrealType.h:2081
TProperty_Numeric(FFieldVariant InOwner, const UECodeGen_Private::FPropertyParamsBaseWithOffset &Prop)
Definition UnrealType.h:1923
virtual uint64 GetUnsignedIntPropertyValue(void const *Data) const override
Definition UnrealType.h:2123
virtual void SetIntPropertyValue(void *Data, uint64 Value) const override
Definition UnrealType.h:2076
virtual uint64 GetUnsignedIntPropertyValue_InContainer(void const *Container) const override
Definition UnrealType.h:2128
InTCppType TCppType
Definition UnrealType.h:1905
virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag &Tag, FStructuredArchive::FSlot Slot, uint8 *Data, const UStruct *DefaultsStruct, const uint8 *Defaults) override
Definition UnrealType.h:1992
virtual bool IsFloatingPoint() const override
Definition UnrealType.h:2068
TProperty_WithEqualityAndSerializer< InTCppType, FNumericProperty > Super
Definition UnrealType.h:1904
virtual void SetNumericPropertyValueFromString(void *Data, TCHAR const *Value) const override
Definition UnrealType.h:2091
virtual void SetFloatingPointPropertyValue(void *Data, double Value) const override
Definition UnrealType.h:2086
TProperty_Numeric(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition UnrealType.h:1913
virtual void SetNumericPropertyValueFromString_InContainer(void *Container, TCHAR const *Value) const override
Definition UnrealType.h:2095
virtual bool IsInteger() const override
Definition UnrealType.h:2072
TProperty_Numeric(EInternal InInernal, FFieldClass *InClass)
Definition UnrealType.h:1908
Definition UnrealType.h:1694
TProperty_WithEqualityAndSerializer(FFieldVariant InOwner, const UECodeGen_Private::FPropertyParamsBaseWithOffset &Prop)
Definition UnrealType.h:1716
TProperty_WithEqualityAndSerializer(EInternal InInernal, FFieldClass *InClass)
Definition UnrealType.h:1701
InTCppType TCppType
Definition UnrealType.h:1698
virtual bool Identical(const void *A, const void *B, uint32 PortFlags=0) const override
Definition UnrealType.h:1740
TProperty_WithEqualityAndSerializer(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition UnrealType.h:1706
Super::TTypeFundamentals TTypeFundamentals
Definition UnrealType.h:1699
TProperty< InTCppType, TInPropertyBaseClass > Super
Definition UnrealType.h:1697
virtual void SerializeItem(FStructuredArchive::FSlot Slot, void *Value, void const *Defaults) const override
Definition UnrealType.h:1757
Definition UnrealType.h:1538
virtual void InitializeValueInternal(void *Dest) const override
Definition UnrealType.h:1619
UE_FORCEINLINE_HINT TCppType const & GetPropertyValue_InContainer(void const *A, int32 ArrayIndex=0) const
Definition UnrealType.h:1645
virtual void CopyValuesInternal(void *Dest, void const *Src, int32 Count) const override
Definition UnrealType.h:1608
virtual void ClearIntrusiveOptionalValue(void *Data) const override
Definition UnrealType.h:1685
UE_FORCEINLINE_HINT TCppType const * GetPropertyValuePtr_InContainer(void const *A, int32 ArrayIndex=0) const
Definition UnrealType.h:1635
virtual void LinkInternal(FArchive &Ar) override
Definition UnrealType.h:1602
InTCppType TCppType
Definition UnrealType.h:1541
TProperty(FFieldVariant InOwner, PropertyParamsType &Prop)
Definition UnrealType.h:1562
virtual bool IsIntrusiveOptionalValueSet(const void *Data) const override
Definition UnrealType.h:1680
virtual FString GetCPPType(FString *ExtendedTypeText=NULL, uint32 CPPExportFlags=0) const override
Definition UnrealType.h:1591
UE_FORCEINLINE_HINT TCppType GetOptionalPropertyValue_InContainer(void const *B, int32 ArrayIndex=0) const
Definition UnrealType.h:1650
TPropertyTypeFundamentals< InTCppType > TTypeFundamentals
Definition UnrealType.h:1543
virtual void ClearValueInternal(void *Data) const override
Definition UnrealType.h:1615
virtual void DestroyValueInternal(void *Dest) const override
Definition UnrealType.h:1626
virtual void InitializeIntrusiveUnsetOptionalValue(void *Data) const override
Definition UnrealType.h:1675
virtual bool HasIntrusiveUnsetOptionalState() const override
Definition UnrealType.h:1670
TProperty(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition UnrealType.h:1550
virtual int32 GetMinAlignment() const override
Definition UnrealType.h:1598
UE_FORCEINLINE_HINT void GetValue_InContainer(void const *InContainer, TCppType *OutValue) const
Definition UnrealType.h:1665
UE_FORCEINLINE_HINT void SetPropertyValue_InContainer(void *A, TCppType const &Value, int32 ArrayIndex=0) const
Definition UnrealType.h:1655
UE_FORCEINLINE_HINT TCppType * GetPropertyValuePtr_InContainer(void *A, int32 ArrayIndex=0) const
Definition UnrealType.h:1640
UE_FORCEINLINE_HINT void SetValue_InContainer(void *OutContainer, const TCppType &InValue) const
Definition UnrealType.h:1660
TProperty(EInternal InInernal, FFieldClass *InClass)
Definition UnrealType.h:1545
TInPropertyBaseClass Super
Definition UnrealType.h:1542
Definition ScriptArray.h:21
Definition ScriptDelegates.h:66
Definition Map.h:152
static constexpr FScriptMapLayout GetScriptLayout(int32 KeySize, int32 KeyAlignment, int32 ValueSize, int32 ValueAlignment)
Definition Map.h:156
Definition ScriptSparseSet.h:26
void * GetData(int32 Index, const FScriptSparseSetLayout &Layout)
Definition ScriptSparseSet.h:104
int32 Num() const
Definition ScriptSparseSet.h:83
static constexpr FScriptSparseSetLayout GetScriptLayout(int32 ElementSize, int32 ElementAlignment)
Definition ScriptSparseSet.h:28
bool IsValidIndex(int32 Index) const
Definition ScriptSparseSet.h:68
Definition SharedPointer.h:692
Definition Class.h:3793
Definition UnrealType.h:1384
static void Unsafe_AlterOffset(FProperty &Property, const int32 OffsetOverride)
Definition UnrealType.h:1394
Definition PropertyTypeName.h:151
Definition PropertyTypeName.h:46
Definition GarbageCollectionSchema.h:62
Definition GarbageCollectionSchema.h:265
CORE_API FArchive & GetUnderlyingArchive() const
Definition StructuredArchiveSlots.cpp:7
Definition Class.h:2791
Definition Class.h:181
Definition Class.h:2476
FORCEINLINE UObject * GetOuter() const
Definition UObjectBase.h:223
FORCEINLINE UClass * GetClass() const
Definition UObjectBase.h:217
Definition Object.h:95
bool IsBasedOnArchetype(const UObject *const SomeObject) const
Definition UnrealType.h:7665
COREUOBJECT_API UObject * GetArchetype() const
Definition UObjectArchetype.cpp:283
Definition CoreNet.h:191
Definition PropertyWrapper.h:23
Definition Class.h:1720
Definition Class.h:480
virtual UStruct * GetInheritanceSuper() const
Definition Class.h:659
Definition UnrealType.h:7038
SuperClassFlags
Definition UnrealType.h:7040
InterfaceClassFlags
Definition UnrealType.h:7052
@ ExcludeInterfaces
Definition UnrealType.h:7053
DeprecatedPropertyFlags
Definition UnrealType.h:7046
@ IncludeDeprecated
Definition UnrealType.h:7048
@ ExcludeDeprecated
Definition UnrealType.h:7047
Definition UnrealType.h:6834
const Type ArrayMove
Definition UnrealType.h:6854
const Type ResetToDefault
Definition UnrealType.h:6858
const Type ArrayAdd
Definition UnrealType.h:6840
const Type ValueSet
Definition UnrealType.h:6846
const Type ArrayRemove
Definition UnrealType.h:6842
const Type Redirected
Definition UnrealType.h:6852
const Type ArrayClear
Definition UnrealType.h:6844
const Type Unspecified
Definition UnrealType.h:6838
const Type ToggleEditable
Definition UnrealType.h:6856
uint32 Type
Definition UnrealType.h:6835
Definition FieldSystemNoiseAlgo.cpp:6
Definition ByteSwap.h:14
Definition UnrealType.h:151
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501
Definition CoreGlobals.cpp:268
void ExportEnumToBuffer(const UEnum *Enum, const FProperty *Prop, const FNumericProperty *NumericProp, FString &ValueStr, const void *PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void *DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope)
Definition EnumProperty.cpp:129
const TCHAR * ImportEnumFromBuffer(UEnum *Enum, const FProperty *PropertyToSet, const FNumericProperty *UnderlyingProp, const TCHAR *PropertyClassName, const TCHAR *Buffer, void *ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, FOutputDevice *ErrorText)
Definition EnumProperty.cpp:50
ENonNullableBehavior
Definition UnrealType.h:92
ENonNullableBehavior GetNonNullableBehavior()
Definition PropertyBaseObject.cpp:31
Definition GCObjectReferencer.cpp:27
FORCEINLINE UE_STRING_CLASS RhsType && Rhs
Definition String.cpp.inl:718
EPropertyBagResult GetPropertyValue(const FPropertyBagPropertyDesc *Desc, const void *Address, T &OutValue)
Definition PropertyBag.cpp:761
Definition AdvancedWidgetsModule.cpp:13
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition GetTypeHashable.h:11
Definition UnrealType.h:6698
FProperty * Property
Definition UnrealType.h:6700
int32 ArrayIndex
Definition UnrealType.h:6703
static FProperty * GetNextPropertyAndAdvance(const FCustomPropertyListNode *&Node)
Definition UnrealType.h:6721
struct FCustomPropertyListNode * PropertyListNext
Definition UnrealType.h:6709
struct FCustomPropertyListNode * SubPropertyList
Definition UnrealType.h:6706
FCustomPropertyListNode(FProperty *InProperty=nullptr, int32 InArrayIndex=0)
Definition UnrealType.h:6712
Definition UnrealType.h:1403
FProperty * Property
Definition UnrealType.h:1404
int32 Index
Definition UnrealType.h:1405
Definition Class.h:3684
Definition UnrealMemory.h:94
static FORCENOINLINE CORE_API void Free(void *Original)
Definition UnrealMemory.cpp:685
static UE_FORCEINLINE_HINT void * Memzero(void *Dest, SIZE_T Count)
Definition UnrealMemory.h:131
static UE_FORCEINLINE_HINT void * Memcpy(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:160
Definition Class.h:4941
Definition UnrealType.h:7001
FEditPropertyChain & PropertyChain
Definition UnrealType.h:7007
FPropertyChangedChainEvent(FEditPropertyChain &InPropertyChain, const FPropertyChangedEvent &SrcChangeEvent)
Definition UnrealType.h:7002
Definition UnrealType.h:6865
FName GetMemberPropertyName() const
Definition UnrealType.h:6962
int32 ObjectIteratorIndex
Definition UnrealType.h:6982
FProperty * MemberProperty
Definition UnrealType.h:6976
int32 GetNumObjectsBeingEdited() const
Definition UnrealType.h:6941
const UObject * GetObjectBeingEdited(int32 Index) const
Definition UnrealType.h:6949
void SetActiveMemberProperty(FProperty *InActiveMemberProperty)
Definition UnrealType.h:6876
FProperty * Property
Definition UnrealType.h:6970
void SetInstancesChanged(T &&InInstancesChanged)
Definition UnrealType.h:6893
bool GetArrayIndicesPerObject(int32 InObjectIteratorIndex, TMap< FString, int32 > &OutArrayIndicesPerObject) const
Definition UnrealType.h:6899
FName GetPropertyName() const
Definition UnrealType.h:6954
bool HasArchetypeInstanceChanged(UObject *InInstance) const
Definition UnrealType.h:6933
FPropertyChangedEvent(FProperty *InProperty, EPropertyChangeType::Type InChangeType=EPropertyChangeType::Unspecified, TArrayView< const UObject *const > InTopLevelObjects=TArrayView< const UObject *const >())
Definition UnrealType.h:6866
int32 GetArrayIndex(const FString &InName) const
Definition UnrealType.h:6914
EPropertyChangeType::Type ChangeType
Definition UnrealType.h:6979
void SetArrayIndexPerObject(TArrayView< const TMap< FString, int32 > > InArrayIndices)
Definition UnrealType.h:6884
Definition PropertyTag.h:38
Definition PropertyVisitor.h:268
Definition PropertyVisitor.h:249
Definition PropertyVisitor.h:32
Definition PropertyVisitor.h:97
Definition Map.h:140
FScriptSetLayout SetLayout
Definition Map.h:144
int32 ValueOffset
Definition Map.h:142
Definition ScriptSparseSet.h:13
int32 Size
Definition ScriptSparseSet.h:17
Definition TopLevelAssetPath.h:38
Definition UObjectThreadContext.h:140
Definition UnrealType.h:7223
friend TFieldIterator< T > begin(const TFieldRange &Range)
Definition UnrealType.h:7238
TFieldIterator< T > Begin
Definition UnrealType.h:7241
TFieldRange(const UStruct *InStruct, EFieldIteratorFlags::SuperClassFlags InSuperClassFlags, EFieldIteratorFlags::DeprecatedPropertyFlags InDeprecatedFieldFlags=EFieldIteratorFlags::IncludeDeprecated, EFieldIteratorFlags::InterfaceClassFlags InInterfaceFieldFlags=EFieldIteratorFlags::ExcludeInterfaces)
Definition UnrealType.h:7230
TFieldRange(const UStruct *InStruct, EFieldIterationFlags InIterationFlags=EFieldIterationFlags::Default)
Definition UnrealType.h:7224
friend TFieldIterator< T > end(const TFieldRange &Range)
Definition UnrealType.h:7239
Definition IsPODType.h:12
Definition SoftObjectPtr.h:33
Definition UnrealTypeTraits.h:181
Definition UnrealTypeTraits.h:172
Definition LinkedListBuilder.h:212
static TCHAR const * GetName()
Definition UnrealTypeTraits.h:192
Definition ObjectPtr.h:488
Definition Optional.h:131
Definition UnrealType.h:7640
friend TPropertyValueIterator< T > begin(const TPropertyValueRange &Range)
Definition UnrealType.h:7656
friend TPropertyValueIterator< T > end(const TPropertyValueRange &Range)
Definition UnrealType.h:7657
TPropertyValueIterator< T > Begin
Definition UnrealType.h:7659
TPropertyValueRange(const UStruct *InStruct, const void *InStructValue, EPropertyValueIteratorFlags InRecursionFlags=EPropertyValueIteratorFlags::FullRecursion, EFieldIteratorFlags::DeprecatedPropertyFlags InDeprecatedPropertyFlags=EFieldIteratorFlags::IncludeDeprecated)
Definition UnrealType.h:7649
Definition UnrealType.h:4588
TScriptContainerIterator(const ContainerType &InContainer, const int32 InLogicalIndex)
Definition UnrealType.h:4594
TScriptContainerIterator & operator++()
Definition UnrealType.h:4611
TScriptContainerIterator(const ContainerType &InContainer)
Definition UnrealType.h:4589
TScriptContainerIterator operator++(int)
Definition UnrealType.h:4617
int32 GetLogicalIndex() const
Definition UnrealType.h:4634
int32 GetInternalIndex() const
Definition UnrealType.h:4629
Definition Tuple.h:652