OLD | NEW |
1 {%- from "enum_macros.tmpl" import is_valid_enum_def %} | |
2 | |
3 {#--- Enums #} | |
4 {%- for enum in struct.enums -%} | |
5 {{is_valid_enum_def(enum, class_name=struct.name)}} | |
6 {%- endfor %} | |
7 | |
8 // static | 1 // static |
9 {{struct.name}}Ptr {{struct.name}}::New() { | 2 {{struct.name}}Ptr {{struct.name}}::New() { |
10 {{struct.name}}Ptr rv; | 3 {{struct.name}}Ptr rv; |
11 mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv); | 4 mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv); |
12 return rv; | 5 return rv; |
13 } | 6 } |
14 | 7 |
15 {{struct.name}}::{{struct.name}}() | 8 {{struct.name}}::{{struct.name}}() |
16 {%- for field in struct.fields %} | 9 {%- for field in struct.fields %} |
17 {% 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 %} |
(...skipping 22 matching lines...) Expand all Loading... |
40 {%- if field.kind|is_typemapped_kind %} | 33 {%- if field.kind|is_typemapped_kind %} |
41 {# TODO(rockot): Consider adding support for native equality testing. #} | 34 {# TODO(rockot): Consider adding support for native equality testing. #} |
42 NOTREACHED() << "Equality testing not supported with typemapped fields."; | 35 NOTREACHED() << "Equality testing not supported with typemapped fields."; |
43 {%- else %} | 36 {%- else %} |
44 if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(this
->{{field.name}}, other.{{field.name}})) | 37 if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(this
->{{field.name}}, other.{{field.name}})) |
45 return false; | 38 return false; |
46 {%- endif %} | 39 {%- endif %} |
47 {%- endfor %} | 40 {%- endfor %} |
48 return true; | 41 return true; |
49 } | 42 } |
OLD | NEW |