Files
UnrealEngineUWP/Engine/Source/Programs/UnrealHeaderTool/Private/UHTMakefile/FunctionArchiveProxy.cpp
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

90 lines
3.4 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "FunctionArchiveProxy.h"
#include "UnrealHeaderTool.h"
#include "UHTMakefile.h"
FFunctionArchiveProxy::FFunctionArchiveProxy(FUHTMakefile& UHTMakefile, const UFunction* Function)
: FStructArchiveProxy(UHTMakefile, Function)
{
FunctionFlags = Function->FunctionFlags;
RepOffset = Function->RepOffset;
NumParms = Function->NumParms;
ParmsSize = Function->ParmsSize;
ReturnValueOffset = Function->ReturnValueOffset;
RPCId = Function->RPCId;
RPCResponseId = Function->RPCResponseId;
FirstPropertyToInitIndex = UHTMakefile.GetPropertyIndex(Function->FirstPropertyToInit);
#if UE_BLUEPRINT_EVENTGRAPH_FASTCALLS
EventGraphFunctionIndex = UHTMakefile.GetFunctionIndex(Function->EventGraphFunction);
EventGraphCallOffset = Function->EventGraphCallOffset;
#else
EventGraphFunctionIndex = -1;
EventGraphCallOffset = -1;
#endif // UE_BLUEPRINT_EVENTGRAPH_FASTCALLS
}
UFunction* FFunctionArchiveProxy::CreateFunction(const FUHTMakefile& UHTMakefile) const
{
UObject* Outer = UHTMakefile.GetObjectByIndex(OuterIndex);
UFunction* Function = new(EC_InternalUseOnlyConstructor, Outer, Name.CreateName(UHTMakefile), (EObjectFlags)ObjectFlagsUint32) UFunction(FObjectInitializer());
PostConstruct(Function);
return Function;
}
void FFunctionArchiveProxy::PostConstruct(UFunction* Function) const
{
Function->FunctionFlags = FunctionFlags;
Function->RepOffset = RepOffset;
Function->NumParms = NumParms;
Function->ParmsSize = ParmsSize;
Function->ReturnValueOffset = ReturnValueOffset;
Function->RPCId = RPCId;
Function->RPCResponseId = RPCResponseId;
Function->EventGraphCallOffset = EventGraphCallOffset;
}
void FFunctionArchiveProxy::Resolve(UFunction* Function, const FUHTMakefile& UHTMakefile) const
{
Function->FirstPropertyToInit = UHTMakefile.GetPropertyByIndex(FirstPropertyToInitIndex);
#if UE_BLUEPRINT_EVENTGRAPH_FASTCALLS
Function->EventGraphFunction = UHTMakefile.GetFunctionByIndex(EventGraphFunctionIndex);
#else
Function->EventGraphFunction = nullptr;
#endif // UE_BLUEPRINT_EVENTGRAPH_FASTCALLS
}
FArchive& operator<<(FArchive& Ar, FFunctionArchiveProxy& FunctionArchiveProxy)
{
Ar << static_cast<FStructArchiveProxy&>(FunctionArchiveProxy);
Ar << FunctionArchiveProxy.FunctionFlags;
Ar << FunctionArchiveProxy.RepOffset;
Ar << FunctionArchiveProxy.NumParms;
Ar << FunctionArchiveProxy.ParmsSize;
Ar << FunctionArchiveProxy.ReturnValueOffset;
Ar << FunctionArchiveProxy.RPCId;
Ar << FunctionArchiveProxy.RPCResponseId;
Ar << FunctionArchiveProxy.FirstPropertyToInitIndex;
Ar << FunctionArchiveProxy.EventGraphFunctionIndex;
Ar << FunctionArchiveProxy.EventGraphCallOffset;
return Ar;
}
FDelegateFunctionArchiveProxy::FDelegateFunctionArchiveProxy(FUHTMakefile& UHTMakefile, const UDelegateFunction* DelegateFunction)
: FFunctionArchiveProxy(UHTMakefile, DelegateFunction)
{ }
UDelegateFunction* FDelegateFunctionArchiveProxy::CreateDelegateFunction(const FUHTMakefile& UHTMakefile) const
{
UObject* Outer = UHTMakefile.GetObjectByIndex(OuterIndex);
UDelegateFunction* DelegateFunction = new(EC_InternalUseOnlyConstructor, Outer, Name.CreateName(UHTMakefile), (EObjectFlags)ObjectFlagsUint32) UDelegateFunction(FObjectInitializer());
PostConstruct(DelegateFunction);
return DelegateFunction;
}
void FDelegateFunctionArchiveProxy::PostConstruct(UDelegateFunction* DelegateFunction) const
{
FFunctionArchiveProxy::PostConstruct(DelegateFunction);
}