comparison Resources/CodeGeneration/template.in.h.j2 @ 676:1b47f17863ba am-dev

codegen: using an ordereddict loader instead of sort the keys -> the delcared ordered in the yaml is preserved in the generated code which is more meaningfull than the alphabetical order
author Alain Mazy <alain@mazy.be>
date Thu, 16 May 2019 09:49:30 +0200
parents 5dd496343fad
children e8b83fe55a33
comparison
equal deleted inserted replaced
674:163ac23b8bff 676:1b47f17863ba
392 #pragma region {{struct['name']}} 392 #pragma region {{struct['name']}}
393 #endif //_MSC_VER 393 #endif //_MSC_VER
394 394
395 struct {{struct['name']}} 395 struct {{struct['name']}}
396 { 396 {
397 {% if struct %}{% if struct['fields'] %}{% for key in sorted(struct['fields']) %} {{CanonToCpp(struct['fields'][key]['type'])}} {{key}}; 397 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields'] %} {{CanonToCpp(struct['fields'][key]['type'])}} {{key}};
398 {% endfor %}{% endif %}{% endif %} 398 {% endfor %}{% endif %}{% endif %}
399 {{struct['name']}}({% if struct %}{% if struct['fields'] %}{% for key in sorted(struct['fields']) %}{{CanonToCpp(struct['fields'][key]['type'])}} {{key}} = {% if struct['fields'][key]['defaultValue'] %}{{DefaultValueToCpp(rootName,enums,struct['fields'][key])}} {%else%} {{CanonToCpp(struct['fields'][key]['type'])}}() {%endif%} {{ ", " if not loop.last }}{% endfor %}{% endif %}{% endif %}) 399 {{struct['name']}}({% if struct %}{% if struct['fields'] %}{% for key in struct['fields'] %}{{CanonToCpp(struct['fields'][key]['type'])}} {{key}} = {% if struct['fields'][key]['defaultValue'] %}{{DefaultValueToCpp(rootName,enums,struct['fields'][key])}} {%else%} {{CanonToCpp(struct['fields'][key]['type'])}}() {%endif%} {{ ", " if not loop.last }}{% endfor %}{% endif %}{% endif %})
400 { 400 {
401 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} this->{{key}} = {{key}}; 401 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} this->{{key}} = {{key}};
402 {% endfor %}{% endif %}{% endif %} } 402 {% endfor %}{% endif %}{% endif %} }
403 }; 403 };
404 404