blob: 7f6497475a62f318d71dc3a9e486148af8bd628c [file] [log] [blame]
{%- import "interface_macros.tmpl" as interface_macros %}
class {{interface.name}}Proxy;
template <typename ImplRefTraits>
class {{interface.name}}Stub;
class {{interface.name}}RequestValidator;
{%- if interface|has_callbacks %}
class {{interface.name}}ResponseValidator;
{%- endif %}
class {{export_attribute}} {{interface.name}}
: public {{interface.name}}InterfaceBase {
public:
static const char Name_[];
static constexpr uint32_t Version_ = {{interface.version}};
static constexpr bool PassesAssociatedKinds_ = {% if interface|passes_associated_kinds %}true{% else %}false{% endif %};
static constexpr bool HasSyncMethods_ = {% if interface|has_sync_methods %}true{% else %}false{% endif %};
using Proxy_ = {{interface.name}}Proxy;
template <typename ImplRefTraits>
using Stub_ = {{interface.name}}Stub<ImplRefTraits>;
using RequestValidator_ = {{interface.name}}RequestValidator;
{%- if interface|has_callbacks %}
using ResponseValidator_ = {{interface.name}}ResponseValidator;
{%- else %}
using ResponseValidator_ = mojo::PassThroughFilter;
{%- endif %}
{#--- Metadata #}
enum MethodMinVersions : uint32_t {
{%- for method in interface.methods %}
k{{method.name}}MinVersion = {{method.min_version|default(0, true)}},
{%- endfor %}
};
{#--- Enums #}
{%- for enum in interface.enums %}
using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}};
{%- endfor %}
{#--- Constants #}
{%- for constant in interface.constants %}
static {{constant|format_constant_declaration(nested=True)}};
{%- endfor %}
{#--- Methods #}
virtual ~{{interface.name}}() {}
{%- for method in interface.methods %}
{% if method.response_parameters != None %}
{%- if method.sync %}
// Sync method. This signature is used by the client side; the service side
// should implement the signature with callback below.
virtual bool {{method.name}}({{interface_macros.declare_sync_method_params("", method)}});
{%- endif %}
using {{method.name}}Callback = {{interface_macros.declare_callback(method,
for_blink, use_once_callback)}};
{%- endif %}
virtual void {{method.name}}({{interface_macros.declare_request_params("", method, use_once_callback)}}) = 0;
{%- endfor %}
};