diff options
author | Csaba Hruska <csaba.hruska@gmail.com> | 2015-09-16 12:01:08 +0200 |
---|---|---|
committer | Csaba Hruska <csaba.hruska@gmail.com> | 2015-09-16 12:01:08 +0200 |
commit | 76f4fd3deff8fd63e15d2198a2f633d933ccbae9 (patch) | |
tree | 5abac484f52be7adf71ef607bc3111c3f2eca7ca /templates | |
parent | 59ecb368b77ae5fb619aacd7afbf1457393c3f2e (diff) |
error handling in C++
Diffstat (limited to 'templates')
-rw-r--r-- | templates/data.cpp.ede | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/templates/data.cpp.ede b/templates/data.cpp.ede index a1bcdf7..c56d9fc 100644 --- a/templates/data.cpp.ede +++ b/templates/data.cpp.ede | |||
@@ -26,13 +26,15 @@ template<> {{ t.value.dataName }} fromJSON<{{ t.value.dataName }}>({{ t.value.da | |||
26 | {% if !c.first %}else {% endif %}if (tag == "{{ c.value.name }}") { | 26 | {% if !c.first %}else {% endif %}if (tag == "{{ c.value.name }}") { |
27 | tagType = ::{{ t.value.dataName }}::tag::{{ c.value.name }}; | 27 | tagType = ::{{ t.value.dataName }}::tag::{{ c.value.name }}; |
28 | {% if !(c.value.fields | empty) %} | 28 | {% if !(c.value.fields | empty) %} |
29 | ::data::{{ c.value.name }} tv;{% for f in c.value.fields %}{% if c.value.fields | hasFieldNames %} | 29 | ::data::{{ c.value.name }} tv; |
30 | tv.tag = tagType;{% for f in c.value.fields %}{% if c.value.fields | hasFieldNames %} | ||
30 | tv.{{ f.value.fieldName }} = fromJSON(tv.{{ f.value.fieldName }}, obj["{{ f.value.fieldName }}"]);{% else %} | 31 | tv.{{ f.value.fieldName }} = fromJSON(tv.{{ f.value.fieldName }}, obj["{{ f.value.fieldName }}"]);{% else %} |
31 | tv._{{ f.index0 }} = fromJSON(tv._{{ f.index0 }}, obj["arg{{ f.index0 }}"]);{% endif %}{% endfor %} | 32 | tv._{{ f.index0 }} = fromJSON(tv._{{ f.index0 }}, obj["arg{{ f.index0 }}"]);{% endif %}{% endfor %} |
32 | return tv; | 33 | return tv; |
33 | {% endif %} | 34 | {% endif %} |
34 | } | 35 | } |
35 | {% endfor %} | 36 | {% endfor %} |
37 | else throw "unknown constructor: " + tag; | ||
36 | {{ t.value.dataName }} o; | 38 | {{ t.value.dataName }} o; |
37 | o.tag = tagType; | 39 | o.tag = tagType; |
38 | return o; | 40 | return o; |