Files
UnrealEngineUWP/Engine/Source/Programs/UnrealHeaderTool/Private/UHTMakefile/UHTMakefileModuleDescriptor.h
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

126 lines
2.6 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Templates/TypeHash.h"
#include "Containers/Map.h"
#include "UHTMakefileHeaderDescriptor.h"
class UPackage;
class FUnrealSourceFile;
class FArchive;
class FUHTMakefile;
struct FManifestModule;
/* See UHTMakefile.h for overview how makefiles work. */
class FUHTMakefileModuleDescriptor
{
public:
FUHTMakefileModuleDescriptor(FUHTMakefile* InUHTMakefile = nullptr)
: LoadingPhase(EUHTMakefileLoadingPhase::Preload)
, UHTMakefile(InUHTMakefile)
, Package(nullptr)
{
HeadersOrder.AddDefaulted(+EUHTMakefileLoadingPhase::Max);
}
void StopPreloading()
{
LoadingPhase = EUHTMakefileLoadingPhase::Max;
for (auto& Kvp : HeaderDescriptors)
{
Kvp.Value.StopPreloading();
}
}
void StartLoading()
{
LoadingPhase = EUHTMakefileLoadingPhase::Load;
for (auto& Kvp : HeaderDescriptors)
{
Kvp.Value.StartLoading();
}
}
void StopLoading()
{
LoadingPhase = EUHTMakefileLoadingPhase::Max;
for (auto& Kvp : HeaderDescriptors)
{
Kvp.Value.StopLoading();
}
}
void StartExporting()
{
LoadingPhase = EUHTMakefileLoadingPhase::Export;
for (auto& Kvp : HeaderDescriptors)
{
Kvp.Value.StartExporting();
}
}
void StopExporting()
{
LoadingPhase = EUHTMakefileLoadingPhase::Max;
for (auto& Kvp : HeaderDescriptors)
{
Kvp.Value.StopExporting();
}
}
void SetPackageIndex(int32 Index);
int32 GetPackageIndex() const
{
return PackageIndex;
}
bool HasHeaderDescriptor(int32 Index)
{
return HeaderDescriptors.Contains(Index);
}
FUHTMakefileHeaderDescriptor& GetHeaderDescriptor(int32 Index)
{
FUHTMakefileHeaderDescriptor& HeaderDescriptor = HeaderDescriptors.FindOrAdd(Index);
HeaderDescriptor.SetMakefile(UHTMakefile);
return HeaderDescriptor;
}
void LoadModuleData(const FManifestModule& ManifestModule, EUHTMakefileLoadingPhase UHTMakefileLoadingPhase);
void SetMakefile(FUHTMakefile* InUHTMakefile)
{
UHTMakefile = InUHTMakefile;
}
UPackage* GetPackage() const
{
return Package;
}
void SetPackage(UPackage* InPackage)
{
Package = InPackage;
}
void AddToHeaderOrder(FUnrealSourceFile* SourceFile);
void Reset();
private:
friend FArchive& operator<<(FArchive& Ar, FUHTMakefileModuleDescriptor& UHTMakefileModuleDescriptor);
/** Index of this module's package in UHTMakefile Packages array. */
int32 PackageIndex;
TMap<int32, FUHTMakefileHeaderDescriptor> HeaderDescriptors;
TArray<TArray<int32>> HeadersOrder;
EUHTMakefileLoadingPhase LoadingPhase;
FUHTMakefile* UHTMakefile;
UPackage* Package;
};