Files
UnrealEngineUWP/Engine/Source/Programs/UHTLite/Private/ClassMaps.cpp
fredric echols 841f4fe220 Refactored the following aspects of UHTLite:
* Globals in ClassMaps.cpp have been moved into FHeaderParser, FNativeClassHeaderGenerator, and UnrealHeaderTool_Main(). This is to illustrate how data flows through the program for further refactoring in the near future.

* Static variables have been removed from FHeaderParser.

* UnrealHeaderTool_Main() and associated functions have been moved into UnrealHeaderToolMain.cpp.

* Commented out several sections of code that are not required for code generation. This code will be refactored later.

[CL 14221982 by fredric echols in ue5-main branch]
2020-08-31 15:27:03 -04:00

32 lines
942 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ClassMaps.h"
#include "UnrealHeaderTool.h"
#include "UnrealTypeDefinitionInfo.h"
void FClassDeclarations::AddIfMissing(FName Name, TUniqueFunction<TSharedRef<FClassDeclarationMetaData>()>&& DeclConstructFunc)
{
FRWScopeLock Lock(ClassDeclLock, SLT_Write);
if (!ClassDeclarations.Contains(Name))
{
TSharedRef<FClassDeclarationMetaData> ClassDecl = DeclConstructFunc();
ClassDeclarations.Add(Name, MoveTemp(ClassDecl));
}
}
FClassDeclarationMetaData* FClassDeclarations::Find(FName Name) const
{
FRWScopeLock Lock(ClassDeclLock, SLT_ReadOnly);
if (const TSharedRef<FClassDeclarationMetaData>* ClassDecl = ClassDeclarations.Find(Name))
{
return &ClassDecl->Get();
}
return nullptr;
}
FClassDeclarationMetaData& FClassDeclarations::FindChecked(FName Name) const
{
FRWScopeLock Lock(ClassDeclLock, SLT_ReadOnly);
return ClassDeclarations.FindChecked(Name).Get();
}