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

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl

Issue 844433003: Revert "Generate some of the C++ bindings for mojom tagged unions." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 {%- set class_name = union.name ~ "_Data" -%}
2 {%- set enum_name = union.name ~ "_Tag" -%}
3 {%- set union_name = union.name ~ "_Union" -%}
4
5 class {{class_name}} {
6 public:
7 static {{class_name}}* New(mojo::internal::Buffer* buf);
8
9 static bool Validate(const void* data,
10 mojo::internal::BoundsChecker* bounds_checker);
11
12 enum class {{enum_name}} : uint64_t {
13 {% for field in union.fields %}
14 {{field.name|upper}},
15 {%- endfor %}
16 };
17
18 union MOJO_ALIGNAS(8) {{union_name}} {
19 {% for field in union.fields %}
20 {{field.kind|cpp_field_type}} {{field.name}};
21 {%- endfor %}
22 };
23
24 {{enum_name}} tag;
25 {{union_name}} data;
26
27 void EncodePointersAndHandles(std::vector<mojo::Handle>* handles);
28 void DecodePointersAndHandles(std::vector<mojo::Handle>* handles);
29
30 private:
31 {{class_name}}();
32 ~{{class_name}}() = delete;
33 };
34 static_assert(sizeof({{class_name}}) == 16,
35 "Bad sizeof({{class_name}})");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698