Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl

Issue 884043003: Cpp bindings: add typedef for callbacks. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: use using instead of typedef in cpp templates Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {%- import "interface_macros.tmpl" as interface_macros %} 1 {%- import "interface_macros.tmpl" as interface_macros %}
2 class {{interface.name}}Proxy; 2 class {{interface.name}}Proxy;
3 class {{interface.name}}Stub; 3 class {{interface.name}}Stub;
4 4
5 class {{interface.name}}RequestValidator; 5 class {{interface.name}}RequestValidator;
6 {%- if interface|has_callbacks %} 6 {%- if interface|has_callbacks %}
7 class {{interface.name}}ResponseValidator; 7 class {{interface.name}}ResponseValidator;
8 {%- endif %} 8 {%- endif %}
9 {% if interface.client %} 9 {% if interface.client %}
10 class {{interface.client}}; 10 class {{interface.client}};
11 {% endif %} 11 {% endif %}
12 12
13 class {{interface.name}} { 13 class {{interface.name}} {
14 public: 14 public:
15 static const char* Name_; 15 static const char* Name_;
16 16
17 typedef {{interface.name}}Proxy Proxy_; 17 using Proxy_ = {{interface.name}}Proxy;
18 typedef {{interface.name}}Stub Stub_; 18 using Stub_ = {{interface.name}}Stub;
19 19
20 typedef {{interface.name}}RequestValidator RequestValidator_; 20 using RequestValidator_ = {{interface.name}}RequestValidator;
21 {%- if interface|has_callbacks %} 21 {%- if interface|has_callbacks %}
22 typedef {{interface.name}}ResponseValidator ResponseValidator_; 22 using ResponseValidator_ = {{interface.name}}ResponseValidator;
23 {%- else %} 23 {%- else %}
24 typedef mojo::PassThroughFilter ResponseValidator_; 24 using ResponseValidator_ = mojo::PassThroughFilter;
25 {%- endif %} 25 {%- endif %}
26 {% if interface.client %} 26 {% if interface.client %}
27 typedef {{interface.client}} Client; 27 using Client = {{interface.client}};
28 {% else %} 28 {% else %}
29 typedef mojo::NoInterface Client; 29 using Client = mojo::NoInterface;
30 {% endif %} 30 {% endif %}
31 31
32 {#--- Constants #} 32 {#--- Constants #}
33 {%- for constant in interface.constants %} 33 {%- for constant in interface.constants %}
34 static const {{constant.kind|cpp_pod_type}} {{constant.name}}; 34 static const {{constant.kind|cpp_pod_type}} {{constant.name}};
35 {%- endfor %} 35 {%- endfor %}
36 36
37 {#--- Enums #} 37 {#--- Enums #}
38 {%- for enum in interface.enums %} 38 {%- for enum in interface.enums %}
39 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %} 39 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %}
40 {{enum_def()|indent(2)}} 40 {{enum_def()|indent(2)}}
41 {%- endfor %} 41 {%- endfor %}
42 42
43 {#--- Methods #} 43 {#--- Methods #}
44 virtual ~{{interface.name}}() {} 44 virtual ~{{interface.name}}() {}
45 45
46 {%- for method in interface.methods %} 46 {%- for method in interface.methods %}
47 {% if method.response_parameters != None %}
48 using {{method.name}}Callback = {{interface_macros.declare_callback(method)}};
49 {%- endif %}
47 virtual void {{method.name}}({{interface_macros.declare_request_params("", met hod)}}) = 0; 50 virtual void {{method.name}}({{interface_macros.declare_request_params("", met hod)}}) = 0;
48 {%- endfor %} 51 {%- endfor %}
49 }; 52 };
OLDNEW
« no previous file with comments | « no previous file | mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698