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

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl

Issue 923033003: Implement unions as members of structs. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 {%- set header_guard = "%s_INTERNAL_H_"| 5 {%- set header_guard = "%s_INTERNAL_H_"|
6 format(module.path|upper|replace("/","_")|replace(".","_")) %} 6 format(module.path|upper|replace("/","_")|replace(".","_")) %}
7 7
8 #ifndef {{header_guard}} 8 #ifndef {{header_guard}}
9 #define {{header_guard}} 9 #define {{header_guard}}
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 {% for struct in structs %} 43 {% for struct in structs %}
44 class {{struct.name}}_Data; 44 class {{struct.name}}_Data;
45 {%- endfor %} 45 {%- endfor %}
46 46
47 {% for union in unions %} 47 {% for union in unions %}
48 class {{union.name}}_Data; 48 class {{union.name}}_Data;
49 {%- endfor %} 49 {%- endfor %}
50 50
51 #pragma pack(push, 1) 51 #pragma pack(push, 1)
52 52
53 {#--- Unions must be declared first because they can be members of structs #}
54 {#--- Union class declarations #}
55 {% for union in unions %}
56 {% include "union_declaration.tmpl" %}
57 {%- endfor %}
58
53 {#--- Class declarations #} 59 {#--- Class declarations #}
54 {% for struct in structs %} 60 {% for struct in structs %}
55 {% include "struct_declaration.tmpl" %} 61 {% include "struct_declaration.tmpl" %}
56 {%- endfor %} 62 {%- endfor %}
57 63
58 {% for union in unions %}
59 {% include "union_declaration.tmpl" %}
60 {%- endfor %}
61
62 #pragma pack(pop) 64 #pragma pack(pop)
63 65
64 } // namespace internal 66 } // namespace internal
65 {%- for namespace in namespaces_as_array|reverse %} 67 {%- for namespace in namespaces_as_array|reverse %}
66 } // namespace {{namespace}} 68 } // namespace {{namespace}}
67 {%- endfor %} 69 {%- endfor %}
68 70
69 #endif // {{header_guard}} 71 #endif // {{header_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698