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 class {{class_name}} { | 3 class {{class_name}} { |
4 public: | 4 public: |
5 typedef {{struct.name}} Wrapper; | 5 typedef {{struct.name}} Wrapper; |
6 | 6 |
7 {#--- Enums #} | 7 {#--- Enums #} |
8 {%- for enum in struct.enums %} | 8 {%- for enum in struct.enums %} |
9 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %} | 9 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %} |
10 {{enum_def()|indent(2)}} | 10 {{enum_def()|indent(2)}} |
11 {%- endfor %} | 11 {%- endfor %} |
12 | 12 |
13 static {{class_name}}* New(mojo::Buffer* buf, mojo::Buffer::Destructor dtor =
NULL); | 13 static {{class_name}}* New(mojo::Buffer* buf, mojo::Buffer::Destructor dtor =
NULL); |
14 | 14 |
15 {#--- Setters -#} | 15 {#--- Setters -#} |
16 {{ struct_macros.setters(struct) }} | 16 {{ struct_macros.setters(struct) }} |
17 | 17 |
18 {#--- Getters -#} | 18 {#--- Getters -#} |
19 {{ struct_macros.getters(struct) }} | 19 {{ struct_macros.getters(struct) }} |
20 | 20 |
| 21 size_t ComputeSize() const; |
| 22 {{class_name}}* Clone(mojo::Buffer* buf) const; |
| 23 void CloseHandles(); |
| 24 void EncodePointersAndHandles(std::vector<mojo::Handle>* handles); |
| 25 bool DecodePointersAndHandles(mojo::Message* message); |
| 26 |
21 private: | 27 private: |
22 friend class mojo::internal::ObjectTraits<{{class_name}}>; | |
23 | |
24 {{class_name}}(); | 28 {{class_name}}(); |
25 ~{{class_name}}(); // NOT IMPLEMENTED | 29 ~{{class_name}}(); // NOT IMPLEMENTED |
26 | 30 |
27 mojo::internal::StructHeader _header_; | 31 mojo::internal::StructHeader _header_; |
28 {{ struct_macros.fields(struct) }} | 32 {{ struct_macros.fields(struct) }} |
29 }; | 33 }; |
30 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}}, | 34 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}}, |
31 bad_sizeof_{{class_name}}); | 35 bad_sizeof_{{class_name}}); |
OLD | NEW |