Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
ArchiveSerializedPropertyChain.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
6
7/** Structure containing the stack of properties that are currently being serialized by an archive */
9{
10public:
11 /** Default constructor */
15 , EditorOnlyPropertyStack(0)
16#endif
17 {
18 }
19
20 /**
21 * Push a property that is currently being serialized
22 *
23 * @param InProperty Pointer to the property that is currently being serialized
24 * @param bIsEditorOnlyProperty True if the property is editor only (call FProperty::IsEditorOnlyProperty to work this out, as the archive can't since it can't access CoreUObject types)
25 */
26 void PushProperty(struct FProperty* InProperty, const bool bIsEditorOnlyProperty)
27 {
28 check(InProperty);
29 SerializedPropertyChain.Push(InProperty);
30
32
34 if (bIsEditorOnlyProperty)
35 {
36 ++EditorOnlyPropertyStack;
37 }
38#endif
39 }
40
41 /**
42 * Pop a property that was previously being serialized
43 *
44 * @param InProperty Pointer to the property that was previously being serialized
45 * @param bIsEditorOnlyProperty True if the property is editor only (call FProperty::IsEditorOnlyProperty to work this out, as the archive can't since it can't access CoreUObject types)
46 */
47 void PopProperty(struct FProperty* InProperty, const bool bIsEditorOnlyProperty)
48 {
49 check(InProperty);
50 check(SerializedPropertyChain.Num() > 0 && SerializedPropertyChain.Last() == InProperty);
51 SerializedPropertyChain.Pop(/*bAllowShrinking*/false);
52
54
56 if (bIsEditorOnlyProperty)
57 {
58 --EditorOnlyPropertyStack;
59 check(EditorOnlyPropertyStack >= 0);
60 }
61#endif
62 }
63
64 /**
65 * Get the property at the given index on the stack
66 * @note This index is in stack order, so the 0th index with be the leaf property on the stack
67 */
68 struct FProperty* GetPropertyFromStack(const int32 InStackIndex) const
69 {
70 return SerializedPropertyChain.Last(InStackIndex);
71 }
72
73 /**
74 * Get the property at the given index from the root
75 * @note This index is in array order, so the 0th index with be the root property on the stack
76 */
77 struct FProperty* GetPropertyFromRoot(const int32 InRootIndex) const
78 {
79 return SerializedPropertyChain[InRootIndex];
80 }
81
82 /**
83 * Get the number of properties currently on the stack
84 */
85 int32 GetNumProperties() const
86 {
87 return SerializedPropertyChain.Num();
88 }
89
90 /**
91 * Get the counter for the number of times that SerializedPropertyChain has been updated
92 */
93 uint32 GetUpdateCount() const
94 {
96 }
97
98 /**
99 * Check to see whether there are any editor-only properties on the stack
100 */
102 {
104 return EditorOnlyPropertyStack > 0;
105#else
106 return false;
107#endif
108 }
109
110private:
112 {
113 while (++SerializedPropertyChainUpdateCount == 0) {} // Zero is special, don't allow an overflow to stay at zero
114 }
115
116 /** Array of properties on the stack */
118
119 /** Counter for the number of times that SerializedPropertyChain has been updated */
121
123 /** Non-zero if on the current stack of serialized properties there's an editor-only property */
124 int32 EditorOnlyPropertyStack;
125#endif
126};
#define check(expr)
#define WITH_EDITORONLY_DATA
void PopProperty(struct FProperty *InProperty, const bool bIsEditorOnlyProperty)
struct FProperty * GetPropertyFromRoot(const int32 InRootIndex) const
TArray< struct FProperty *, TInlineAllocator< 8 > > SerializedPropertyChain
void PushProperty(struct FProperty *InProperty, const bool bIsEditorOnlyProperty)
struct FProperty * GetPropertyFromStack(const int32 InStackIndex) const