chromium/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl

// 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.

{%- from 'cpp_macros.tmpl' import
  include_guard, namespace_begin, namespace_end %}

{%- set header_guard = include_guard("SHARED_INTERNAL", module.path) %}

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

{%- if not contains_only_enums %}
#include "mojo/public/cpp/bindings/lib/array_internal.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
#include "mojo/public/cpp/bindings/lib/buffer.h"
{%- endif %}

{%- for import in imports %}
#include "{{import.path}}-shared-internal.h"
{%- endfor %}

{%- if not disallow_native_types %}
#include "mojo/public/cpp/bindings/lib/native_enum_data.h"
#include "mojo/public/interfaces/bindings/native_struct.mojom-shared-internal.h"
{%- endif %}

{%- if export_header %}
#include "{{export_header}}"
{%- endif %}

{% if enable_kythe_annotations -%}
#ifdef KYTHE_IS_RUNNING
#pragma kythe_inline_metadata "Metadata comment"
#endif
{%- endif %}

namespace mojo {
namespace internal {
class ValidationContext;
}
}

{{namespace_begin(namespaces_as_array)}}
namespace internal {

{#--- Internal forward declarations #}
{%- for struct in structs %}
{%-   if struct|is_native_only_kind %}
using {{struct.name}}_Data = mojo::native::internal::NativeStruct_Data;
{%-   else %}
class {{struct.name}}_Data;
{%-   endif %}
{%- endfor %}

{%- for union in unions %}
class {{union.name}}_Data;
{%- endfor %}

{#--- Enums #}
{%- from "enum_macros.tmpl" import enum_data_decl -%}
{%- for enum in all_enums %}
{%-   if enum|is_native_only_kind %}
using {{enum|get_name_for_kind(flatten_nested_kind=True)}}_Data =
    mojo::internal::NativeEnum_Data;
{%-   else %}
{{enum_data_decl(enum)}}
{%-   endif %}
{%- endfor %}

#pragma pack(push, 1)

{#--- Unions must be declared first because they can be members of structs #}
{#--- Union class declarations #}
{%- for union in unions %}
{%    include "union_declaration.tmpl" %}
{%- endfor %}

{#--- Struct class declarations #}
{%- for struct in structs %}
{%-   if not struct|is_native_only_kind %}
{%      include "struct_declaration.tmpl" %}
{%      include "struct_unserialized_message_context.tmpl" %}
{%-   endif %}
{%- endfor %}

#pragma pack(pop)

}  // namespace internal
{{namespace_end(namespaces_as_array)}}

#endif  // {{header_guard}}