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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.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/struct_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
index 255005ad3155ebe1213bd0d2bf3ea2540006fb44..8b3c4ce7acab434ad0e44b770e7a94d6f609f456 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
@@ -10,14 +10,18 @@ class {{class_name}} {
void EncodePointersAndHandles(std::vector<mojo::Handle>* handles);
void DecodePointersAndHandles(std::vector<mojo::Handle>* handles);
+{% from "enum_macros.tmpl" import enum_data_decl -%}
+{#--- Enums #}
+{%- for enum in struct.enums -%}
+ {{enum_data_decl(enum)|indent(2)}}
+{%- endfor %}
+
mojo::internal::StructHeader header_;
{%- for packed_field in struct.packed.packed_fields %}
{%- set name = packed_field.field.name %}
{%- set kind = packed_field.field.kind %}
{%- if kind.spec == 'b' %}
uint8_t {{name}} : 1;
-{%- elif kind|is_enum_kind %}
- int32_t {{name}};
{%- else %}
{{kind|cpp_field_type}} {{name}};
{%- endif %}

Powered by Google App Engine
This is Rietveld 408576698