Files

45 lines
1.0 KiB
C#
Raw Permalink Normal View History

2025-07-15 16:37:06 +03:00
using mROA.CodegenTools;
using mROA.CodegenTools.Reading;
namespace mROA.Codegen.Templates
{
public abstract class TemplateView
{
private readonly TemplateDocument _template;
2026-01-29 23:15:39 +03:00
2025-07-15 16:37:06 +03:00
protected TemplateView(string templateFile)
{
_template = TemplateReader.FromEmbeddedResource(templateFile);
}
2026-01-29 23:15:39 +03:00
2025-07-15 16:37:06 +03:00
protected TemplateView(TemplateDocument template)
{
_template = template;
}
public string Compile()
{
return _template.Compile();
}
protected void Define(string tag, string value)
{
_template.AddDefine(tag, value);
}
protected void Insert(string tag, string value)
{
_template.Insert(tag, value);
}
protected bool Inserted(string tag)
{
return _template[$"{tag}+"] != null;
}
protected TemplateDocument CloneInner(string tag)
{
return _template.CloneInnerTemplate(tag);
}
}
}