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

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

Issue 2715153004: Mojo: Support enums as map keys in WTF (Closed)
Patch Set: Qualify name of generated hash fn Created 3 years, 9 months 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 {%- 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 {%- endif %} 79 {%- endif %}
80 80
81 {%- for header in extra_public_headers %} 81 {%- for header in extra_public_headers %}
82 #include "{{header}}" 82 #include "{{header}}"
83 {%- endfor %} 83 {%- endfor %}
84 84
85 {%- if export_header %} 85 {%- if export_header %}
86 #include "{{export_header}}" 86 #include "{{export_header}}"
87 {%- endif %} 87 {%- endif %}
88 88
89 {#--- WTF enum hashing #}
90 {%- from "enum_macros.tmpl" import enum_hash_blink%}
91 {%- if for_blink %}
92 {#- Top-level #}
93 {%- for enum in enums %}
yzshen1 2017/02/28 18:48:34 you could use "all_enums" for all enums at top lev
tibell 2017/03/01 23:08:39 Done.
94 {%- if not enum|is_native_only_kind %}
95 {{enum_hash_blink(enum)}}
96 {%- endif %}
97 {%- endfor %}
98 {#- Inside structs #}
99 {%- for struct in structs %}
100 {%- for enum in struct.enums %}
101 {%- if not enum|is_native_only_kind %}
102 {{enum_hash_blink(enum)}}
103 {%- endif %}
104 {%- endfor %}
105 {%- endfor %}
106 {#- Inside interfaces #}
107 {%- for iface in interfaces %}
108 {%- for enum in iface.enums %}
109 {%- if not enum|is_native_only_kind %}
110 {{enum_hash_blink(enum)}}
111 {%- endif %}
112 {%- endfor %}
113 {%- endfor %}
114 {%- endif %}
115
89 {{namespace_begin()}} 116 {{namespace_begin()}}
90 117
91 {#--- Enums #} 118 {#--- Enums #}
92 {%- if variant %} 119 {%- if variant %}
93 {%- for enum in enums %} 120 {%- for enum in enums %}
94 using {{enum.name}} = {{enum.name}}; // Alias for definition in the parent name space. 121 using {{enum.name}} = {{enum.name}}; // Alias for definition in the parent name space.
95 {%- endfor %} 122 {%- endfor %}
96 {%- endif %} 123 {%- endif %}
97 124
98 {#--- Constants #} 125 {#--- Constants #}
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 {#--- Union Serialization Helpers -#} 243 {#--- Union Serialization Helpers -#}
217 {% if unions %} 244 {% if unions %}
218 {%- for union in unions %} 245 {%- for union in unions %}
219 {% include "union_traits_declaration.tmpl" %} 246 {% include "union_traits_declaration.tmpl" %}
220 {%- endfor %} 247 {%- endfor %}
221 {%- endif %} 248 {%- endif %}
222 249
223 } // namespace mojo 250 } // namespace mojo
224 251
225 #endif // {{header_guard}} 252 #endif // {{header_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698