| 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 -%} | 5 {%- if variant -%} |
| 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} | 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} |
| 7 {%- else -%} | 7 {%- else -%} |
| 8 {%- set variant_path = module.path -%} | 8 {%- set variant_path = module.path -%} |
| 9 {%- endif -%} | 9 {%- endif -%} |
| 10 | 10 |
| 11 {%- set header_guard = "%s_H_"|format( | 11 {%- set header_guard = "%s_H_"|format( |
| 12 variant_path|upper|replace("/","_")|replace(".","_")| | 12 variant_path|upper|replace("/","_")|replace(".","_")| |
| 13 replace("-", "_")) %} | 13 replace("-", "_")) %} |
| 14 | 14 |
| 15 #ifndef {{header_guard}} | 15 #ifndef {{header_guard}} |
| 16 #define {{header_guard}} | 16 #define {{header_guard}} |
| 17 | 17 |
| 18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 #include <ostream> |
| 19 | 20 |
| 20 #include "mojo/public/cpp/bindings/array.h" | 21 #include "mojo/public/cpp/bindings/array.h" |
| 21 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 22 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| 22 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 23 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
| 23 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 24 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
| 24 #include "mojo/public/cpp/bindings/callback.h" | 25 #include "mojo/public/cpp/bindings/callback.h" |
| 25 #include "mojo/public/cpp/bindings/interface_ptr.h" | 26 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| 26 #include "mojo/public/cpp/bindings/interface_request.h" | 27 #include "mojo/public/cpp/bindings/interface_request.h" |
| 27 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" | 28 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| 28 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" | 29 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 42 | 43 |
| 43 {%- for namespace in namespaces_as_array %} | 44 {%- for namespace in namespaces_as_array %} |
| 44 namespace {{namespace}} { | 45 namespace {{namespace}} { |
| 45 {%- endfor %} | 46 {%- endfor %} |
| 46 {%- if variant %} | 47 {%- if variant %} |
| 47 namespace {{variant}} { | 48 namespace {{variant}} { |
| 48 {%- endif %} | 49 {%- endif %} |
| 49 | 50 |
| 50 {#--- Enums #} | 51 {#--- Enums #} |
| 51 {% from "enum_macros.tmpl" import enum_decl -%} | 52 {% from "enum_macros.tmpl" import enum_decl -%} |
| 53 {% from "enum_macros.tmpl" import enum_stream_operator -%} |
| 52 {% for enum in enums %} | 54 {% for enum in enums %} |
| 53 {{enum_decl(enum)}} | 55 {{enum_decl(enum)}} |
| 56 {{enum_stream_operator(enum)}} |
| 54 {%- endfor %} | 57 {%- endfor %} |
| 55 | 58 |
| 56 {#--- Constants #} | 59 {#--- Constants #} |
| 57 {%- for constant in module.constants %} | 60 {%- for constant in module.constants %} |
| 58 {#- To be consistent with constants defined inside interfaces, only make | 61 {#- To be consistent with constants defined inside interfaces, only make |
| 59 integral types compile-time constants. #} | 62 integral types compile-time constants. #} |
| 60 {%- if constant.kind|is_integral_kind %} | 63 {%- if constant.kind|is_integral_kind %} |
| 61 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val
ue}}; | 64 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val
ue}}; |
| 62 {%- else %} | 65 {%- else %} |
| 63 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; | 66 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 {%- endfor %} | 154 {%- endfor %} |
| 152 {%- endif %} | 155 {%- endif %} |
| 153 | 156 |
| 154 {#--- Union Serialization Helpers -#} | 157 {#--- Union Serialization Helpers -#} |
| 155 {% if unions %} | 158 {% if unions %} |
| 156 {% for union in unions %} | 159 {% for union in unions %} |
| 157 {% include "union_serialization_declaration.tmpl" %} | 160 {% include "union_serialization_declaration.tmpl" %} |
| 158 {%- endfor %} | 161 {%- endfor %} |
| 159 {%- endif %} | 162 {%- endif %} |
| 160 | 163 |
| 164 {% for struct in structs %} |
| 165 {% for enum in struct.enums %} |
| 166 {{enum_stream_operator(enum)}} |
| 167 {%- endfor %} |
| 168 {%- endfor %} |
| 169 |
| 170 {% for interface in interfaces %} |
| 171 {% for enum in interface.enums %} |
| 172 {{enum_stream_operator(enum)}} |
| 173 {%- endfor %} |
| 174 {%- endfor %} |
| 175 |
| 161 {%- if variant %} | 176 {%- if variant %} |
| 162 } // namespace {{variant}} | 177 } // namespace {{variant}} |
| 163 {%- endif %} | 178 {%- endif %} |
| 164 {%- for namespace in namespaces_as_array|reverse %} | 179 {%- for namespace in namespaces_as_array|reverse %} |
| 165 } // namespace {{namespace}} | 180 } // namespace {{namespace}} |
| 166 {%- endfor %} | 181 {%- endfor %} |
| 167 | 182 |
| 168 #endif // {{header_guard}} | 183 #endif // {{header_guard}} |
| OLD | NEW |