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 {%- set header_guard = "%s_H_"| | 5 {%- set header_guard = "%s_H_"| |
6 format(module.path|upper|replace("/","_")|replace(".","_")) %} | 6 format(module.path|upper|replace("/","_")|replace(".","_")) %} |
7 | 7 |
8 #ifndef {{header_guard}} | 8 #ifndef {{header_guard}} |
9 #define {{header_guard}} | 9 #define {{header_guard}} |
10 | 10 |
11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 #include <type_traits> |
12 | 13 |
13 #include "mojo/public/cpp/bindings/array.h" | 14 #include "mojo/public/cpp/bindings/array.h" |
14 #include "mojo/public/cpp/bindings/callback.h" | 15 #include "mojo/public/cpp/bindings/callback.h" |
15 #include "mojo/public/cpp/bindings/interface_ptr.h" | 16 #include "mojo/public/cpp/bindings/interface_ptr.h" |
16 #include "mojo/public/cpp/bindings/interface_request.h" | 17 #include "mojo/public/cpp/bindings/interface_request.h" |
17 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" | 18 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
18 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" | 19 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
19 #include "mojo/public/cpp/bindings/map.h" | 20 #include "mojo/public/cpp/bindings/map.h" |
20 #include "mojo/public/cpp/bindings/message_filter.h" | 21 #include "mojo/public/cpp/bindings/message_filter.h" |
21 #include "mojo/public/cpp/bindings/no_interface.h" | 22 #include "mojo/public/cpp/bindings/no_interface.h" |
22 #include "mojo/public/cpp/bindings/string.h" | 23 #include "mojo/public/cpp/bindings/string.h" |
23 #include "mojo/public/cpp/bindings/struct_ptr.h" | 24 #include "mojo/public/cpp/bindings/struct_ptr.h" |
24 #include "{{module.path}}-internal.h" | 25 #include "{{module.path}}-internal.h" |
25 {%- for import in imports %} | 26 {%- for import in imports %} |
26 #include "{{import.module.path}}.h" | 27 #include "{{import.module.path}}.h" |
27 {%- endfor %} | 28 {%- endfor %} |
28 | 29 |
29 {%- for namespace in namespaces_as_array %} | 30 {%- for namespace in namespaces_as_array %} |
30 namespace {{namespace}} { | 31 namespace {{namespace}} { |
31 {%- endfor %} | 32 {%- endfor %} |
32 | 33 |
33 {#--- Enums #} | 34 {#--- Enums #} |
34 {% from "enum_macros.tmpl" import enum_decl -%} | 35 {% from "enum_macros.tmpl" import enum_decl -%} |
| 36 {% from "enum_macros.tmpl" import global_enum_operators_decl -%} |
35 {% for enum in enums %} | 37 {% for enum in enums %} |
36 {{enum_decl(enum)}} | 38 {{enum_decl(enum)}} |
| 39 {{global_enum_operators_decl(enum)}} |
37 {%- endfor %} | 40 {%- endfor %} |
38 | 41 |
39 {#--- Constants #} | 42 {#--- Constants #} |
40 {%- for constant in module.constants %} | 43 {%- for constant in module.constants %} |
41 {#- To be consistent with constants defined inside interfaces, only make | 44 {#- To be consistent with constants defined inside interfaces, only make |
42 integral types compile-time constants. #} | 45 integral types compile-time constants. #} |
43 {%- if constant.kind|is_integral_kind %} | 46 {%- if constant.kind|is_integral_kind %} |
44 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val
ue}}; | 47 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val
ue}}; |
45 {%- else %} | 48 {%- else %} |
46 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; | 49 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 {% for union in unions %} | 136 {% for union in unions %} |
134 {% include "union_serialization_declaration.tmpl" %} | 137 {% include "union_serialization_declaration.tmpl" %} |
135 {%- endfor %} | 138 {%- endfor %} |
136 {%- endif %} | 139 {%- endif %} |
137 | 140 |
138 {%- for namespace in namespaces_as_array|reverse %} | 141 {%- for namespace in namespaces_as_array|reverse %} |
139 } // namespace {{namespace}} | 142 } // namespace {{namespace}} |
140 {%- endfor %} | 143 {%- endfor %} |
141 | 144 |
142 #endif // {{header_guard}} | 145 #endif // {{header_guard}} |
OLD | NEW |