| OLD | NEW |
| (Empty) | |
| 1 {%- set mojom_type = union|get_qualified_name_for_kind %} |
| 2 |
| 3 template <> |
| 4 struct {{export_attribute}} UnionTraits<{{mojom_type}}::DataView, |
| 5 {{mojom_type}}Ptr> { |
| 6 static bool IsNull(const {{mojom_type}}Ptr& input) { return !input; } |
| 7 static void SetToNull({{mojom_type}}Ptr* output) { output->reset(); } |
| 8 |
| 9 static {{mojom_type}}::Tag GetTag(const {{mojom_type}}Ptr& input) { |
| 10 return input->which(); |
| 11 } |
| 12 |
| 13 {%- for field in union.fields %} |
| 14 {%- set return_ref = field.kind|is_object_kind or |
| 15 field.kind|is_any_handle_or_interface_kind %} |
| 16 {%- if return_ref %} |
| 17 static decltype(std::declval<{{mojom_type}}>().get_{{field.name}}()) |
| 18 {{field.name}}({{mojom_type}}Ptr& input) { |
| 19 return input->get_{{field.name}}(); |
| 20 } |
| 21 {%- else %} |
| 22 static decltype(std::declval<{{mojom_type}}>().get_{{field.name}}()) |
| 23 {{field.name}}(const {{mojom_type}}Ptr& input) { |
| 24 return input->get_{{field.name}}(); |
| 25 } |
| 26 {%- endif %} |
| 27 {%- endfor %} |
| 28 |
| 29 static bool Read({{mojom_type}}::DataView input, {{mojom_type}}Ptr* output); |
| 30 }; |
| OLD | NEW |