#nullable enable
namespace GFramework.Godot.SourceGenerators.Abstractions;
///
/// 显式声明某个 Godot 节点类型与 project.godot 中 AutoLoad 名称之间的映射关系。
///
///
/// 当 AutoLoad 条目无法仅靠类型名唯一推断到 C# 节点类型时,
/// 可以通过该特性为生成器提供稳定的强类型映射入口。
///
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class AutoLoadAttribute : Attribute
{
///
/// 初始化 的新实例。
///
/// 在 project.godot 中声明的 AutoLoad 名称。
///
/// 为 。
///
///
/// 为空字符串或仅包含空白字符。
///
public AutoLoadAttribute(string name)
{
if (name is null)
{
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentException("AutoLoad name cannot be empty or whitespace.", nameof(name));
}
Name = name;
}
///
/// 获取在 project.godot 中声明的 AutoLoad 名称。
///
public string Name { get; }
}