• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2016 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5{%- set header_guard = "%s_SHARED_INTERNAL_H_"|format(
6        module.path|upper|replace("/","_")|replace(".","_")|
7            replace("-", "_")) %}
8
9#ifndef {{header_guard}}
10#define {{header_guard}}
11
12#include "mojo/public/cpp/bindings/lib/array_internal.h"
13#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
14#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
15#include "mojo/public/cpp/bindings/lib/buffer.h"
16
17{%- for import in imports %}
18#include "{{import.path}}-shared-internal.h"
19{%- endfor %}
20
21{%- if not disallow_native_types %}
22#include "mojo/public/cpp/bindings/lib/native_enum_data.h"
23#include "mojo/public/interfaces/bindings/native_struct.mojom-shared-internal.h"
24{%- endif %}
25
26{%- if export_header %}
27#include "{{export_header}}"
28{%- endif %}
29
30namespace mojo {
31namespace internal {
32class ValidationContext;
33}
34}
35
36{%- for namespace in namespaces_as_array %}
37namespace {{namespace}} {
38{%- endfor %}
39namespace internal {
40
41{#--- Internal forward declarations #}
42{%- for struct in structs %}
43{%-   if struct|is_native_only_kind %}
44using {{struct.name}}_Data = mojo::native::internal::NativeStruct_Data;
45{%-   else %}
46class {{struct.name}}_Data;
47{%-   endif %}
48{%- endfor %}
49
50{%- for union in unions %}
51class {{union.name}}_Data;
52{%- endfor %}
53
54{#--- Enums #}
55{%- from "enum_macros.tmpl" import enum_data_decl -%}
56{%- for enum in all_enums %}
57{%-   if enum|is_native_only_kind %}
58using {{enum|get_name_for_kind(flatten_nested_kind=True)}}_Data =
59    mojo::internal::NativeEnum_Data;
60{%-   else %}
61{{enum_data_decl(enum)}}
62{%-   endif %}
63{%- endfor %}
64
65#pragma pack(push, 1)
66
67{#--- Unions must be declared first because they can be members of structs #}
68{#--- Union class declarations #}
69{%- for union in unions %}
70{%    include "union_declaration.tmpl" %}
71{%- endfor %}
72
73{#--- Struct class declarations #}
74{%- for struct in structs %}
75{%-   if not struct|is_native_only_kind %}
76{%      include "struct_declaration.tmpl" %}
77{%      include "struct_unserialized_message_context.tmpl" %}
78{%-   endif %}
79{%- endfor %}
80
81{#--- Interface parameter definitions #}
82{%- for interface in interfaces %}
83{%-   for method in interface.methods %}
84{%-     set struct = method.param_struct %}
85{%      include "struct_declaration.tmpl" %}
86{%-     if method.response_parameters != None %}
87{%-       set struct = method.response_param_struct %}
88{%        include "struct_declaration.tmpl" %}
89{%-     endif %}
90{%-   endfor %}
91{%- endfor %}
92
93#pragma pack(pop)
94
95}  // namespace internal
96{%- for namespace in namespaces_as_array|reverse %}
97}  // namespace {{namespace}}
98{%- endfor %}
99
100#endif  // {{header_guard}}
101