summaryrefslogtreecommitdiff
path: root/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl
blob: 8649273633342ba417f784440b025b2745460c68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{%- macro declare_params(prefix, parameters) %}
{%-   for param in parameters -%}
{{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}}
{%- if not loop.last %}, {% endif %}
{%-   endfor %}
{%- endmacro %}

{%- macro declare_responder_params(prefix, parameters, for_blink) %}
{%-   for param in parameters -%}
{{param.kind|cpp_wrapper_param_type}} {{prefix}}{{param.name}}
{%- if not loop.last %}, {% endif %}
{%-   endfor %}
{%- endmacro %}

{%- macro declare_callback(method, for_blink, use_once_callback) -%}
{%-   if use_once_callback -%}
base::OnceCallback<void(
{%-   else -%}
base::Callback<void(
{%-   endif -%}
{%-   for param in method.response_parameters -%}
{{param.kind|cpp_wrapper_param_type}}
{%-     if not loop.last %}, {% endif %}
{%-   endfor -%}
)>
{%- endmacro -%}

{%- macro declare_request_params(prefix, method, use_once_callback) -%}
{{declare_params(prefix, method.parameters)}}
{%-   if method.response_parameters != None -%}
{%-     if method.parameters %}, {% endif -%}
{%-     if use_once_callback -%}
{{method.name}}Callback callback
{%-     else -%}
const {{method.name}}Callback& callback
{%-     endif -%}
{%-   endif -%}
{%- endmacro -%}

{%- macro declare_sync_method_params(prefix, method) -%}
{{declare_params(prefix, method.parameters)}}
{%-   if method.response_parameters %}
{%-     if method.parameters %}, {% endif %}
{%-     for param in method.response_parameters -%}
{{param.kind|cpp_wrapper_type}}* {{prefix}}{{param.name}}
{%-       if not loop.last %}, {% endif %}
{%-     endfor %}
{%-   endif -%}
{%- endmacro -%}