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

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

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/module.h.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
index 5ef35a2879dbf00bc93cede25379d1badef9ce0b..2314f6e1cae1cadf5a3a904c622e9dda0401d45a 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -51,9 +51,11 @@ namespace {{variant}} {
{#--- Enums #}
{% from "enum_macros.tmpl" import enum_decl -%}
{% from "enum_macros.tmpl" import enum_stream_operator -%}
-{% for enum in enums %}
+{% from "enum_macros.tmpl" import is_known_enum_value -%}
+{%- for enum in enums %}
{{enum_decl(enum)}}
{{enum_stream_operator(enum)}}
+ {{is_known_enum_value(enum)}}
{%- endfor %}
{#--- Constants #}
@@ -161,15 +163,17 @@ typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr;
{%- endfor %}
{%- endif %}
-{% for struct in structs %}
-{% for enum in struct.enums %}
+{%- for struct in structs %}
+{%- for enum in struct.enums %}
{{enum_stream_operator(enum)}}
+{{is_known_enum_value(enum)}}
{%- endfor %}
{%- endfor %}
-{% for interface in interfaces %}
-{% for enum in interface.enums %}
+{%- for interface in interfaces %}
+{%- for enum in interface.enums %}
{{enum_stream_operator(enum)}}
+{{is_known_enum_value(enum)}}
{%- endfor %}
{%- endfor %}

Powered by Google App Engine
This is Rietveld 408576698