Unreal4源码拆解-UnrealBuildTool功能流程解析-UnrealBuildTool的RulesScope
知乎专栏:UBT源码解析
RulesScope类介绍
功能漫谈
RulesScope类,如其命名,规则范围,功能上大致是记录一下模块/文件之间引用关系。
本人更倾向于模块,其实Unreal里面模块之间用文件夹区分的很明白。
模块之间会以单向树形结构延伸
namespace UnrealBuildTool
{
class RulesScope
{
public string Name;
//父级的RulesScope
public RulesScope Parent;
public RulesScope(string Name, RulesScope Parent)
{
this.Name = Name;
this.Parent = Parent;
}
public bool Contains(RulesScope Other)
{
for(RulesScope Scope = this; Scope != null; Scope = Scope.Parent)
{
if(Scope == Other)
{
return true;
}
}
return false;
}
public string FormatHierarchy()
{
if(Parent == null)
{
return Name;
}
else
{
return String.Format("{0} -> {1}", Name, Parent.FormatHierarchy());
}
}
}
}