Index: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl |
index e6d04268520aa5f0f0a77a4c4e14839711d1c5ed..e75543f14eb3cee51949ab24509796225847e8d9 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl |
@@ -1,18 +1,23 @@ |
-// static |
-{{struct.name}}Ptr {{struct.name}}::New() { |
- {{struct.name}}Ptr rv; |
- mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv); |
- return rv; |
-} |
- |
-{{struct.name}}::{{struct.name}}() |
-{%- for field in struct.fields %} |
- {% if loop.first %}:{% else %} {% endif %} {{field.name}}({{field|default_value}}){% if not loop.last %},{% endif %} |
-{%- endfor %} { |
-} |
- |
-{{struct.name}}::~{{struct.name}}() { |
-} |
+{% for constructor in struct|struct_constructors %} |
+{{struct.name}}::{{struct.name}}( |
+{%- for field in constructor.params %} |
+{%- set type = field.kind|cpp_wrapper_param_type %} |
+{%- set name = field.name %} |
+ {{type}} {{name}}_in |
+{%- if not loop.last -%},{%- endif %} |
+{%- endfor %}) |
+{%- for field, is_parameter in constructor.fields %} |
+{%- set name = field.name %} |
+ {% if loop.first %}:{% else %} {% endif %} {{name}}( |
+{%- if is_parameter -%} |
+std::move({{name}}_in) |
+{%- else -%} |
+{{ field|default_value }} |
+{%- endif -%} |
+){% if not loop.last %},{% endif %} |
+{%- endfor %} {} |
+{% endfor %} |
+{{struct.name}}::~{{struct.name}}() = default; |
{%- if struct|is_hashable %} |
size_t {{struct.name}}::Hash(size_t seed) const { |