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