Files
RenderFramework/Tools/VulkanWrapperGenerator/SugarClassSpec.cs
T

41 lines
1.7 KiB
C#
Raw Normal View History

2025-09-10 04:09:26 +03:00
using System.Collections.Generic;
/// <summary>
/// Declarative "sugar" description for a generated wrapper class.
/// You can provide several specs with the same TargetClass; they will be merged.
/// </summary>
public sealed class SugarClassSpec {
public string TargetClass { get; }
public List<string> Includes { get; set; } = new(); // reserved for future use
public List<SugarMethodSpec> Methods { get; set; } = new();
public SugarClassSpec(string targetClass) => TargetClass = targetClass;
}
/// <summary>
/// Declarative description of one sugar method to inject into a wrapper.
/// </summary>
public sealed class SugarMethodSpec {
public string Name { get; set; } = ""; // C++ method name
public string ReturnType { get; set; } = "void"; // C++ return type
public List<string> Parameters { get; set; } = new(); // e.g., "int x", "IntrusivePtr<Buffer> buf"
public bool IsStatic { get; set; } = false;
public bool IsConst { get; set; } = false;
public bool IsNoexcept { get; set; } = false;
// Body lines with placeholders:
// ${handle} -> _handle
// ${vk} -> vk
// ${owner0.handle} -> first primary owner handle, etc.
// For IntrusivePtr<T> params: ${param.handle}
// For vector<IntrusivePtr<T>> params: ${param.handles}, ${param.size}/${param.count}
public List<string> BodyLines { get; set; } = new();
// Optional guard expression (e.g., "defined(VK_KHR_swapchain)")
public string? Guard { get; set; }
// Require presence of vk* function names and extension names
public List<string> RequiresFunctions { get; set; } = new();
public List<string> RequiresExtensions { get; set; } = new();
}