OLD | NEW |
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 | 9 |
10 class {{export_attribute}} {{interface.name}} { | 10 class {{export_attribute}} {{interface.name}} { |
11 public: | 11 public: |
12 static const char Name_[]; | 12 static const char Name_[]; |
13 static const uint32_t Version_ = {{interface.version}}; | 13 static const uint32_t Version_ = {{interface.version}}; |
14 static const bool PassesAssociatedKinds_ = {% if interface|passes_associated_k
inds %}true{% else %}false{% endif %}; | 14 static const bool PassesAssociatedKinds_ = {% if interface|passes_associated_k
inds %}true{% else %}false{% endif %}; |
15 static const bool HasSyncMethods_ = {% if interface|has_sync_methods %}true{%
else %}false{% endif %}; | 15 static const bool HasSyncMethods_ = {% if interface|has_sync_methods %}true{%
else %}false{% endif %}; |
16 | 16 |
17 using Proxy_ = {{interface.name}}Proxy; | 17 using Proxy_ = {{interface.name}}Proxy; |
18 using Stub_ = {{interface.name}}Stub; | 18 using Stub_ = {{interface.name}}Stub; |
19 | 19 |
20 using RequestValidator_ = {{interface.name}}RequestValidator; | 20 using RequestValidator_ = {{interface.name}}RequestValidator; |
21 {%- if interface|has_callbacks %} | 21 {%- if interface|has_callbacks %} |
22 using ResponseValidator_ = {{interface.name}}ResponseValidator; | 22 using ResponseValidator_ = {{interface.name}}ResponseValidator; |
23 {%- else %} | 23 {%- else %} |
24 using ResponseValidator_ = mojo::PassThroughFilter; | 24 using ResponseValidator_ = mojo::PassThroughFilter; |
25 {%- endif %} | 25 {%- endif %} |
26 | 26 |
27 {#--- Enums #} | 27 {#--- Enums #} |
28 {% from "enum_macros.tmpl" import enum_decl -%} | |
29 {%- for enum in interface.enums %} | 28 {%- for enum in interface.enums %} |
30 {%- if enum|is_native_only_kind %} | 29 using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}}; |
31 using {{enum.name}} = mojo::NativeEnum; | |
32 {%- else %} | |
33 {{enum_decl(enum)|indent(2)}} | |
34 {%- endif %} | |
35 {%- endfor %} | 30 {%- endfor %} |
36 | 31 |
37 {#--- Constants #} | 32 {#--- Constants #} |
38 {%- for constant in interface.constants %} | 33 {%- for constant in interface.constants %} |
39 {%- if constant.kind|is_integral_kind %} | 34 {%- if constant.kind|is_integral_kind %} |
40 static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|con
stant_value}}; | 35 static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|con
stant_value}}; |
41 {%- else %} | 36 {%- else %} |
42 static const {{constant.kind|cpp_pod_type}} {{constant.name}}; | 37 static const {{constant.kind|cpp_pod_type}} {{constant.name}}; |
43 {%- endif %} | 38 {%- endif %} |
44 {%- endfor %} | 39 {%- endfor %} |
45 | 40 |
46 {#--- Methods #} | 41 {#--- Methods #} |
47 virtual ~{{interface.name}}() {} | 42 virtual ~{{interface.name}}() {} |
48 | 43 |
49 {%- for method in interface.methods %} | 44 {%- for method in interface.methods %} |
50 {% if method.response_parameters != None %} | 45 {% if method.response_parameters != None %} |
51 {%- if method.sync %} | 46 {%- if method.sync %} |
52 // Sync method. This signature is used by the client side; the service side | 47 // Sync method. This signature is used by the client side; the service side |
53 // should implement the signature with callback below. | 48 // should implement the signature with callback below. |
54 virtual bool {{method.name}}({{interface_macros.declare_sync_method_params("",
method)}}); | 49 virtual bool {{method.name}}({{interface_macros.declare_sync_method_params("",
method)}}); |
55 {%- endif %} | 50 {%- endif %} |
56 | 51 |
57 using {{method.name}}Callback = {{interface_macros.declare_callback(method, | 52 using {{method.name}}Callback = {{interface_macros.declare_callback(method, |
58 for_blink, use_new_wrapper_types)}}; | 53 for_blink, use_new_wrapper_types)}}; |
59 {%- endif %} | 54 {%- endif %} |
60 virtual void {{method.name}}({{interface_macros.declare_request_params("", met
hod)}}) = 0; | 55 virtual void {{method.name}}({{interface_macros.declare_request_params("", met
hod)}}) = 0; |
61 {%- endfor %} | 56 {%- endfor %} |
62 }; | 57 }; |
OLD | NEW |