OLD | NEW |
1 {%- import "struct_macros.tmpl" as struct_macros %} | 1 {%- import "struct_macros.tmpl" as struct_macros %} |
2 size_t GetSerializedSize_(const {{struct.name}}Ptr& input) { | 2 size_t GetSerializedSize_(const {{struct.name}}Ptr& input) { |
3 if (!input) | 3 if (!input) |
4 return 0; | 4 return 0; |
5 {{struct_macros.get_serialized_size(struct, "input->%s")}} | 5 {{struct_macros.get_serialized_size(struct, "input->%s")}} |
6 return size; | 6 return size; |
7 } | 7 } |
8 | 8 |
9 void Serialize_({{struct.name}}Ptr input, mojo::internal::Buffer* buf, | 9 void Serialize_({{struct.name}}Ptr input, mojo::internal::Buffer* buf, |
10 internal::{{struct.name}}_Data** output) { | 10 internal::{{struct.name}}_Data** output) { |
(...skipping 11 matching lines...) Expand all Loading... |
22 bool success = true; | 22 bool success = true; |
23 if (input) { | 23 if (input) { |
24 {{struct.name}}Ptr result({{struct.name}}::New()); | 24 {{struct.name}}Ptr result({{struct.name}}::New()); |
25 {{struct_macros.deserialize(struct, "input", "result->%s", "context", "succe
ss")|indent(2)}} | 25 {{struct_macros.deserialize(struct, "input", "result->%s", "context", "succe
ss")|indent(2)}} |
26 *output = result.Pass(); | 26 *output = result.Pass(); |
27 } else { | 27 } else { |
28 output->reset(); | 28 output->reset(); |
29 } | 29 } |
30 return success; | 30 return success; |
31 } | 31 } |
| 32 |
| 33 {%- if not variant %} |
| 34 |
| 35 {{struct.name}}_Reader::{{struct.name}}_Reader( |
| 36 internal::{{struct.name}}_Data* data, |
| 37 mojo::internal::SerializationContext* context) |
| 38 : data_(data), context_(context) { } |
| 39 |
| 40 {%- for pf in struct.packed.packed_fields_in_ordinal_order %} |
| 41 {%- set name = pf.field.name -%} |
| 42 {%- set kind = pf.field.kind -%} |
| 43 {%- if kind|is_struct_kind %} |
| 44 {{kind|get_name_for_kind}}_Reader {{struct.name}}_Reader::{{name}}() const { |
| 45 return {{kind|get_name_for_kind}}_Reader(data_->{{name}}.ptr, context_); |
| 46 } |
| 47 {%- endif %} |
| 48 {%- endfor %} |
| 49 |
| 50 {%- endif %} |
OLD | NEW |