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