chromium/components/cronet/tools/generators/c_templates/module_impl_interface.h.tmpl

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/* DO NOT EDIT. Generated from {{module.path}} */

{%- if variant -%}
{%-   set variant_path = "%s-%s"|format(module.path, variant) -%}
{%- else -%}
{%-   set variant_path = module.path -%}
{%- endif %}

{%- set header_guard = "%s_IMPL_INTERFACE_H_"|format(
        variant_path|upper|replace("/","_")|replace(".","_")|
            replace("-", "_")) %}

{%- import "module_macros.tmpl" as module_macros %}

#ifndef {{header_guard}}
#define {{header_guard}}

#include <string>
#include <vector>

#include "{{variant_path}}_c.h"

{# Interface Stubs #}
{%  for interface in interfaces %}
{%- set interface_name = interface|get_name_for_kind %}
struct {{interface_name}} {
  {{interface_name}}() = default;

  {{interface_name}}(const {{interface_name}}&) = delete;
  {{interface_name}}& operator=(const {{interface_name}}&) = delete;

  virtual ~{{interface_name}}() = default;

  void set_client_context(Cronet_ClientContext client_context) {
    client_context_ = client_context;
  }
  Cronet_ClientContext client_context() const { return client_context_; }

{% for method in interface.methods %}
{%-  if method.response_parameters and method.sync %}
{%-   for param in method.response_parameters %}
virtual {{param.kind|c_wrapper_type}}
{%-   endfor -%}
{%-  else %}
virtual void
{%- endif %}
   {{method.name}}({{module_macros.declare_c_params("", method.parameters)}}) = 0;
{%- endfor %}
 private:
  Cronet_ClientContext client_context_ = nullptr;
};

{% endfor %}
#endif  // {{header_guard}}