OLD | NEW |
1 // static | 1 // static |
2 {{struct.name}}Ptr {{struct.name}}::New() { | 2 {{struct.name}}Ptr {{struct.name}}::New() { |
3 {{struct.name}}Ptr rv; | 3 {{struct.name}}Ptr rv; |
4 mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv); | 4 mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv); |
5 return rv; | 5 return rv; |
6 } | 6 } |
7 | 7 |
8 {{struct.name}}::{{struct.name}}() | 8 {{struct.name}}::{{struct.name}}() |
9 {%- for field in struct.fields %} | 9 {%- for field in struct.fields %} |
10 {% if loop.first %}:{% else %} {% endif %} {{field.name}}({{field|default_va
lue}}){% if not loop.last %},{% endif %} | 10 {% if loop.first %}:{% else %} {% endif %} {{field.name}}({{field|default_va
lue}}){% if not loop.last %},{% endif %} |
11 {%- endfor %} { | 11 {%- endfor %} { |
12 } | 12 } |
13 | 13 |
14 {{struct.name}}::~{{struct.name}}() { | 14 {{struct.name}}::~{{struct.name}}() { |
15 } | 15 } |
16 | |
17 {% if struct|is_cloneable_kind %} | |
18 {{struct.name}}Ptr {{struct.name}}::Clone() const { | |
19 {{struct.name}}Ptr rv(New()); | |
20 {%- for field in struct.fields %} | |
21 {%- if field.kind|is_object_kind and not field.kind|is_string_kind %} | |
22 rv->{{field.name}} = {{field.name}}.Clone(); | |
23 {%- else %} | |
24 rv->{{field.name}} = {{field.name}}; | |
25 {%- endif %} | |
26 {%- endfor %} | |
27 return rv; | |
28 } | |
29 {% endif %} | |
OLD | NEW |