Files
UnrealEngineUWP/Engine/Source/Runtime/Serialization/Public/Backends/CborStructDeserializerBackend.h
Bryan sefcik b4a6e947d8 Ran IWYU on Public headers under Engine/Source/Runtime/...
Headers are updated to contain any missing #includes needed to compile and #includes are sorted.  Nothing is removed.

#ushell-cherrypick of 21065896 by bryan.sefcik
#preflight 62d4b1a5a6141b6adfb0c892
#jira

#ROBOMERGE-OWNER: Bryan.sefcik
#ROBOMERGE-AUTHOR: bryan.sefcik
#ROBOMERGE-SOURCE: CL 21150156 via CL 21151754 via CL 21154719
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)
#ROBOMERGE-CONFLICT from-shelf

[CL 21181076 by Bryan sefcik in ue5-main branch]
2022-07-20 11:31:36 -04:00

64 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CborReader.h"
#include "CborTypes.h"
#include "Containers/UnrealString.h"
#include "CoreMinimal.h"
#include "HAL/Platform.h"
#include "IStructDeserializerBackend.h"
class FArchive;
class FArrayProperty;
class FProperty;
/**
* Implements a reader for UStruct deserialization using Cbor.
*/
class SERIALIZATION_API FCborStructDeserializerBackend
: public IStructDeserializerBackend
{
public:
/**
* Creates and initializes a new instance.
* @param Archive The archive to deserialize from.
* @param CborDataEndianness The CBOR data endianness stored in the archive.
* @note For backward compatibility and performance, the implementation default to the the platform endianness rather than the CBOR standard one (big endian).
*/
FCborStructDeserializerBackend(FArchive& Archive, ECborEndianness CborDataEndianness = ECborEndianness::Platform, bool bInIsLWCCompatibilityMode = false);
virtual ~FCborStructDeserializerBackend();
public:
// IStructDeserializerBackend interface
virtual const FString& GetCurrentPropertyName() const override;
virtual FString GetDebugString() const override;
virtual const FString& GetLastErrorMessage() const override;
virtual bool GetNextToken(EStructDeserializerBackendTokens& OutToken) override;
virtual bool ReadProperty(FProperty* Property, FProperty* Outer, void* Data, int32 ArrayIndex) override;
virtual bool ReadPODArray(FArrayProperty* ArrayProperty, void* Data) override;
virtual void SkipArray() override;
virtual void SkipStructure() override;
private:
/** Holds the Cbor reader used for the actual reading of the archive. */
FCborReader CborReader;
/** Holds the last read Cbor Context. */
FCborContext LastContext;
/** Holds the last map key. */
FString LastMapKey;
/** The index of the next byte to copy from the CBOR byte stream into the corresponding TArray<uint8>/TArray<int8> property. */
int32 DeserializingByteArrayIndex = 0;
/** Whether a TArray<uint8>/TArray<int8> property is being deserialized. */
bool bDeserializingByteArray = false;
/** Whether we are deserializing for LWC backward compability mode. Incoming FloatProperties of LWC types deserialized into Double */
bool bIsLWCCompatibilityMode = false;
};