Files
UnrealEngineUWP/Engine/Source/Programs/Shared/EpicGames.BuildGraph/Expressions/IBgExpr.cs
Ben Marsh 5e8a45eab2 Reformat EpicGames.BuildGraph according to style guidelines.
#preflight 623cdba70a073579730cf22b

[CL 19502617 by Ben Marsh in ue5-main branch]
2022-03-24 17:05:58 -04:00

67 lines
1.8 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using EpicGames.BuildGraph.Expressions;
using EpicGames.Core;
namespace EpicGames.BuildGraph
{
/// <summary>
/// Context object used for evaluating expressions
/// </summary>
public class BgExprContext
{
/// <summary>
/// Command line options for the graph
/// </summary>
public Dictionary<string, string> Options { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Map from tag name to fileset
/// </summary>
public Dictionary<string, FileSet> TagNameToFileSet { get; set; } = new Dictionary<string, FileSet>();
}
/// <summary>
/// Base class for computable expressions
/// </summary>
public interface IBgExpr
{
/// <summary>
/// Compute the value of this expression
/// </summary>
/// <param name="context"></param>
object Compute(BgExprContext context);
/// <summary>
/// Helper method to create an expression which formats this expression as a string
/// </summary>
BgString ToBgString();
}
/// <summary>
/// Interface for a computable expression.
/// </summary>
public interface IBgExpr<TExpr> : IBgExpr
{
/// <summary>
/// Chooses between the current value and another value based on a condition
/// </summary>
/// <param name="condition">The condition to evaluate</param>
/// <param name="valueIfTrue">Value to return if the condition is true</param>
TExpr IfThen(BgBool condition, TExpr valueIfTrue);
}
/// <summary>
/// Sentinel expression node which can be assigned different values
/// </summary>
/// <typeparam name="TExpr">The expression type</typeparam>
public interface IBgExprVariable<TExpr> where TExpr : IBgExpr<TExpr>
{
/// <summary>
/// The current value of the variable
/// </summary>
TExpr Value { get; set; }
}
}