// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "{{module.path}}-shared.h"
// Used to support stream output operator for enums.
// TODO(dcheng): Consider omitting this somehow if not needed.
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "{{module.path}}-params-data.h"
{%- if features %}
#include "{{module.path}}-features.h"
{%- endif %}
{%- for header in extra_traits_headers %}
#include "{{header}}"
{%- endfor %}
{%- for namespace in namespaces_as_array %}
namespace {{namespace}} {
{%- endfor %}
{#--- Enums #}
{%- from "enum_macros.tmpl" import enum_stream, enum_to_string %}
{%- for enum in all_enums %}
{%- if not enum|is_native_only_kind %}
{{enum_to_string(enum)}}
{{enum_stream(enum)}}
{%- endif %}
{%- endfor %}
namespace internal {
{#--- Union definitions #}
{%- for union in unions %}
{% include "union_definition.tmpl" %}
{%- endfor %}
{#--- Struct definitions #}
{%- for struct in structs %}
{%- if not struct|is_native_only_kind %}
{% include "struct_definition.tmpl" %}
{%- endif %}
{%- endfor %}
{#--- Interface parameter definitions #}
{%- for interface in interfaces %}
{%- for method in interface.methods %}
{%- set struct = method.param_struct %}
{% include "struct_definition.tmpl" %}
{%- if method.response_parameters != None %}
{%- set struct = method.response_param_struct %}
{% include "struct_definition.tmpl" %}
{%- endif %}
{%- endfor %}
{%- endfor %}
} // namespace internal
{#--- Feature definitions #}
{%- for feature in features %}
{% include "feature_definition.tmpl" %}
{%- endfor %}
{%- for namespace in namespaces_as_array|reverse %}
} // namespace {{namespace}}
{%- endfor %}
{#--- TraceFormatTraits specialisation for enums #}
{%- from "enum_macros.tmpl" import enum_trace_format_traits %}
{%- for enum in all_enums %}
{%- if not enum|is_native_only_kind %}
{{enum_trace_format_traits(enum)}}
{%- endif %}
{%- endfor %}