mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-31 18:38:18 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
50 lines
2.0 KiB
C#
50 lines
2.0 KiB
C#
namespace Sandbox;
|
|
|
|
/// <summary>
|
|
/// An attribute that can be added to a custom <see cref="Attribute"/> class for special code generation behavior.
|
|
/// They'll then be applied to methods and properties when they are decorated with <i>that</i> attribute.
|
|
/// </summary>
|
|
[AttributeUsage( AttributeTargets.Class, AllowMultiple = true )]
|
|
public class CodeGeneratorAttribute : Attribute
|
|
{
|
|
/// <summary>
|
|
/// Attributes with a higher priority will wrap the target first. The default priority is 0.
|
|
/// </summary>
|
|
public int Priority { get; init; } = 0;
|
|
|
|
/// <summary>
|
|
/// The name of the callback method. This can be a fully qualified static method callback or a simple callback to invoke
|
|
/// on the target object if the method or property target is not static.
|
|
/// </summary>
|
|
public string CallbackName { get; init; }
|
|
|
|
/// <summary>
|
|
/// The type of code generation you want to do.
|
|
/// You will need to specify whether it should apply to instance or static methods and properties using the <see cref="CodeGeneratorFlags.Instance"/>
|
|
/// and <see cref="CodeGeneratorFlags.Static"/> flags.
|
|
/// </summary>
|
|
public CodeGeneratorFlags Type { get; init; }
|
|
|
|
/// <summary>
|
|
/// Perform code generation for a method or property.
|
|
/// </summary>
|
|
/// <param name="type">
|
|
/// The type of code generation you want to do.
|
|
/// You will need to specify whether it should apply to instance or static methods and properties using the <see cref="CodeGeneratorFlags.Instance"/>
|
|
/// and <see cref="CodeGeneratorFlags.Static"/> flags.
|
|
/// </param>
|
|
/// <param name="callbackName">
|
|
/// The name of the callback method. This can be a fully qualified static method callback or a simple callback to invoke
|
|
/// on the target object if the method or property target is not static.
|
|
/// </param>
|
|
/// <param name="priority">
|
|
/// Attributes with a higher priority will wrap the target first. The default priority is 0.
|
|
/// </param>
|
|
public CodeGeneratorAttribute( CodeGeneratorFlags type, string callbackName, int priority = 0 )
|
|
{
|
|
CallbackName = callbackName;
|
|
Priority = 0;
|
|
Type = type;
|
|
}
|
|
}
|