diff --git a/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs b/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs
index e6d1909..5716eb1 100644
--- a/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs
@@ -40,9 +40,11 @@ namespace Luban.Job.Cfg.Generate
hierarchy_export_fields = x.hierarchy_export_fields
}}
+{{~if x.comment != '' ~}}
/**
-{{x.comment}}
+ * {{x.comment}}
*/
+{{~end~}}
class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}} {{else}} bright::CfgBean {{end}}
{
public:
@@ -71,9 +73,11 @@ class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}}
bool deserialize(ByteBuf& _buf);
{{~ for field in export_fields ~}}
+{{~if field.comment != '' ~}}
/**
- {{field.comment}}
+ * {{field.comment}}
*/
+{{~end~}}
{{cpp_define_type field.ctype}} {{field.cpp_style_name}};
{{~if field.index_field~}}
::bright::HashMap<{{cpp_define_type field.index_field.ctype}}, {{cpp_define_type field.ctype.element_type}}> {{field.cpp_style_name}}_Index;
@@ -115,9 +119,11 @@ class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}}
value_type = x.value_ttype
~}}
+{{~if x.comment != '' ~}}
/**
-{{x.comment}}
+ * {{x.comment}}
*/
+{{~end~}}
class {{name}}
{
{{~if x.is_map_table ~}}
@@ -185,9 +191,11 @@ class {{name}}
}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
/**
- {{field.comment}}
+ * {{field.comment}}
*/
+{{~end~}}
{{cpp_define_type field.ctype}}& {{field.cpp_getter_name}}() const { return _data->{{field.cpp_style_name}}; }
{{~end~}}
{{~end~}}
@@ -208,9 +216,11 @@ class {{name}}
{
public:
{{~for table in tables ~}}
+{{~if table.comment != '' ~}}
/**
{{table.comment}}
*/
+{{~end~}}
{{table.cpp_full_name}} {{table.name}};
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/CsCodeBinRender.cs b/src/Luban.Job.Cfg/Source/Generate/CsCodeBinRender.cs
index 2601bfa..c06c796 100644
--- a/src/Luban.Job.Cfg/Source/Generate/CsCodeBinRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/CsCodeBinRender.cs
@@ -26,9 +26,11 @@ using System.Collections.Generic;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Config.BeanBase {{end}}
{
public {{name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
@@ -73,9 +75,11 @@ public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public readonly {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~if field.index_field~}}
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.cs_style_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
@@ -142,9 +146,11 @@ namespace {{x.namespace_with_top_module}}
key_type2 = x.key_ttype2
value_type = x.value_ttype
}}
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed partial class {{name}}
{
{{~if x.is_map_table ~}}
@@ -198,9 +204,11 @@ public sealed partial class {{name}}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}} => _data.{{field.cs_style_name}};
{{~if field.ref~}}
public {{field.cs_ref_type_name}} {{field.cs_ref_var_name}} => _data.{{field.cs_ref_var_name}};
@@ -244,9 +252,11 @@ namespace {{namespace}}
public sealed class {{name}}
{
{{~for table in tables ~}}
+{{~if table.comment != '' ~}}
///
/// {{table.comment}}
///
+{{~end~}}
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/CsCodeJsonRender.cs b/src/Luban.Job.Cfg/Source/Generate/CsCodeJsonRender.cs
index b874f56..954b9c0 100644
--- a/src/Luban.Job.Cfg/Source/Generate/CsCodeJsonRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/CsCodeJsonRender.cs
@@ -27,9 +27,11 @@ using System.Text.Json;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{parent}} {{else}} Bright.Config.BeanBase {{end}}
{
public {{name}}(JsonElement _json) {{if parent_def_type}} : base(_json) {{end}}
@@ -68,9 +70,11 @@ public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public readonly {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~if field.index_field~}}
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.cs_style_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
@@ -139,9 +143,11 @@ using System.Text.Json;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed partial class {{name}}
{
{{~if x.is_map_table ~}}
@@ -193,9 +199,11 @@ public sealed partial class {{name}}
}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}} => _data.{{field.cs_style_name}};
{{~if field.ref~}}
public {{field.cs_ref_type_name}} {{field.cs_ref_var_name}} => _data.{{field.cs_ref_var_name}};
@@ -239,9 +247,11 @@ namespace {{namespace}}
public sealed partial class {{name}}
{
{{~for table in tables ~}}
+{{~if table.comment != '' ~}}
///
/// {{table.comment}}
///
+{{~end~}}
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/CsCodeUnityJsonRender.cs b/src/Luban.Job.Cfg/Source/Generate/CsCodeUnityJsonRender.cs
index adb06ad..ff9b031 100644
--- a/src/Luban.Job.Cfg/Source/Generate/CsCodeUnityJsonRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/CsCodeUnityJsonRender.cs
@@ -27,9 +27,11 @@ using SimpleJSON;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{parent}} {{else}} Bright.Config.BeanBase {{end}}
{
public {{name}}(JSONNode _json) {{if parent_def_type}} : base(_json) {{end}}
@@ -69,9 +71,11 @@ public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public readonly {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~if field.index_field~}}
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.cs_style_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
@@ -140,9 +144,11 @@ using SimpleJSON;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed partial class {{name}}
{
{{~if x.is_map_table ~}}
@@ -197,9 +203,11 @@ public sealed partial class {{name}}
}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}} => _data.{{field.cs_style_name}};
{{~if field.ref~}}
public {{field.cs_ref_type_name}} {{field.cs_ref_var_name}} => _data.{{field.cs_ref_var_name}};
@@ -243,9 +251,11 @@ namespace {{namespace}}
public sealed partial class {{name}}
{
{{~for table in tables ~}}
+{{~if table.comment != '' ~}}
///
/// {{table.comment}}
///
+{{~end~}}
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/JavaCodeBinRender.cs b/src/Luban.Job.Cfg/Source/Generate/JavaCodeBinRender.cs
index 38d1f69..3fe6e58 100644
--- a/src/Luban.Job.Cfg/Source/Generate/JavaCodeBinRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/JavaCodeBinRender.cs
@@ -26,9 +26,11 @@ import bright.serialization.*;
hierarchy_export_fields = x.hierarchy_export_fields
}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
public {{x.java_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x.parent_def_type.full_name_with_top_module}} {{else}} bright.serialization.AbstractBean {{end}}
{
public {{name}}(ByteBuf _buf)
@@ -79,9 +81,11 @@ public {{x.java_class_modifier}} class {{name}} extends {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
public final {{java_define_type field.ctype}} {{field.java_style_name}};
{{~if field.index_field~}}
public final java.util.HashMap<{{java_box_define_type field.index_field.ctype}}, {{java_box_define_type field.ctype.element_type}}> {{field.java_style_name}}_Index = new java.util.HashMap<>();
@@ -158,9 +162,11 @@ import bright.serialization.*;
value_type = x.value_ttype
~}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
public final class {{name}}
{
{{~if x.is_map_table ~}}
@@ -212,9 +218,11 @@ public final class {{name}}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
public {{java_define_type field.ctype}} {{field.java_getter_name}}() { return _data.{{field.java_style_name}}; }
{{~end~}}
@@ -247,9 +255,11 @@ public final class {{name}}
}
{{~for table in tables ~}}
+{{~if table.comment != '' ~}}
/**
* {{table.comment}}
*/
+{{~end~}}
public final {{table.full_name_with_top_module}} {{table.name}};
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/Python27CodeJsonRender.cs b/src/Luban.Job.Cfg/Source/Generate/Python27CodeJsonRender.cs
index 6f448f7..d1c1e6e 100644
--- a/src/Luban.Job.Cfg/Source/Generate/Python27CodeJsonRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/Python27CodeJsonRender.cs
@@ -23,9 +23,11 @@ namespace Luban.Job.Cfg.Generate
hierarchy_export_fields = x.hierarchy_export_fields
}}
+{{~if x.comment != '' ~}}
'''
{{x.comment}}
'''
+{{~end~}}
class {{name}} {{if parent_def_type}}({{parent_def_type.py_full_name}}){{end}}:
{{~if x.is_abstract_type~}}
_childrenTypes = None
@@ -78,9 +80,11 @@ class {{name}} {{if parent_def_type}}({{parent_def_type.py_full_name}}){{end}}:
key_type2 = x.key_ttype2
value_type = x.value_ttype
}}
+{{~if x.comment != '' ~}}
'''
{{x.comment}}
'''
+{{~end~}}
class {{name}}:
{{~if x.is_map_table ~}}
@@ -107,9 +111,11 @@ class {{name}}:
def getData(self) : return self._data
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
'''
{{field.comment}}
'''
+{{~end~}}
def {{field.py_style_name}}(self) : return self._data.{{field.py_style_name}}
{{~end~}}
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/Python3CodeJsonRender.cs b/src/Luban.Job.Cfg/Source/Generate/Python3CodeJsonRender.cs
index efb9917..0b327cb 100644
--- a/src/Luban.Job.Cfg/Source/Generate/Python3CodeJsonRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/Python3CodeJsonRender.cs
@@ -101,9 +101,11 @@ class {{name}}:
def getData(self) : return self._data
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
'''
{{field.comment}}
'''
+{{~end~}}
def {{field.py_style_name}}(self) : return self._data.{{field.py_style_name}}
{{~end~}}
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs b/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs
index 372f572..1b32d0e 100644
--- a/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs
@@ -21,14 +21,18 @@ namespace Luban.Job.Cfg.Generate
var template = t_tsConstRender ??= Template.Parse(@"
+{{~if x.comment != '' ~}}
'''
{{x.comment}}
'''
+{{~end~}}
class {{x.py_full_name}}:
{{~ for item in x.items ~}}
+{{~if item.comment != '' ~}}
'''
{{item.comment}}
'''
+{{~end~}}
{{item.name}} = {{py_const_value item.ctype item.value}}
{{~end~}}
{{~if (x.items == empty)~}}
@@ -46,14 +50,18 @@ class {{x.py_full_name}}:
public override string Render(DefEnum e)
{
var template = t_tsEnumRender ??= Template.Parse(@"
+{{~if comment != '' ~}}
'''
{{comment}}
'''
+{{~end~}}
class {{py_full_name}}:
{{~ for item in items ~}}
+{{~if item.comment != '' ~}}
'''
{{item.comment}}
'''
+{{~end~}}
{{item.name}} = {{item.value}}
{{~end~}}
{{~if (items == empty)~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeBinRender.cs b/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeBinRender.cs
index 41905e7..b5f88d8 100644
--- a/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeBinRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeBinRender.cs
@@ -23,9 +23,11 @@ namespace Luban.Job.Cfg.Generate
}}
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def_type}} extends {{x.parent}}{{end}} {
{{~if x.is_abstract_type~}}
static constructorFrom(_buf_: ByteBuf): {{name}} {
@@ -48,9 +50,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
}
{{~ for field in export_fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
readonly {{field.ts_style_name}}{{if field.is_nullable}}?{{end}}: {{ts_define_type field.ctype}}
{{~if field.gen_ref~}}
{{field.ts_ref_validator_define}}
@@ -91,9 +95,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
value_type = x.value_ttype
}}
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export class {{name}} {
{{~if x.is_map_table ~}}
private _dataMap: Map<{{ts_define_type key_type}}, {{ts_define_type value_type}}>
@@ -134,9 +140,11 @@ export class {{name}} {
getData(): {{ts_define_type value_type}} { return this._data }
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
get {{field.ts_style_name}}(): {{ts_define_type field.ctype}} { return this._data.{{field.ts_style_name}} }
{{~end~}}
@@ -170,9 +178,11 @@ type ByteBufLoader = (file: string) => ByteBuf
export class {{name}} {
{{~ for table in tables ~}}
private _{{table.name}}: {{table.full_name}}
+{{~if table.comment != '' ~}}
/**
* {{table.comment}}
*/
+{{~end~}}
get {{table.name}}(): {{table.full_name}} { return this._{{table.name}}}
{{~end~}}
diff --git a/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeJsonRender.cs b/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeJsonRender.cs
index a26e6d8..02e6c02 100644
--- a/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeJsonRender.cs
+++ b/src/Luban.Job.Cfg/Source/Generate/TypescriptCodeJsonRender.cs
@@ -23,9 +23,11 @@ namespace Luban.Job.Cfg.Generate
}}
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def_type}} extends {{x.parent}}{{end}} {
{{~if x.is_abstract_type~}}
static constructorFrom(_json_: any): {{name}} {
@@ -51,9 +53,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
}
{{~ for field in export_fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
readonly {{field.ts_style_name}}{{if field.is_nullable}}?{{end}}: {{ts_define_type field.ctype}}
{{~if field.gen_ref~}}
{{field.ts_ref_validator_define}}
@@ -94,9 +98,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
value_type = x.value_ttype
}}
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export class {{name}}{
{{~if x.is_map_table ~}}
private _dataMap: Map<{{ts_define_type key_type}}, {{ts_define_type value_type}}>
@@ -134,9 +140,11 @@ export class {{name}}{
getData(): {{ts_define_type value_type}} { return this._data; }
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
get {{field.ts_style_name}}(): {{ts_define_type field.ctype}} { return this._data.{{field.ts_style_name}}; }
{{~end~}}
@@ -170,9 +178,11 @@ type JsonLoader = (file: string) => any
export class {{name}} {
{{~ for table in tables ~}}
private _{{table.name}}: {{table.full_name}}
+{{~if table.comment != '' ~}}
/**
* {{table.comment}}
*/
+{{~end~}}
get {{table.name}}(): {{table.full_name}} { return this._{{table.name}};}
{{~end~}}
diff --git a/src/Luban.Job.Common/Source/Utils/RenderUtil.cs b/src/Luban.Job.Common/Source/Utils/RenderUtil.cs
index 23ebe7b..6bbb935 100644
--- a/src/Luban.Job.Common/Source/Utils/RenderUtil.cs
+++ b/src/Luban.Job.Common/Source/Utils/RenderUtil.cs
@@ -21,15 +21,19 @@ namespace Luban.Job.Common.Utils
var template = t_constRender ??= Template.Parse(@"
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed class {{x.name}}
{
{{~ for item in x.items ~}}
+{{~if item.comment != '' ~}}
///
/// {{item.comment}}
///
+{{~end~}}
public const {{cs_define_type item.ctype}} {{item.name}} = {{cs_const_value item.ctype item.value}};
{{~end~}}
}
@@ -48,18 +52,22 @@ namespace {{x.namespace_with_top_module}}
var template = t_enumRender ??= Template.Parse(@"
namespace {{namespace_with_top_module}}
{
+{{~if comment != '' ~}}
///
/// {{comment}}
///
+{{~end~}}
{{~if is_flags~}}
[System.Flags]
{{~end~}}
public enum {{name}}
{
{{~ for item in items ~}}
+{{~if item.comment != '' ~}}
///
/// {{item.comment}}
///
+{{~end~}}
{{item.name}} = {{item.value}},
{{~end~}}
}
@@ -87,15 +95,19 @@ namespace {{namespace_with_top_module}}
var template = t_javaConstRender ??= Template.Parse(@"
package {{x.namespace_with_top_module}};
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
public final class {{x.name}}
{
{{~ for item in x.items ~}}
+{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
+{{~end~}}
public static final {{java_define_type item.ctype}} {{item.name}} = {{java_const_value item.ctype item.value}};
{{~end~}}
}
@@ -113,15 +125,19 @@ public final class {{x.name}}
{
var template = t_javaEnumRender ??= Template.Parse(@"
package {{namespace_with_top_module}};
+{{~if comment != '' ~}}
/**
* {{comment}}
*/
+{{~end~}}
public enum {{name}}
{
{{~ for item in items ~}}
+{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
+{{~end~}}
{{item.name}}({{item.value}}),
{{~end~}}
;
@@ -163,15 +179,19 @@ public enum {{name}}
var template = t_cppConstRender ??= Template.Parse(@"
{{x.cpp_namespace_begin}}
+{{~if comment != '' ~}}
/**
-{{x.comment}}
-*/
+ * {{comment}}
+ */
+{{~end~}}
struct {{x.name}}
{
{{~ for item in x.items ~}}
+{{~if item.comment != '' ~}}
/**
- {{item.comment}}
+ * {{item.comment}}
*/
+{{~end~}}
static constexpr {{cpp_define_type item.ctype}} {{item.name}} = {{cpp_const_value item.ctype item.value}};
{{~end~}}
};
@@ -189,15 +209,19 @@ struct {{x.name}}
{
var template = t_cppEnumRender ??= Template.Parse(@"
{{cpp_namespace_begin}}
+{{~if comment != '' ~}}
/**
-{{comment}}
-*/
+ * {{comment}}
+ */
+{{~end~}}
enum class {{name}}
{
{{~ for item in items ~}}
+{{~if item.comment != '' ~}}
/**
- {{item.comment}}
+ * {{item.comment}}
*/
+{{~end~}}
{{item.name}} = {{item.value}},
{{~end~}}
};
@@ -223,14 +247,18 @@ enum class {{name}}
var template = t_tsConstRender ??= Template.Parse(@"
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export class {{x.name}} {
{{~ for item in x.items ~}}
+{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
+{{~end~}}
static {{item.name}} = {{ts_const_value item.ctype item.value}};
{{~end~}}
}
@@ -248,14 +276,18 @@ export class {{x.name}} {
{
var template = t_tsEnumRender ??= Template.Parse(@"
{{typescript_namespace_begin}}
+{{~if comment != '' ~}}
/**
* {{comment}}
*/
+{{~end~}}
export enum {{name}} {
{{~for item in items ~}}
+{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
+{{~end~}}
{{item.name}} = {{item.value}},
{{~end~}}
}
diff --git a/src/Luban.Job.Db/Source/Generate/AsyncCsRender.cs b/src/Luban.Job.Db/Source/Generate/AsyncCsRender.cs
index 99016d6..3fb7c64 100644
--- a/src/Luban.Job.Db/Source/Generate/AsyncCsRender.cs
+++ b/src/Luban.Job.Db/Source/Generate/AsyncCsRender.cs
@@ -50,9 +50,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_def_type.name}} {{end}}
{
{{~ for field in fields~}}
@@ -60,9 +62,11 @@ public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_d
{{~end~}}
}
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Transaction.TxnBeanBase {{end}}, {{readonly_name}}
{
{{~ for field in fields~}}
@@ -97,9 +101,11 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}}
{
get
@@ -136,21 +142,27 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
{{~else~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}} => {{field.internal_name}};
{{~end~}}
{{~if ctype.bean || ctype.element_type ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => {{field.internal_name}};
{{~else if ctype.is_map~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => new Bright.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}});
{{~end~}}
{{~end~}}
@@ -249,9 +261,11 @@ using System.Threading.Tasks;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed class {{name}}
{
public static {{base_table_type}} Table { get; } = new {{internal_table_type}}();
diff --git a/src/Luban.Job.Db/Source/Generate/SyncCsRender.cs b/src/Luban.Job.Db/Source/Generate/SyncCsRender.cs
index 686782e..8984e8d 100644
--- a/src/Luban.Job.Db/Source/Generate/SyncCsRender.cs
+++ b/src/Luban.Job.Db/Source/Generate/SyncCsRender.cs
@@ -50,9 +50,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_def_type.name}} {{end}}
{
{{~ for field in fields~}}
@@ -60,9 +62,11 @@ public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_d
{{~end~}}
}
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Transaction.TxnBeanBase {{end}}, {{readonly_name}}
{
{{~ for field in fields~}}
@@ -97,9 +101,11 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}}
{
get
@@ -136,21 +142,27 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
{{~else~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}} => {{field.internal_name}};
{{~end~}}
{{~if ctype.bean || ctype.element_type ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => {{field.internal_name}};
{{~else if ctype.is_map~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => new Bright.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}});
{{~end~}}
{{~end~}}
@@ -249,9 +261,11 @@ using System.Threading.Tasks;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed class {{name}}
{
public static {{base_table_type}} Table { get; } = new {{internal_table_type}}();
diff --git a/src/Luban.Job.Db/Source/Generate/TypescriptRender.cs b/src/Luban.Job.Db/Source/Generate/TypescriptRender.cs
index 9c9c246..7e97a83 100644
--- a/src/Luban.Job.Db/Source/Generate/TypescriptRender.cs
+++ b/src/Luban.Job.Db/Source/Generate/TypescriptRender.cs
@@ -49,14 +49,18 @@ namespace Luban.Job.Db.Generate
}}
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x.parent}} {{else}} TxnBeanBase {{end}}{
{{~ for field in fields~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
{{if is_abstract_type}}protected{{else}}private{{end}} {{field.internal_name}}: {{db_ts_define_type field.ctype}}
{{~end}}
@@ -84,9 +88,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
get {{field.ts_style_name}}(): {{db_ts_define_type ctype}} {
if (this.isManaged) {
var txn = TransactionContext.current
@@ -98,9 +104,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
set {{field.ts_style_name}}(value: {{db_ts_define_type ctype}}) {
{{~if db_field_cannot_null~}}
if (value == null) throw new Error()
@@ -117,9 +125,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
{{~else~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
get {{field.ts_style_name}}(): {{db_ts_define_type ctype}} { return {{field.internal_name_with_this}} }
{{~end~}}
{{~end~}}
@@ -231,9 +241,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export class {{name}} {
static readonly _table = new {{internal_table_type}}();
static get table(): TxnTableGeneric<{{db_ts_define_type key_ttype}},{{db_ts_define_type value_ttype}}> { return this._table }
diff --git a/src/Luban.Job.Proto/Source/Generate/CsRender.cs b/src/Luban.Job.Proto/Source/Generate/CsRender.cs
index 0e034c2..3a1477f 100644
--- a/src/Luban.Job.Proto/Source/Generate/CsRender.cs
+++ b/src/Luban.Job.Proto/Source/Generate/CsRender.cs
@@ -53,9 +53,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public {{if is_value_type}}struct{{else}}{{x.cs_class_modifier}} class{{end}} {{name}} : {{if parent_def_type}} {{parent}} {{else}} Bright.Serialization.BeanBase {{end}}
{
{{~if !is_value_type~}}
@@ -113,9 +115,11 @@ namespace {{x.namespace_with_top_module}}
}
{{~ for field in fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~end~}}
@@ -172,15 +176,19 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed class {{name}} : Bright.Net.Codecs.Protocol
{
{{~ for field in fields ~}}
+{{~if field.comment != '' ~}}
///
/// {{field.comment}}
///
+{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~end~}}
@@ -264,9 +272,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
+{{~if x.comment != '' ~}}
///
/// {{x.comment}}
///
+{{~end~}}
public sealed class {{name}} : Bright.Net.Codecs.Rpc<{{cs_define_type targ_type}}, {{cs_define_type tres_type}}>
{
public {{name}}()
diff --git a/src/Luban.Job.Proto/Source/Generate/TypescriptRender.cs b/src/Luban.Job.Proto/Source/Generate/TypescriptRender.cs
index 9e63315..32c551d 100644
--- a/src/Luban.Job.Proto/Source/Generate/TypescriptRender.cs
+++ b/src/Luban.Job.Proto/Source/Generate/TypescriptRender.cs
@@ -55,9 +55,11 @@ namespace Luban.Job.Proto.Generate
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export {{if x.is_abstract_type}} abstract {{end}} class {{name}} extends {{if parent_def_type}}{{x.parent}}{{else}}BeanBase{{end}} {
{{~if x.is_abstract_type~}}
static serializeTo(_buf_ : ByteBuf, _bean_ : {{name}}) {
@@ -84,9 +86,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} extends {{if pa
{{~ for field in fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
{{field.ts_style_name}}{{if field.is_nullable}}?{{end}} : {{ts_define_type field.ctype}}
{{~end~}}
@@ -144,18 +148,22 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} extends {{if pa
}}
{{x.typescript_namespace_begin}}
+{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
+{{~end~}}
export class {{name}} extends Protocol {
static readonly ID = {{x.id}}
getTypeId() { return {{name}}.ID }
{{~ for field in fields ~}}
+{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
+{{~end~}}
{{field.ts_style_name}}{{if field.is_nullable}}?{{end}} : {{ts_define_type field.ctype}}
{{~end~}}