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

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

Issue 649633003: Add Equals() to mojom structs and related types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reorder Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1ba72350e72fc5549c0670749c14688da1a7b9fc..cb5a5fac5bf008316a3ae5e220ddc1ca810d7800 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
@@ -13,6 +13,7 @@
{{struct.name}}::~{{struct.name}}() {
}
+
{% if struct|is_cloneable_kind %}
{{struct.name}}Ptr {{struct.name}}::Clone() const {
{{struct.name}}Ptr rv(New());
@@ -26,3 +27,11 @@
return rv.Pass();
}
{% endif %}
+
+bool {{struct.name}}::Equals(const {{struct.name}}& other) const {
+{%- for field in struct.fields %}
+ if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals({{field.name}}, other.{{field.name}}))
+ return false;
+{%- endfor %}
+ return true;
+}
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698