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

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

Issue 2339413004: Allow Mojo structs as map keys (Closed)
Patch Set: Address sammc's comments and improve Blink tests Created 4 years, 3 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 // static 1 // static
2 {{struct.name}}Ptr {{struct.name}}::New() { 2 {{struct.name}}Ptr {{struct.name}}::New() {
3 {{struct.name}}Ptr rv; 3 {{struct.name}}Ptr rv;
4 mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv); 4 mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv);
5 return rv; 5 return rv;
6 } 6 }
7 7
8 {{struct.name}}::{{struct.name}}() 8 {{struct.name}}::{{struct.name}}()
9 {%- for field in struct.fields %} 9 {%- for field in struct.fields %}
10 {% if loop.first %}:{% else %} {% endif %} {{field.name}}({{field|default_va lue}}){% if not loop.last %},{% endif %} 10 {% if loop.first %}:{% else %} {% endif %} {{field.name}}({{field|default_va lue}}){% if not loop.last %},{% endif %}
11 {%- endfor %} { 11 {%- endfor %} {
12 } 12 }
13 13
14 {{struct.name}}::~{{struct.name}}() { 14 {{struct.name}}::~{{struct.name}}() {
15 } 15 }
16
17 {%- if struct|is_hashable %}
18 size_t {{struct.name}}::Hash(size_t seed) const {
19 {%- for field in struct.fields %}
20 {%- if for_blink %}
21 seed = mojo::internal::WTFHash(seed, this->{{field.name}});
22 {%- else %}
23 seed = mojo::internal::Hash(seed, this->{{field.name}});
24 {%- endif %}
25 {%- endfor %}
26 return seed;
27 }
28 {%- endif %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698