UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PropertyIterator.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4PropertyIterrator.h: TPropertyIterator implementation.
5=============================================================================*/
6#pragma once
7
8#include "UObject/Field.h"
10
14template <class T>
16{
17private:
19 const UStruct* Struct;
22 TObjectIterator<UStruct> ClassIterator;
23
24public:
26 : Struct(nullptr)
27 , Field(nullptr)
28 {
29 if (ClassIterator)
30 {
31 Struct = *ClassIterator;
32 Field = Struct->ChildProperties;
33
34 if (!Field || !Field->IsA<T>())
35 {
37 }
38 }
39 }
40
42 UE_FORCEINLINE_HINT explicit operator bool() const
43 {
44 return Field != nullptr;
45 }
48 {
49 return !(bool)*this;
50 }
51
52 inline friend bool operator==(const TPropertyIterator<T>& Lhs, const TPropertyIterator<T>& Rhs) { return Lhs.Field == Rhs.Field; }
53 inline friend bool operator!=(const TPropertyIterator<T>& Lhs, const TPropertyIterator<T>& Rhs) { return Lhs.Field != Rhs.Field; }
54
55 inline void operator++()
56 {
59 }
60 inline T* operator*()
61 {
63 return (T*)Field;
64 }
65 inline T* operator->()
66 {
68 return (T*)Field;
69 }
70 inline const UStruct* GetStruct()
71 {
72 return Struct;
73 }
74protected:
75 inline void IterateToNext()
76 {
78 do
79 {
80 if (NewField)
81 {
82 NewField = NewField->Next;
83 }
84 if (!NewField && ClassIterator)
85 {
86 ++ClassIterator;
87 if(ClassIterator)
88 {
89 Struct = *ClassIterator;
90 NewField = Struct->ChildProperties;
91 }
92 else
93 {
94 NewField = nullptr;
95 }
96 }
97 } while (ClassIterator && (!NewField || !NewField->IsA<T>()));
99 }
100};
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
Definition Field.h:556
Definition UObjectIterator.h:257
Definition PropertyIterator.h:16
UE_FORCEINLINE_HINT bool operator!() const
Definition PropertyIterator.h:47
const UStruct * GetStruct()
Definition PropertyIterator.h:70
T * operator->()
Definition PropertyIterator.h:65
void operator++()
Definition PropertyIterator.h:55
friend bool operator!=(const TPropertyIterator< T > &Lhs, const TPropertyIterator< T > &Rhs)
Definition PropertyIterator.h:53
TPropertyIterator()
Definition PropertyIterator.h:25
friend bool operator==(const TPropertyIterator< T > &Lhs, const TPropertyIterator< T > &Rhs)
Definition PropertyIterator.h:52
T * operator*()
Definition PropertyIterator.h:60
void IterateToNext()
Definition PropertyIterator.h:75
Definition Class.h:480
Definition FieldSystemNoiseAlgo.cpp:6