OLD | NEW |
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 {%- if variant -%} |
| 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} |
| 7 {%- else -%} |
| 8 {%- set variant_path = module.path -%} |
| 9 {%- endif -%} |
| 10 |
5 {%- set header_guard = "%s_H_"| | 11 {%- set header_guard = "%s_H_"| |
6 format(module.path|upper|replace("/","_")|replace(".","_")) %} | 12 format(variant_path|upper|replace("/","_")|replace(".","_")|replace("-",
"_")) %} |
7 | 13 |
8 #ifndef {{header_guard}} | 14 #ifndef {{header_guard}} |
9 #define {{header_guard}} | 15 #define {{header_guard}} |
10 | 16 |
11 #include <stdint.h> | 17 #include <stdint.h> |
12 | 18 |
13 #include "mojo/public/cpp/bindings/array.h" | 19 #include "mojo/public/cpp/bindings/array.h" |
14 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 20 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
15 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 21 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
16 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 22 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
17 #include "mojo/public/cpp/bindings/callback.h" | 23 #include "mojo/public/cpp/bindings/callback.h" |
18 #include "mojo/public/cpp/bindings/interface_ptr.h" | 24 #include "mojo/public/cpp/bindings/interface_ptr.h" |
19 #include "mojo/public/cpp/bindings/interface_request.h" | 25 #include "mojo/public/cpp/bindings/interface_request.h" |
20 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" | 26 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
21 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" | 27 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
22 #include "mojo/public/cpp/bindings/map.h" | 28 #include "mojo/public/cpp/bindings/map.h" |
23 #include "mojo/public/cpp/bindings/message_filter.h" | 29 #include "mojo/public/cpp/bindings/message_filter.h" |
24 #include "mojo/public/cpp/bindings/no_interface.h" | 30 #include "mojo/public/cpp/bindings/no_interface.h" |
25 #include "mojo/public/cpp/bindings/string.h" | 31 #include "mojo/public/cpp/bindings/string.h" |
26 #include "mojo/public/cpp/bindings/struct_ptr.h" | 32 #include "mojo/public/cpp/bindings/struct_ptr.h" |
27 #include "{{module.path}}-internal.h" | 33 #include "{{variant_path}}-internal.h" |
28 {%- for import in imports %} | 34 {%- for import in imports %} |
29 #include "{{import.module.path}}.h" | 35 #include "{{import.module.path}}.h" |
30 {%- endfor %} | 36 {%- endfor %} |
31 | 37 |
32 {%- for namespace in namespaces_as_array %} | 38 {%- for namespace in namespaces_as_array %} |
33 namespace {{namespace}} { | 39 namespace {{namespace}} { |
34 {%- endfor %} | 40 {%- endfor %} |
| 41 {%- if variant %} |
| 42 namespace {{variant}} { |
| 43 {%- endif %} |
35 | 44 |
36 {#--- Enums #} | 45 {#--- Enums #} |
37 {% from "enum_macros.tmpl" import enum_decl -%} | 46 {% from "enum_macros.tmpl" import enum_decl -%} |
38 {% for enum in enums %} | 47 {% for enum in enums %} |
39 {{enum_decl(enum)}} | 48 {{enum_decl(enum)}} |
40 {%- endfor %} | 49 {%- endfor %} |
41 | 50 |
42 {#--- Constants #} | 51 {#--- Constants #} |
43 {%- for constant in module.constants %} | 52 {%- for constant in module.constants %} |
44 {#- To be consistent with constants defined inside interfaces, only make | 53 {#- To be consistent with constants defined inside interfaces, only make |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 {%- endfor %} | 141 {%- endfor %} |
133 {%- endif %} | 142 {%- endif %} |
134 | 143 |
135 {#--- Union Serialization Helpers -#} | 144 {#--- Union Serialization Helpers -#} |
136 {% if unions %} | 145 {% if unions %} |
137 {% for union in unions %} | 146 {% for union in unions %} |
138 {% include "union_serialization_declaration.tmpl" %} | 147 {% include "union_serialization_declaration.tmpl" %} |
139 {%- endfor %} | 148 {%- endfor %} |
140 {%- endif %} | 149 {%- endif %} |
141 | 150 |
| 151 {%- if variant %} |
| 152 } // namespace {{variant}} |
| 153 {%- endif %} |
142 {%- for namespace in namespaces_as_array|reverse %} | 154 {%- for namespace in namespaces_as_array|reverse %} |
143 } // namespace {{namespace}} | 155 } // namespace {{namespace}} |
144 {%- endfor %} | 156 {%- endfor %} |
145 | 157 |
146 #endif // {{header_guard}} | 158 #endif // {{header_guard}} |
OLD | NEW |