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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/module-internal.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-internal.h.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
index c59c9f75db9e1792a57606381f339581b59e6b4f..c761c253182af7d2b98ade6c76340697f70a08f3 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
@@ -63,6 +63,12 @@ class {{struct.name}}_Data;
class {{union.name}}_Data;
{%- endfor %}
+{#--- Enums #}
+{% from "enum_macros.tmpl" import enum_data_decl -%}
+{%- for enum in enums %}
+ {{enum_data_decl(enum)}}
+{%- endfor %}
+
#pragma pack(push, 1)
{#--- Unions must be declared first because they can be members of structs #}
@@ -71,11 +77,24 @@ class {{union.name}}_Data;
{% include "union_declaration.tmpl" %}
{%- endfor %}
-{#--- Class declarations #}
+{#--- Struct class declarations #}
{% for struct in structs %}
{% include "struct_declaration.tmpl" %}
{%- endfor %}
+{#--- Interface class declarations. They are needed only when they contain
+ enums. #}
+{%- for interface in interfaces %}
+{%- if interface.enums %}
+class {{interface.name}}_Data {
+ public:
+{%- for enum in interface.enums %}
+ {{enum_data_decl(enum)|indent(2)}}
+{%- endfor %}
+};
+{%- endif %}
+{%- endfor %}
+
#pragma pack(pop)
} // namespace internal

Powered by Google App Engine
This is Rietveld 408576698