OLD | NEW |
| (Empty) |
1 {%- import "struct_macros.tmpl" as struct_macros %} | |
2 {%- set class_name = struct.name ~ "_Data" %} | |
3 | |
4 // static | |
5 {{class_name}}* {{class_name}}::New(mojo::internal::Buffer* buf) { | |
6 return new (buf->Allocate(sizeof({{class_name}}))) {{class_name}}(); | |
7 } | |
8 | |
9 // static | |
10 bool {{class_name}}::Validate(const void* data, | |
11 mojo::internal::BoundsChecker* bounds_checker) { | |
12 {{ struct_macros.validate(struct, class_name)|indent(2) }} | |
13 } | |
14 | |
15 {{class_name}}::{{class_name}}() { | |
16 header_.num_bytes = sizeof(*this); | |
17 header_.num_fields = {{struct.packed.packed_fields|length}}; | |
18 } | |
19 | |
20 void {{class_name}}::EncodePointersAndHandles( | |
21 std::vector<mojo::Handle>* handles) { | |
22 {{ struct_macros.encodes(struct)|indent(2) }} | |
23 } | |
24 | |
25 void {{class_name}}::DecodePointersAndHandles( | |
26 std::vector<mojo::Handle>* handles) { | |
27 {{ struct_macros.decodes(struct)|indent(2) }} | |
28 } | |
OLD | NEW |