Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl

Issue 1517043004: [mojo] Add typemap and variant support to generators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pickle3
Patch Set: set proper upstream Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 {%- set header_guard = "%s_H_"| 5 {%- if variant -%}
6 format(module.path|upper|replace("/","_")|replace(".","_")) %} 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%}
7 {%- else -%}
8 {%- set variant_path = module.path -%}
9 {%- endif -%}
10
11 {%- set header_guard = "%s_H_"|format(
12 variant_path|upper|replace("/","_")|replace(".","_")|
13 replace("-", "_")) %}
7 14
8 #ifndef {{header_guard}} 15 #ifndef {{header_guard}}
9 #define {{header_guard}} 16 #define {{header_guard}}
10 17
11 #include <stdint.h> 18 #include <stdint.h>
12 19
13 #include "mojo/public/cpp/bindings/array.h" 20 #include "mojo/public/cpp/bindings/array.h"
14 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" 21 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
15 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" 22 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
16 #include "mojo/public/cpp/bindings/associated_interface_request.h" 23 #include "mojo/public/cpp/bindings/associated_interface_request.h"
17 #include "mojo/public/cpp/bindings/callback.h" 24 #include "mojo/public/cpp/bindings/callback.h"
18 #include "mojo/public/cpp/bindings/interface_ptr.h" 25 #include "mojo/public/cpp/bindings/interface_ptr.h"
19 #include "mojo/public/cpp/bindings/interface_request.h" 26 #include "mojo/public/cpp/bindings/interface_request.h"
20 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" 27 #include "mojo/public/cpp/bindings/lib/control_message_handler.h"
21 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" 28 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
22 #include "mojo/public/cpp/bindings/map.h" 29 #include "mojo/public/cpp/bindings/map.h"
23 #include "mojo/public/cpp/bindings/message_filter.h" 30 #include "mojo/public/cpp/bindings/message_filter.h"
24 #include "mojo/public/cpp/bindings/no_interface.h" 31 #include "mojo/public/cpp/bindings/no_interface.h"
25 #include "mojo/public/cpp/bindings/string.h" 32 #include "mojo/public/cpp/bindings/string.h"
26 #include "mojo/public/cpp/bindings/struct_ptr.h" 33 #include "mojo/public/cpp/bindings/struct_ptr.h"
27 #include "{{module.path}}-internal.h" 34 #include "{{variant_path}}-internal.h"
28 {%- for import in imports %} 35 {%- for import in imports %}
29 #include "{{import.module.path}}.h" 36 #include "{{import.module.path}}.h"
30 {%- endfor %} 37 {%- endfor %}
31 38
32 {%- for namespace in namespaces_as_array %} 39 {%- for namespace in namespaces_as_array %}
33 namespace {{namespace}} { 40 namespace {{namespace}} {
34 {%- endfor %} 41 {%- endfor %}
42 {%- if variant %}
43 namespace {{variant}} {
44 {%- endif %}
35 45
36 {#--- Enums #} 46 {#--- Enums #}
37 {% from "enum_macros.tmpl" import enum_decl -%} 47 {% from "enum_macros.tmpl" import enum_decl -%}
38 {% for enum in enums %} 48 {% for enum in enums %}
39 {{enum_decl(enum)}} 49 {{enum_decl(enum)}}
40 {%- endfor %} 50 {%- endfor %}
41 51
42 {#--- Constants #} 52 {#--- Constants #}
43 {%- for constant in module.constants %} 53 {%- for constant in module.constants %}
44 {#- To be consistent with constants defined inside interfaces, only make 54 {#- To be consistent with constants defined inside interfaces, only make
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 {%- endfor %} 142 {%- endfor %}
133 {%- endif %} 143 {%- endif %}
134 144
135 {#--- Union Serialization Helpers -#} 145 {#--- Union Serialization Helpers -#}
136 {% if unions %} 146 {% if unions %}
137 {% for union in unions %} 147 {% for union in unions %}
138 {% include "union_serialization_declaration.tmpl" %} 148 {% include "union_serialization_declaration.tmpl" %}
139 {%- endfor %} 149 {%- endfor %}
140 {%- endif %} 150 {%- endif %}
141 151
152 {%- if variant %}
153 } // namespace {{variant}}
154 {%- endif %}
142 {%- for namespace in namespaces_as_array|reverse %} 155 {%- for namespace in namespaces_as_array|reverse %}
143 } // namespace {{namespace}} 156 } // namespace {{namespace}}
144 {%- endfor %} 157 {%- endfor %}
145 158
146 #endif // {{header_guard}} 159 #endif // {{header_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698