• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{% for constructor in struct|struct_constructors %}
2{{struct.name}}::{{struct.name}}(
3{%-  for field in constructor.params  %}
4{%-    set type = field.kind|cpp_wrapper_param_type_new %}
5{%-    set name = field.name %}
6    {{type}} {{name}}_in
7{%-    if not loop.last -%},{%- endif %}
8{%-  endfor %})
9{%-  for field, is_parameter in constructor.fields %}
10{%-    set name = field.name %}
11    {% if loop.first %}:{% else %} {% endif %} {{name}}(
12{%-    if is_parameter -%}
13std::move({{name}}_in)
14{%-    else -%}
15{{ field|default_value }}
16{%-    endif -%}
17){%  if not loop.last %},{% endif %}
18{%-  endfor %} {}
19{% endfor %}
20{{struct.name}}::~{{struct.name}}() = default;
21
22{%- if struct|is_hashable %}
23size_t {{struct.name}}::Hash(size_t seed) const {
24{%-   for field in struct.fields %}
25{%-     if for_blink %}
26  seed = mojo::internal::WTFHash(seed, this->{{field.name}});
27{%-     else %}
28  seed = mojo::internal::Hash(seed, this->{{field.name}});
29{%-     endif %}
30{%-   endfor %}
31  return seed;
32}
33{%- endif %}
34
35bool {{struct.name}}::Validate(
36    const void* data,
37    mojo::internal::ValidationContext* validation_context) {
38  return Data_::Validate(data, validation_context);
39}
40