summaryrefslogtreecommitdiff
path: root/chromium/mojo/public/tools/bindings/generators/cpp_templates/module-shared.cc.tmpl
blob: f51f9bd81cd02827cad94b7af109f96bd3d89e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2016 The Chromium Authors. All rights reserved.
// 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"

#include <utility>

#include "base/logging.h"
#include "base/stl_util.h"  // for base::size()
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_context.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"

#include "{{module.path}}-params-data.h"

{%- 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 %}
{%- for enum in all_enums %}
{%-   if not enum|is_native_only_kind %}
{{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

{%- for namespace in namespaces_as_array|reverse %}
}  // namespace {{namespace}}
{%- endfor %}