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

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

Issue 273233002: Mojo cpp bindings: add support for validating incoming messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and rebase Created 6 years, 7 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 | Annotate | Revision Log
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
5 class {{interface.name}}RequestValidator;
6 {%- if interface|has_callbacks %}
7 class {{interface.name}}ResponseValidator;
8 {%- endif %}
4 {% if interface.client %} 9 {% if interface.client %}
5 class {{interface.client}}; 10 class {{interface.client}};
6 {% endif %} 11 {% endif %}
7 12
8 class {{interface.name}} { 13 class {{interface.name}} {
9 public: 14 public:
10 typedef {{interface.name}}Proxy Proxy_; 15 typedef {{interface.name}}Proxy Proxy_;
11 typedef {{interface.name}}Stub Stub_; 16 typedef {{interface.name}}Stub Stub_;
17
18 typedef {{interface.name}}RequestValidator RequestValidator_;
19 {%- if interface|has_callbacks %}
20 typedef {{interface.name}}ResponseValidator ResponseValidator_;
21 {%- else %}
22 typedef mojo::PassThroughFilter ResponseValidator_;
23 {%- endif %}
12 {% if interface.client %} 24 {% if interface.client %}
13 typedef {{interface.client}} Client; 25 typedef {{interface.client}} Client;
14 {% else %} 26 {% else %}
15 typedef mojo::NoInterface Client; 27 typedef mojo::NoInterface Client;
16 {% endif %} 28 {% endif %}
17 29
18 {#--- Constants #} 30 {#--- Constants #}
19 {%- for constant in interface.constants %} 31 {%- for constant in interface.constants %}
20 static const {{constant.kind|cpp_pod_type}} {{constant.name}}; 32 static const {{constant.kind|cpp_pod_type}} {{constant.name}};
21 {%- endfor %} 33 {%- endfor %}
22 34
23 {#--- Enums #} 35 {#--- Enums #}
24 {%- for enum in interface.enums %} 36 {%- for enum in interface.enums %}
25 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %} 37 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %}
26 {{enum_def()|indent(2)}} 38 {{enum_def()|indent(2)}}
27 {%- endfor %} 39 {%- endfor %}
28 40
29 {#--- Methods #} 41 {#--- Methods #}
30 virtual ~{{interface.name}}() {} 42 virtual ~{{interface.name}}() {}
43
31 {%- if interface.client %} 44 {%- if interface.client %}
32 // Called once before any other method. 45 // Called once before any other method.
33 virtual void SetClient({{interface.client}}* client) = 0; 46 virtual void SetClient({{interface.client}}* client) = 0;
34 {%- else %} 47 {%- else %}
35 virtual void SetClient(mojo::NoInterface* client) {} 48 virtual void SetClient(mojo::NoInterface* client) {}
36 {%- endif %} 49 {%- endif %}
37 {%- for method in interface.methods %} 50 {%- for method in interface.methods %}
38 virtual void {{method.name}}({{interface_macros.declare_request_params("", met hod)}}) = 0; 51 virtual void {{method.name}}({{interface_macros.declare_request_params("", met hod)}}) = 0;
39 {%- endfor %} 52 {%- endfor %}
40 }; 53 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698