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