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

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

Issue 1635613002: [mojo-bindings] Support reuse of native enum classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove now-unnecessary enum casts Created 4 years, 11 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/enum_macros.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
index d11b198bc658d7623e77a8611659a98d8a118e92..ea95ba37186160d6e896aacfc09b322ade191d22 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
@@ -4,6 +4,9 @@
which case associated functions need to be static.
---#}
{%- macro enum_decl(enum, is_static=false) %}
+{%- if enum.native_only %}
+using {{enum.name}} = {{enum|cpp_wrapper_type}};
+{%- else %}
enum class {{enum.name}} : int32_t {
{%- for field in enum.fields %}
{%- if field.value %}
@@ -14,6 +17,7 @@ enum class {{enum.name}} : int32_t {
{%- endfor %}
};
{{is_valid_enum_decl(enum, is_static)}}
+{% endif %}
{%- endmacro %}
{#--- macros for the declaration & definitions of enum-associated functions.

Powered by Google App Engine
This is Rietveld 408576698