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

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: cleanup 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
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..efefec06fa7f2128e4442048c8f323facd87e747 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}}() {
}
+
yzshen1 2014/10/14 21:47:21 (Results in two empty lines in the generated code)
{% 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 %}
yzshen1 2014/10/14 21:47:21 nit: {%- to avoid an unnecessary empty line.
Aaron Boodman 2014/10/14 22:30:13 Done.
+ if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals({{field.name}}, other.{{field.name}}))
+ return false;
+{% endfor %}
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698