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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 {%- for namespace in namespaces_as_array %} | 44 {%- for namespace in namespaces_as_array %} |
45 namespace {{namespace}} { | 45 namespace {{namespace}} { |
46 {%- endfor %} | 46 {%- endfor %} |
47 {%- if variant %} | 47 {%- if variant %} |
48 namespace {{variant}} { | 48 namespace {{variant}} { |
49 {%- endif %} | 49 {%- endif %} |
50 | 50 |
51 {#--- Enums #} | 51 {#--- Enums #} |
52 {% from "enum_macros.tmpl" import enum_decl -%} | 52 {% from "enum_macros.tmpl" import enum_decl -%} |
53 {% from "enum_macros.tmpl" import enum_stream_operator -%} | 53 {% from "enum_macros.tmpl" import enum_stream_operator -%} |
54 {% for enum in enums %} | 54 {% from "enum_macros.tmpl" import is_known_enum_value -%} |
| 55 {%- for enum in enums %} |
55 {{enum_decl(enum)}} | 56 {{enum_decl(enum)}} |
56 {{enum_stream_operator(enum)}} | 57 {{enum_stream_operator(enum)}} |
| 58 {{is_known_enum_value(enum)}} |
57 {%- endfor %} | 59 {%- endfor %} |
58 | 60 |
59 {#--- Constants #} | 61 {#--- Constants #} |
60 {%- for constant in module.constants %} | 62 {%- for constant in module.constants %} |
61 {#- To be consistent with constants defined inside interfaces, only make | 63 {#- To be consistent with constants defined inside interfaces, only make |
62 integral types compile-time constants. #} | 64 integral types compile-time constants. #} |
63 {%- if constant.kind|is_integral_kind %} | 65 {%- if constant.kind|is_integral_kind %} |
64 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val
ue}}; | 66 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_val
ue}}; |
65 {%- else %} | 67 {%- else %} |
66 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; | 68 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 {%- endfor %} | 156 {%- endfor %} |
155 {%- endif %} | 157 {%- endif %} |
156 | 158 |
157 {#--- Union Serialization Helpers -#} | 159 {#--- Union Serialization Helpers -#} |
158 {% if unions %} | 160 {% if unions %} |
159 {% for union in unions %} | 161 {% for union in unions %} |
160 {% include "union_serialization_declaration.tmpl" %} | 162 {% include "union_serialization_declaration.tmpl" %} |
161 {%- endfor %} | 163 {%- endfor %} |
162 {%- endif %} | 164 {%- endif %} |
163 | 165 |
164 {% for struct in structs %} | 166 {%- for struct in structs %} |
165 {% for enum in struct.enums %} | 167 {%- for enum in struct.enums %} |
166 {{enum_stream_operator(enum)}} | 168 {{enum_stream_operator(enum)}} |
| 169 {{is_known_enum_value(enum)}} |
167 {%- endfor %} | 170 {%- endfor %} |
168 {%- endfor %} | 171 {%- endfor %} |
169 | 172 |
170 {% for interface in interfaces %} | 173 {%- for interface in interfaces %} |
171 {% for enum in interface.enums %} | 174 {%- for enum in interface.enums %} |
172 {{enum_stream_operator(enum)}} | 175 {{enum_stream_operator(enum)}} |
| 176 {{is_known_enum_value(enum)}} |
173 {%- endfor %} | 177 {%- endfor %} |
174 {%- endfor %} | 178 {%- endfor %} |
175 | 179 |
176 {%- if variant %} | 180 {%- if variant %} |
177 } // namespace {{variant}} | 181 } // namespace {{variant}} |
178 {%- endif %} | 182 {%- endif %} |
179 {%- for namespace in namespaces_as_array|reverse %} | 183 {%- for namespace in namespaces_as_array|reverse %} |
180 } // namespace {{namespace}} | 184 } // namespace {{namespace}} |
181 {%- endfor %} | 185 {%- endfor %} |
182 | 186 |
183 #endif // {{header_guard}} | 187 #endif // {{header_guard}} |
OLD | NEW |