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