EM_Task/CoreUObject/Public/Serialization/SerializedPropertyScope.h

37 lines
967 B
C
Raw Permalink Normal View History

2026-02-13 16:18:33 +08:00
// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
AsyncPackage.h: Unreal async loading definitions.
=============================================================================*/
#pragma once
#include "CoreMinimal.h"
/** Helper class to set and restore serialized property on an archive */
class COREUOBJECT_API FSerializedPropertyScope
{
FArchive& Ar;
FProperty* Property;
void PushProperty();
void PopProperty();
public:
FSerializedPropertyScope(FArchive& InAr, FProperty* InProperty, const FProperty* OnlyIfOldProperty = nullptr)
: Ar(InAr), Property(InProperty)
{
if (!OnlyIfOldProperty || Ar.GetSerializedProperty() == OnlyIfOldProperty)
{
PushProperty();
}
else
{
Property = nullptr;
}
}
~FSerializedPropertyScope()
{
PopProperty();
}
};