Mercurial > hg > orthanc-stone
comparison Resources/CodeGeneration/template.in.ts @ 507:ce49eae4c887 bgo-commands-codegen
Codegen + Warning fixes
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 01 Mar 2019 16:18:38 +0100 |
parents | 6405435480ae |
children | 7105a0bad250 |
comparison
equal
deleted
inserted
replaced
506:801d2697a1b1 | 507:ce49eae4c887 |
---|---|
1 /* | 1 /* |
2 1 2 3 4 5 6 7 | 2 1 2 3 4 5 6 7 |
3 12345678901234567890123456789012345678901234567890123456789012345678901234567890 | 3 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
4 | |
5 Generated on {{currentDatetime}} by stonegentool | |
6 | |
4 */ | 7 */ |
5 | 8 |
6 function StoneCheckSerializedValueType(value: any, typeStr: string) | 9 function StoneCheckSerializedValueType(value: any, typeStr: string) |
7 { | 10 { |
8 StoneCheckSerializedValueTypeGeneric(value); | 11 StoneCheckSerializedValueTypeGeneric(value); |
40 {%endfor%} | 43 {%endfor%} |
41 }; | 44 }; |
42 {%endfor%} | 45 {%endfor%} |
43 | 46 |
44 {% for struct in structs%} export class {{struct['name']}} { | 47 {% for struct in structs%} export class {{struct['name']}} { |
45 {% for key in struct['fields']%} {{key}}:{{CanonToTs(struct['fields'][key])}}; | 48 {% if struct %} |
46 {% endfor %} | 49 {% if struct['fields'] %} |
50 {% for key in struct['fields']%} | |
51 {{key}}:{{CanonToTs(struct['fields'][key])}}; | |
52 {% endfor %} | |
53 {% endif %} | |
54 {% endif %} | |
47 constructor() { | 55 constructor() { |
48 {% for key in struct['fields']%}{% if NeedsTsConstruction(enums,CanonToTs(struct['fields'][key])) %} this.{{key}} = new {{CanonToTs(struct['fields'][key])}}(); | 56 {% if struct %} |
49 {% endif %}{% endfor %} } | 57 {% if struct['fields'] %} |
58 {% for key in struct['fields']%} | |
59 {% if NeedsTsConstruction(enums,CanonToTs(struct['fields'][key])) %} | |
60 this.{{key}} = new {{CanonToTs(struct['fields'][key])}}(); | |
61 {% endif %} | |
62 {% endfor %} | |
63 {% endif %} | |
64 {% endif %} | |
65 } | |
50 | 66 |
51 public StoneSerialize(): string { | 67 public StoneSerialize(): string { |
52 let container: object = {}; | 68 let container: object = {}; |
53 container['type'] = '{{rootName}}.{{struct['name']}}'; | 69 container['type'] = '{{rootName}}.{{struct['name']}}'; |
54 container['value'] = this; | 70 container['value'] = this; |