OLD | NEW |
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 {%- if variant -%} | 5 {%- if variant -%} |
6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} | 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} |
7 {%- else -%} | 7 {%- else -%} |
8 {%- set variant_path = module.path -%} | 8 {%- set variant_path = module.path -%} |
9 {%- endif -%} | 9 {%- endif -%} |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 {#--- Internal forward declarations #} | 57 {#--- Internal forward declarations #} |
58 {% for struct in structs %} | 58 {% for struct in structs %} |
59 class {{struct.name}}_Data; | 59 class {{struct.name}}_Data; |
60 {%- endfor %} | 60 {%- endfor %} |
61 | 61 |
62 {% for union in unions %} | 62 {% for union in unions %} |
63 class {{union.name}}_Data; | 63 class {{union.name}}_Data; |
64 {%- endfor %} | 64 {%- endfor %} |
65 | 65 |
| 66 {#--- Enums #} |
| 67 {% from "enum_macros.tmpl" import enum_data_decl -%} |
| 68 {%- for enum in enums %} |
| 69 {{enum_data_decl(enum)}} |
| 70 {%- endfor %} |
| 71 |
66 #pragma pack(push, 1) | 72 #pragma pack(push, 1) |
67 | 73 |
68 {#--- Unions must be declared first because they can be members of structs #} | 74 {#--- Unions must be declared first because they can be members of structs #} |
69 {#--- Union class declarations #} | 75 {#--- Union class declarations #} |
70 {% for union in unions %} | 76 {% for union in unions %} |
71 {% include "union_declaration.tmpl" %} | 77 {% include "union_declaration.tmpl" %} |
72 {%- endfor %} | 78 {%- endfor %} |
73 | 79 |
74 {#--- Class declarations #} | 80 {#--- Struct class declarations #} |
75 {% for struct in structs %} | 81 {% for struct in structs %} |
76 {% include "struct_declaration.tmpl" %} | 82 {% include "struct_declaration.tmpl" %} |
77 {%- endfor %} | 83 {%- endfor %} |
78 | 84 |
| 85 {#--- Interface class declarations. They are needed only when they contain |
| 86 enums. #} |
| 87 {%- for interface in interfaces %} |
| 88 {%- if interface.enums %} |
| 89 class {{interface.name}}_Data { |
| 90 public: |
| 91 {%- for enum in interface.enums %} |
| 92 {{enum_data_decl(enum)|indent(2)}} |
| 93 {%- endfor %} |
| 94 }; |
| 95 {%- endif %} |
| 96 {%- endfor %} |
| 97 |
79 #pragma pack(pop) | 98 #pragma pack(pop) |
80 | 99 |
81 } // namespace internal | 100 } // namespace internal |
82 {%- if variant %} | 101 {%- if variant %} |
83 } // namespace {{variant}} | 102 } // namespace {{variant}} |
84 {%- endif %} | 103 {%- endif %} |
85 {%- for namespace in namespaces_as_array|reverse %} | 104 {%- for namespace in namespaces_as_array|reverse %} |
86 } // namespace {{namespace}} | 105 } // namespace {{namespace}} |
87 {%- endfor %} | 106 {%- endfor %} |
88 | 107 |
89 #endif // {{header_guard}} | 108 #endif // {{header_guard}} |
OLD | NEW |