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

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

Issue 1375313006: For c++, Generate enum classes instead of enum from mojom. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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/union_serialization_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl
index 53b212653eb646efc5ee95b399ae31658c29d959..d5bdcfc651923c113f00deb567fbb82d91944455 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl
@@ -78,6 +78,11 @@ void SerializeUnion_({{union.name}}* input, mojo::internal::Buffer* buf,
&result->data.f_{{field.name}});
mojo::internal::InterfacePointerToData(
input_acc.data()->{{field.name}}->Pass(), {{field.name}});
+{% elif field.kind|is_enum_kind %}
+ result->data.f_{{field.name}} =
+ static_cast<typename std::underlying_type<
viettrungluu 2015/10/01 17:49:55 "
johngro 2015/10/02 00:49:04 Done.
+ {{field.kind|cpp_wrapper_type}}>::type>(
+ input_acc.data()->{{field.name}});
{% else %}
result->data.f_{{field.name}} = input_acc.data()->{{field.name}};
{%- endif %}

Powered by Google App Engine
This is Rietveld 408576698