comparison Resources/CodeGeneration/template.in.h.j2 @ 687:342f3e04bfa9 am-dev

CodeGen: test cleanup + all working again + using same yaml and stimuli files
author Alain Mazy <alain@mazy.be>
date Thu, 16 May 2019 17:51:17 +0200
parents e8b83fe55a33
children f185cfcb72a0
comparison
equal deleted inserted replaced
686:0d42bda615a8 687:342f3e04bfa9
226 for (typename std::map<TK, TV>::const_iterator it = value.cbegin(); 226 for (typename std::map<TK, TV>::const_iterator it = value.cbegin();
227 it != value.cend(); ++it) 227 it != value.cend(); ++it)
228 { 228 {
229 out << MakeIndent(indent+2) << "\"" << it->first << "\" : "; 229 out << MakeIndent(indent+2) << "\"" << it->first << "\" : ";
230 StoneDumpValue(out, it->second, indent+2); 230 StoneDumpValue(out, it->second, indent+2);
231 out << ", \n";
231 } 232 }
232 out << MakeIndent(indent) << "}\n"; 233 out << MakeIndent(indent) << "}\n";
233 return out; 234 return out;
234 } 235 }
235 236
267 { 268 {
268 out << MakeIndent(indent) << "[\n"; 269 out << MakeIndent(indent) << "[\n";
269 for (size_t i = 0; i < value.size(); ++i) 270 for (size_t i = 0; i < value.size(); ++i)
270 { 271 {
271 StoneDumpValue(out, value[i], indent+2); 272 StoneDumpValue(out, value[i], indent+2);
273 out << ", \n";
272 } 274 }
273 out << MakeIndent(indent) << "]\n"; 275 out << MakeIndent(indent) << "]\n";
274 return out; 276 return out;
275 } 277 }
276 278
307 { 309 {
308 out << MakeIndent(indent) << "[\n"; 310 out << MakeIndent(indent) << "[\n";
309 for (typename std::set<T>::const_iterator it = value.begin(); it != value.end(); ++it) 311 for (typename std::set<T>::const_iterator it = value.begin(); it != value.end(); ++it)
310 { 312 {
311 StoneDumpValue(out, *it, indent+2); 313 StoneDumpValue(out, *it, indent+2);
314 out << ", \n";
312 } 315 }
313 out << MakeIndent(indent) << "]\n"; 316 out << MakeIndent(indent) << "]\n";
314 return out; 317 return out;
315 } 318 }
316 319
393 396
394 inline std::ostream& StoneDumpValue(std::ostream& out, const {{enum['name']}}& value, size_t indent = 0) 397 inline std::ostream& StoneDumpValue(std::ostream& out, const {{enum['name']}}& value, size_t indent = 0)
395 { 398 {
396 {% for key in enum['fields']%} if( value == {{enum['name']}}_{{key}}) 399 {% for key in enum['fields']%} if( value == {{enum['name']}}_{{key}})
397 { 400 {
398 out << MakeIndent(indent) << "{{key}}" << std::endl; 401 out << MakeIndent(indent) << "{{key}}";
399 } 402 }
400 {%endfor%} return out; 403 {%endfor%} return out;
401 } 404 }
402 405
403 {%endfor%} 406 {%endfor%}
433 } 436 }
434 437
435 inline std::ostream& StoneDumpValue(std::ostream& out, const {{struct['name']}}& value, size_t indent = 0) 438 inline std::ostream& StoneDumpValue(std::ostream& out, const {{struct['name']}}& value, size_t indent = 0)
436 { 439 {
437 out << MakeIndent(indent) << "{\n"; 440 out << MakeIndent(indent) << "{\n";
438 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} out << MakeIndent(indent) << "{{key}}:\n"; 441 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} out << MakeIndent(indent+2) << "{{key}}: ";
439 StoneDumpValue(out, value.{{key}},indent+2); 442 StoneDumpValue(out, value.{{key}},indent+2);
440 out << "\n"; 443 out << ", \n";
441 {% endfor %}{% endif %}{% endif %} 444 {% endfor %}{% endif %}{% endif %}
442 out << MakeIndent(indent) << "}\n"; 445 out << MakeIndent(indent) << "}";
443 return out; 446 return out;
444 } 447 }
445 448
446 inline void StoneDeserialize({{struct['name']}}& destValue, const Json::Value& value) 449 inline void StoneDeserialize({{struct['name']}}& destValue, const Json::Value& value)
447 { 450 {