Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/System/SupportedPlatformsAttribute.cs
joe kirchoff acacd6a8de UnrealBuildTool: More automated code cleanup
* Use object type rather than var
* Remove double newlines
* Use pattern matching

#rnx
#preflight 647780095d23eca37d28a387

[CL 25706751 by joe kirchoff in ue5-main branch]
2023-05-31 13:37:21 -04:00

45 lines
1.2 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
namespace UnrealBuildTool
{
/// <summary>
/// Attribute which can be applied to a TargetRules-dervied class to indicate which platforms it supports
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class SupportedPlatformsAttribute : Attribute
{
/// <summary>
/// Array of supported platforms
/// </summary>
public readonly UnrealTargetPlatform[] Platforms;
/// <summary>
/// Initialize the attribute with a list of platforms
/// </summary>
/// <param name="Platforms">Variable-length array of platform arguments</param>
public SupportedPlatformsAttribute(params string[] Platforms)
{
try
{
this.Platforms = Array.ConvertAll(Platforms, x => UnrealTargetPlatform.Parse(x));
}
catch (BuildException Ex)
{
EpicGames.Core.ExceptionUtils.AddContext(Ex, "while parsing a SupportedPlatforms attribute");
throw;
}
}
/// <summary>
/// Initialize the attribute with all the platforms in a given category
/// </summary>
/// <param name="Category">Category of platforms to add</param>
public SupportedPlatformsAttribute(UnrealPlatformClass Category)
{
Platforms = Utils.GetPlatformsInClass(Category);
}
}
}