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 29bdd8eeb95162fb4a2daf8a19ebc135bbc0c1a5..42f7575939aa94ef3e726c47dcb9b64a7ea65830 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 |
@@ -6,10 +6,23 @@ |
} |
{{struct.name}}::{{struct.name}}() |
-{%-for field in struct.fields %} |
+{%- 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}}() { |
} |
+{% if struct|is_cloneable_kind %} |
+{{struct.name}}Ptr {{struct.name}}::Clone() const { |
+ {{struct.name}}Ptr rv(New()); |
+{%- for field in struct.fields %} |
+{%- if field.kind|is_struct_kind or field.kind|is_any_array_kind %} |
+ rv->{{field.name}} = {{field.name}}.Clone(); |
+{%- else %} |
+ rv->{{field.name}} = {{field.name}}; |
+{%- endif %} |
+{%- endfor %} |
+ return rv.Pass(); |
+} |
+{% endif %} |