OLD | NEW |
1 {%- import "interface_macros.tmpl" as interface_macros %} | 1 {%- import "interface_macros.tmpl" as interface_macros %} |
2 {%- import "struct_macros.tmpl" as struct_macros %} | 2 {%- import "struct_macros.tmpl" as struct_macros %} |
3 | 3 |
4 {%- set class_name = interface.name %} | 4 {%- set class_name = interface.name %} |
5 {%- set proxy_name = interface.name ~ "Proxy" %} | 5 {%- set proxy_name = interface.name ~ "Proxy" %} |
6 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} | |
7 | 6 |
8 {%- macro alloc_params(struct, serialization_context) %} | 7 {%- macro alloc_params(struct, serialization_context) %} |
9 bool success = true; | 8 bool success = true; |
10 {%- for param in struct.packed.packed_fields_in_ordinal_order %} | 9 {%- for param in struct.packed.packed_fields_in_ordinal_order %} |
11 {{param.field.kind|cpp_wrapper_type}} p_{{param.field.name}}{}; | 10 {{param.field.kind|cpp_wrapper_type}} p_{{param.field.name}}{}; |
12 {%- endfor %} | 11 {%- endfor %} |
13 {{struct_macros.deserialize(struct, "params", "p_%s", serialization_context, "
success")}} | 12 {{struct_macros.deserialize(struct, "params", "p_%s", serialization_context, "
success")}} |
14 if (!success) | 13 if (!success) |
15 return false; | 14 return false; |
16 {%- endmacro %} | 15 {%- endmacro %} |
(...skipping 11 matching lines...) Expand all Loading... |
28 | 27 |
29 {%- macro build_message(struct, input_pattern, struct_display_name, | 28 {%- macro build_message(struct, input_pattern, struct_display_name, |
30 serialization_context) -%} | 29 serialization_context) -%} |
31 {{struct_macros.serialize(struct, struct_display_name, input_pattern, | 30 {{struct_macros.serialize(struct, struct_display_name, input_pattern, |
32 "params", "builder.buffer()", | 31 "params", "builder.buffer()", |
33 serialization_context)}} | 32 serialization_context)}} |
34 params->EncodePointersAndHandles(builder.message()->mutable_handles()); | 33 params->EncodePointersAndHandles(builder.message()->mutable_handles()); |
35 {%- endmacro %} | 34 {%- endmacro %} |
36 | 35 |
37 {#--- Begin #} | 36 {#--- Begin #} |
38 MOJO_STATIC_CONST_MEMBER_DEFINITION const char {{class_name}}::Name_[] = "{{name
space_as_string}}::{{class_name}}"; | 37 MOJO_STATIC_CONST_MEMBER_DEFINITION const char {{class_name}}::Name_[] = "{{name
space}}.{{class_name}}"; |
39 MOJO_STATIC_CONST_MEMBER_DEFINITION const uint32_t {{class_name}}::Version_; | 38 MOJO_STATIC_CONST_MEMBER_DEFINITION const uint32_t {{class_name}}::Version_; |
40 | 39 |
41 {#--- Constants #} | 40 {#--- Constants #} |
42 {%- for constant in interface.constants %} | 41 {%- for constant in interface.constants %} |
43 {%- if constant.kind|is_integral_kind %} | 42 {%- if constant.kind|is_integral_kind %} |
44 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}}; | 43 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}}; |
45 {%- else %} | 44 {%- else %} |
46 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}} = {{constant|constant_value}}; | 45 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
face.name}}::{{constant.name}} = {{constant|constant_value}}; |
47 {%- endif %} | 46 {%- endif %} |
48 {%- endfor %} | 47 {%- endfor %} |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 default: | 399 default: |
401 break; | 400 break; |
402 } | 401 } |
403 | 402 |
404 // Unrecognized message. | 403 // Unrecognized message. |
405 ReportValidationError( | 404 ReportValidationError( |
406 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); | 405 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); |
407 return false; | 406 return false; |
408 } | 407 } |
409 {%- endif -%} | 408 {%- endif -%} |
OLD | NEW |