| {%- import "interface_macros.tmpl" as interface_macros %} |
| class {{interface.name}}Proxy; |
| class {{interface.name}}Stub; |
| |
| class {{interface.name}}RequestValidator; |
| {%- if interface|has_callbacks %} |
| class {{interface.name}}ResponseValidator; |
| {%- endif %} |
| |
| class {{interface.name}} { |
| public: |
| {%- if interface.service_name %} |
| static const char Name_[]; |
| {%- endif %} |
| static const uint32_t Version_ = {{interface.version}}; |
| |
| using Proxy_ = {{interface.name}}Proxy; |
| using Stub_ = {{interface.name}}Stub; |
| |
| using RequestValidator_ = {{interface.name}}RequestValidator; |
| {%- if interface|has_callbacks %} |
| using ResponseValidator_ = {{interface.name}}ResponseValidator; |
| {%- else %} |
| using ResponseValidator_ = mojo::internal::PassThroughValidator; |
| {%- endif %} |
| |
| {#--- Enums #} |
| {% from "enum_macros.tmpl" import enum_decl -%} |
| {%- for enum in interface.enums %} |
| {{enum_decl(enum, is_static=true)|indent(2)}} |
| {%- endfor %} |
| |
| {#--- Constants #} |
| {%- for constant in interface.constants %} |
| {%- if constant.kind|is_integral_kind %} |
| static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_value}}; |
| {%- else %} |
| static const {{constant.kind|cpp_pod_type}} {{constant.name}}; |
| {%- endif %} |
| {%- endfor %} |
| |
| virtual ~{{interface.name}}() {} |
| |
| {#--- Methods #} |
| enum class MessageOrdinals : uint32_t { |
| {%- for method in interface.methods %} |
| {{method.name}} = {{method.ordinal}}, |
| {%- endfor %} |
| }; |
| {%- for method in interface.methods %} |
| {%- if method.response_parameters != None %} |
| using {{method.name}}Callback = {{interface_macros.declare_callback(method)}}; |
| {%- endif %} |
| virtual void {{method.name}}({{interface_macros.declare_request_params("", method)}}) = 0; |
| {%- endfor %} |
| }; |
| |
| {#--- Enum Operators #} |
| {% from "enum_macros.tmpl" import global_enum_operators_decl -%} |
| {%- for enum in interface.enums %} |
| {{global_enum_operators_decl(enum, class_name=interface.name)}} |
| {%- endfor %} |