7#include "CoreMinimal.h"
8#include "Runtime/CoreUObject/Public/UObject/Interface.h"
9#include "Runtime/Launch/Resources/Version.h"
10#include "ArticyChangedProperty.h"
11#include "ArticyReflectable.generated.h"
29 template<
typename TValue>
30 TValue
SetProp(FName Property, TValue Value, int32 ArrayIndex = 0);
33 template<
typename TValue>
34 TValue&
GetProp(FName Property, int32 ArrayIndex = 0);
37 template<
typename TValue>
38 const TValue&
GetProp(FName Property, int32 ArrayIndex = 0)
const
45 template<
typename TValue>
46 TValue*
GetPropPtr(FName Property, int32 ArrayIndex = 0)
const
49 auto propPointers = GetPropertyPointers();
50 auto prop = propPointers.Find(Property);
52 return (*prop)->ContainerPtrToValuePtr<TValue>(_getUObject(), ArrayIndex);
61 auto propPointers = GetPropertyPointers();
62 auto prop = propPointers.Find(Property);
70 static bool HasProperty(
const UClass* Class,
const FName &Property)
72 return GetPropertyPointers(Class).Find(Property) !=
nullptr;
75 virtual UClass* GetObjectClass()
const {
return _getUObject()->GetClass(); }
77 FReportChangedDelegate ReportChanged;
85 TMap<FName, FProperty*>& GetPropertyPointers()
const
87 return GetPropertyPointers(GetObjectClass());
90 static TMap<FName, FProperty*>& GetPropertyPointers(
const UClass* Class)
92 static TMap<const UClass*, TMap<FName, FProperty*>> PropertyPointers;
93 auto& pp = PropertyPointers.FindOrAdd(Class);
97 for(TFieldIterator<FProperty> It(Class); It; ++It)
98 pp.Add(*It->GetNameCPP(), *It);
107template <
typename TValue>
114 ChangedProperty.Property = Property;
115 ChangedProperty.SetObjectReference(
this);
119 ReportChanged.Broadcast(ChangedProperty);
126template <
typename TValue>
Definition ArticyReflectable.h:24
FProperty * GetProperty(FName Property) const
Definition ArticyReflectable.h:58
const TValue & GetProp(FName Property, int32 ArrayIndex=0) const
Definition ArticyReflectable.h:38
TValue * GetPropPtr(FName Property, int32 ArrayIndex=0) const
Definition ArticyReflectable.h:46
static bool HasProperty(const UClass *Class, const FName &Property)
Definition ArticyReflectable.h:70
TValue & GetProp(FName Property, int32 ArrayIndex=0)
Definition ArticyReflectable.h:127
TValue SetProp(FName Property, TValue Value, int32 ArrayIndex=0)
Definition ArticyReflectable.h:108
Definition ArticyReflectable.h:16
Definition ArticyChangedProperty.h:14