public override string Render(DefConst c) { var ctx = new TemplateContext(); var env = new TTypeTemplateCommonExtends { ["x"] = c }; ctx.PushGlobal(env); var template = t_tsConstRender ??= Template.Parse(@" class {{x.py_full_name}}: {{~ for item in x.items ~}} {{item.name}} = {{py_const_value item.ctype item.value}} {{~end~}} {{~if (x.items == empty)~}} pass {{~end~}} "); var result = template.Render(ctx); return(result); }
public override string Render(DefConst c) { var ctx = new TemplateContext(); var env = new TTypeTemplateCommonExtends { ["x"] = c }; ctx.PushGlobal(env); var template = t_tsConstRender ??= Template.Parse(@" namespace {{x.namespace}} { export class {{x.name}} { {{~ for item in x.items ~}} static {{item.name}} : {{ts_define_type item.ctype}} = {{ts_const_value item.ctype item.value}}; {{~end~}} } } "); var result = template.Render(ctx); return(result); }
public static string RenderJavaConstClass(DefConst c) { var ctx = new TemplateContext(); var env = new TTypeTemplateCommonExtends { ["x"] = c }; ctx.PushGlobal(env); var template = t_javaConstRender ??= Template.Parse(@" package {{x.namespace_with_top_module}}; public final class {{x.name}} { {{~ for item in x.items ~}} public static final {{java_define_type item.ctype}} {{item.name}} = {{java_const_value item.ctype item.value}}; {{~end~}} } "); var result = template.Render(ctx); return(result); }
public static string RenderCppConstClass(DefConst c) { var ctx = new TemplateContext(); var env = new TTypeTemplateCommonExtends { ["x"] = c }; ctx.PushGlobal(env); var template = t_cppConstRender ??= Template.Parse(@" {{x.cpp_namespace_begin}} struct {{x.name}} { {{~ for item in x.items ~}} static constexpr {{cpp_define_type item.ctype}} {{item.name}} = {{cpp_const_value item.ctype item.value}}; {{~end~}} }; {{x.cpp_namespace_end}} "); var result = template.Render(ctx); return(result); }
public string Render(DefConst c) { string package = "cfg"; var template = t_constRender ??= Template.Parse(@" package {{package}} const ( {{- for item in x.items }} {{x.go_full_name}}_{{item.name}} = {{go_const_value item.ctype item.value}} {{-end}} ) "); var result = template.RenderCode(c, new Dictionary <string, object>() { ["package"] = package }); return(result); }
public string Render(DefConst c) { return(RenderUtil.RenderCsConstClass(c)); }
public abstract string Render(DefConst c);
public override string Render(DefConst c) { return(RenderUtil.RenderJavaConstClass(c)); }
public string Render(DefConst c) { return("// const"); }