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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_macros.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, 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/struct_macros.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
index 25a3ee414af454bf8aef95a1374abba0078c2364..b38bd45414431cd2e4a546081acb19e00e49c1ff 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
@@ -95,6 +95,9 @@
mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
"invalid {{name}} in {{struct_display_name}}");
{%- endif %}
+{%- elif kind|is_enum_kind %}
+ {{output}}->{{name}} =
+ static_cast<int32_t>({{input_field}});
{%- else %}
{{output}}->{{name}} = {{input_field}};
{%- endif %}

Powered by Google App Engine
This is Rietveld 408576698