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 -%} | |
6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} | |
7 {%- else -%} | |
8 {%- set variant_path = module.path -%} | |
9 {%- endif -%} | |
10 | |
5 {%- set header_guard = "%s_INTERNAL_H_"| | 11 {%- set header_guard = "%s_INTERNAL_H_"| |
6 format(module.path|upper|replace("/","_")|replace(".","_")) %} | 12 format(variant_path|upper| |
13 replace("/","_")|replace(".","_")|replace("-", "_")) %} | |
yzshen1
2015/12/15 23:02:53
nit: the indent is a little unusual.
(And also in
| |
7 | 14 |
8 #ifndef {{header_guard}} | 15 #ifndef {{header_guard}} |
9 #define {{header_guard}} | 16 #define {{header_guard}} |
10 | 17 |
11 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 18 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
12 #include "mojo/public/cpp/bindings/lib/buffer.h" | 19 #include "mojo/public/cpp/bindings/lib/buffer.h" |
13 #include "mojo/public/cpp/bindings/lib/union_accessor.h" | 20 #include "mojo/public/cpp/bindings/lib/union_accessor.h" |
14 #include "mojo/public/cpp/bindings/lib/value_traits.h" | 21 #include "mojo/public/cpp/bindings/lib/value_traits.h" |
15 #include "mojo/public/cpp/bindings/struct_ptr.h" | 22 #include "mojo/public/cpp/bindings/struct_ptr.h" |
16 | 23 |
17 {%- for import in imports %} | 24 {%- for import in imports %} |
18 #include "{{import.module.path}}-internal.h" | 25 #include "{{import.module.path}}-internal.h" |
19 {%- endfor %} | 26 {%- endfor %} |
20 | 27 |
21 namespace mojo { | 28 namespace mojo { |
22 namespace internal { | 29 namespace internal { |
23 class BoundsChecker; | 30 class BoundsChecker; |
24 } | 31 } |
25 } | 32 } |
26 | 33 |
27 {%- for namespace in namespaces_as_array %} | 34 {%- for namespace in namespaces_as_array %} |
28 namespace {{namespace}} { | 35 namespace {{namespace}} { |
29 {%- endfor %} | 36 {%- endfor %} |
37 {%- if variant %} | |
38 namespace {{variant}} { | |
39 {%- endif %} | |
30 | 40 |
31 {#--- Wrapper forward declarations #} | 41 {#--- Wrapper forward declarations #} |
32 {% for struct in structs %} | 42 {% for struct in structs %} |
33 class {{struct.name}}; | 43 class {{struct.name}}; |
34 {%- endfor %} | 44 {%- endfor %} |
35 | 45 |
36 {#--- Wrapper forward declarations for unions #} | 46 {#--- Wrapper forward declarations for unions #} |
37 {% for union in unions %} | 47 {% for union in unions %} |
38 class {{union.name}}; | 48 class {{union.name}}; |
39 {%- endfor %} | 49 {%- endfor %} |
(...skipping 18 matching lines...) Expand all Loading... | |
58 {%- endfor %} | 68 {%- endfor %} |
59 | 69 |
60 {#--- Class declarations #} | 70 {#--- Class declarations #} |
61 {% for struct in structs %} | 71 {% for struct in structs %} |
62 {% include "struct_declaration.tmpl" %} | 72 {% include "struct_declaration.tmpl" %} |
63 {%- endfor %} | 73 {%- endfor %} |
64 | 74 |
65 #pragma pack(pop) | 75 #pragma pack(pop) |
66 | 76 |
67 } // namespace internal | 77 } // namespace internal |
78 {%- if variant %} | |
79 } // namespace {{variant}} | |
80 {%- endif %} | |
68 {%- for namespace in namespaces_as_array|reverse %} | 81 {%- for namespace in namespaces_as_array|reverse %} |
69 } // namespace {{namespace}} | 82 } // namespace {{namespace}} |
70 {%- endfor %} | 83 {%- endfor %} |
71 | 84 |
72 #endif // {{header_guard}} | 85 #endif // {{header_guard}} |
OLD | NEW |