| OLD | NEW |
| (Empty) |
| 1 {% import "struct_macros.tmpl" as struct_macros %} | |
| 2 | |
| 3 {%- macro declare_params_as_args(prefix, parameters) %} | |
| 4 {%- for param in parameters -%} | |
| 5 {{param.kind|cpp_const_wrapper_type}} {{prefix}}{{param.name}} | |
| 6 {%- if not loop.last %}, {% endif %} | |
| 7 {%- endfor %} | |
| 8 {%- endmacro %} | |
| 9 | |
| 10 {# This declares mojo structs for the request and response parameters for each | |
| 11 interface method, along with forward declarations of any dependencies. #} | |
| 12 {%- macro declare_param_structs_for_interface(interface) %} | |
| 13 {%- for method in interface.methods %} | |
| 14 {# Request params #} | |
| 15 {%- if method.parameters != None %} | |
| 16 {%- set struct = method.param_struct %} | |
| 17 {{ struct_macros.structptr_forward_decl(struct) }} | |
| 18 {% include "struct_serialization_declaration.tmpl" %} | |
| 19 {% include "wrapper_class_declaration.tmpl" %} | |
| 20 {%- endif %} | |
| 21 {# Response params #} | |
| 22 {%- if method.response_parameters != None %} | |
| 23 {%- set struct = method.response_param_struct %} | |
| 24 {{ struct_macros.structptr_forward_decl(struct) }} | |
| 25 {% include "struct_serialization_declaration.tmpl" %} | |
| 26 {% include "wrapper_class_declaration.tmpl" %} | |
| 27 {%- endif %} | |
| 28 {%- endfor %} | |
| 29 {%- endmacro %} | |
| 30 | |
| 31 {%- macro declare_callback(method) -%} | |
| 32 mojo::Callback<void( | |
| 33 {%- for param in method.response_parameters -%} | |
| 34 {{param.kind|cpp_result_type}} | |
| 35 {%- if not loop.last %}, {% endif %} | |
| 36 {%- endfor -%} | |
| 37 )> | |
| 38 {%- endmacro -%} | |
| 39 | |
| 40 {%- macro declare_request_params(prefix, method) -%} | |
| 41 {{declare_params_as_args(prefix, method.parameters)}} | |
| 42 {%- if method.response_parameters != None -%} | |
| 43 {%- if method.parameters %}, {% endif -%} | |
| 44 const {{method.name}}Callback& callback | |
| 45 {%- endif -%} | |
| 46 {%- endmacro -%} | |
| 47 | |
| 48 {%- macro declare_sync_request_params(method) -%} | |
| 49 {{declare_params_as_args("in_", method.parameters)}} | |
| 50 {#- You could have a response message without any fields! -#} | |
| 51 {%- if method.response_parameters != None and method.response_parameters|lengt
h > 0 -%} | |
| 52 {%- if method.parameters %}, {% endif -%} | |
| 53 {%- for param in method.response_parameters -%} | |
| 54 {{param.kind|cpp_result_type}}* out_{{param.name}} | |
| 55 {%- if not loop.last %}, {% endif -%} | |
| 56 {%- endfor -%} | |
| 57 {%- endif -%} | |
| 58 {%- endmacro -%} | |
| OLD | NEW |