You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb Zousar.Shaker #rnx #preflight 61942ee0cc0baff9b08f7659 #ROBOMERGE-AUTHOR: devin.doucette #ROBOMERGE-SOURCE: CL 18218377 in //UE5/Release-5.0/... via CL 18218399 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469) #ROBOMERGE[STARSHIP]: UE5-Main [CL 18218408 by devin doucette in ue5-release-engine-test branch]
39 lines
758 B
C++
39 lines
758 B
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Serialization/ArchiveProxy.h"
|
|
#include "Templates/UnrealTemplate.h"
|
|
|
|
namespace UE
|
|
{
|
|
|
|
template <typename HashBuilderType>
|
|
class THashingArchiveProxy : public FArchiveProxy
|
|
{
|
|
public:
|
|
using FArchiveProxy::FArchiveProxy;
|
|
|
|
void Serialize(void* V, int64 Length) override
|
|
{
|
|
FArchiveProxy::Serialize(V, Length);
|
|
HashBuilder.Update(V, uint64(Length));
|
|
}
|
|
|
|
void Seek(int64 InPos) override
|
|
{
|
|
checkf(InPos == Tell(), TEXT("A hash cannot be computed when serialization relies on seeking."));
|
|
FArchiveProxy::Seek(InPos);
|
|
}
|
|
|
|
auto GetHash() -> decltype(DeclVal<HashBuilderType>().Finalize())
|
|
{
|
|
return HashBuilder.Finalize();
|
|
}
|
|
|
|
private:
|
|
HashBuilderType HashBuilder;
|
|
};
|
|
|
|
} // UE
|