OLD | NEW |
1 {%- import "struct_macros.tmpl" as struct_macros %} | 1 {%- import "struct_macros.tmpl" as struct_macros %} |
2 {%- set class_name = struct.name ~ "_Data" %} | 2 {%- set class_name = struct.name ~ "_Data" %} |
3 {%- set method_name = "k%s_%s_Name"|format(interface.name, method.name) %} | |
4 const uint32_t {{method_name}} = {{method.ordinal}}; | |
5 class {{class_name}} { | 3 class {{class_name}} { |
6 public: | 4 public: |
7 static {{class_name}}* New(mojo::Buffer* buf) { | 5 static {{class_name}}* New(mojo::Buffer* buf) { |
8 return new (buf->Allocate(sizeof({{class_name}}))) | 6 return new (buf->Allocate(sizeof({{class_name}}))) |
9 {{class_name}}(); | 7 {{class_name}}(); |
10 } | 8 } |
11 | 9 |
12 {#--- Setters -#} | 10 {#--- Setters -#} |
13 {{ struct_macros.setters(struct) }} | 11 {{ struct_macros.setters(struct) }} |
14 | 12 |
(...skipping 20 matching lines...) Expand all Loading... |
35 {{class_name}}() { | 33 {{class_name}}() { |
36 _header_.num_bytes = sizeof(*this); | 34 _header_.num_bytes = sizeof(*this); |
37 _header_.num_fields = 3; | 35 _header_.num_fields = 3; |
38 } | 36 } |
39 | 37 |
40 mojo::internal::StructHeader _header_; | 38 mojo::internal::StructHeader _header_; |
41 {{ struct_macros.fields(struct) }} | 39 {{ struct_macros.fields(struct) }} |
42 }; | 40 }; |
43 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}}, | 41 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}}, |
44 bad_sizeof_{{class_name}}); | 42 bad_sizeof_{{class_name}}); |
OLD | NEW |