Files
UnrealEngineUWP/Engine/Source/Programs/UnrealHeaderTool/Private/Class.cpp
Steve Robb 04c2da0cf2 #ttp 331467: Make UHT not depend on CoreUObject
#add FClass and FClasses added to encapsulate (and ultimately replace) UClass and FClassTree.
#add StringUtils contains a bunch of string-related functions which were in FHeaderParser for no real reason.
#change Replaced FClassTree with UHT and fixed up all the code which was affected.

#codereview robert.manuszewski

[CL 2045258 by Steve Robb in Main branch]
2014-04-23 18:42:01 -04:00

80 lines
1.6 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "UnrealHeaderTool.h"
#include "Class.h"
#include "ClassMaps.h"
bool FClass::Inherits(const FClass* SuspectBase) const
{
return IsChildOf(SuspectBase);
}
FString FClass::GetNameWithPrefix(EEnforceInterfacePrefix::Type EnforceInterfacePrefix) const
{
const TCHAR* Prefix = 0;
if (HasAnyClassFlags(CLASS_Interface))
{
// Grab the expected prefix for interfaces (U on the first one, I on the second one)
switch (EnforceInterfacePrefix)
{
case EEnforceInterfacePrefix::None:
// For old-style files: "I" for interfaces, unless it's the actual "Interface" class, which gets "U"
if (GetFName() == NAME_Interface)
{
Prefix = TEXT("U");
}
else
{
Prefix = TEXT("I");
}
break;
case EEnforceInterfacePrefix::I:
Prefix = TEXT("I");
break;
case EEnforceInterfacePrefix::U:
Prefix = TEXT("U");
break;
default:
check(false);
}
}
else
{
// Get the expected class name with prefix
Prefix = GetPrefixCPP();
}
return FString::Printf(TEXT("%s%s"), Prefix, *GetName());
}
FClass* FClass::GetSuperClass() const
{
return static_cast<FClass*>(static_cast<const UClass*>(this)->GetSuperClass());
}
TArray<FName> FClass::GetDependentNames() const
{
TArray<FName> Result;
for (auto Name : *GClassDependentOnMap.FindOrAdd(const_cast<FClass*>(this)))
{
Result.Add(Name);
}
return Result;
}
TArray<FClass*> FClass::GetInterfaceTypes() const
{
TArray<FClass*> Result;
for (auto& i : Interfaces)
{
Result.Add((FClass*)i.Class);
}
return Result;
}