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 {%- set header_guard = "%s_H_"| | 5 {%- set header_guard = "%s_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 |
11 #include "mojo/public/cpp/bindings/array.h" | 11 #include "mojo/public/cpp/bindings/array.h" |
12 #include "mojo/public/cpp/bindings/callback.h" | 12 #include "mojo/public/cpp/bindings/callback.h" |
13 #include "mojo/public/cpp/bindings/interface_impl.h" | 13 #include "mojo/public/cpp/bindings/interface_impl.h" |
14 #include "mojo/public/cpp/bindings/interface_ptr.h" | 14 #include "mojo/public/cpp/bindings/interface_ptr.h" |
15 #include "mojo/public/cpp/bindings/message_filter.h" | 15 #include "mojo/public/cpp/bindings/message_filter.h" |
16 #include "mojo/public/cpp/bindings/no_interface.h" | 16 #include "mojo/public/cpp/bindings/no_interface.h" |
17 #include "mojo/public/cpp/bindings/string.h" | |
18 #include "mojo/public/cpp/bindings/struct_ptr.h" | |
17 #include "{{module.path}}-internal.h" | 19 #include "{{module.path}}-internal.h" |
18 {%- for import in imports %} | 20 {%- for import in imports %} |
19 #include "{{import.module.path}}.h" | 21 #include "{{import.module.path}}.h" |
20 {%- endfor %} | 22 {%- endfor %} |
21 | 23 |
22 {%- for namespace in namespaces_as_array %} | 24 {%- for namespace in namespaces_as_array %} |
23 namespace {{namespace}} { | 25 namespace {{namespace}} { |
24 {%- endfor %} | 26 {%- endfor %} |
25 | 27 |
26 {#--- Constants #} | 28 {#--- Constants #} |
27 {% for constant in module.constants %} | 29 {% for constant in module.constants %} |
28 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; | 30 extern const {{constant.kind|cpp_pod_type}} {{constant.name}}; |
29 {%- endfor %} | 31 {%- endfor %} |
30 | 32 |
31 {#--- Enums #} | 33 {#--- Enums #} |
32 {% for enum in enums %} | 34 {% for enum in enums %} |
33 {% include "enum_declaration.tmpl" %} | 35 {% include "enum_declaration.tmpl" %} |
34 {%- endfor %} | 36 {%- endfor %} |
35 | 37 |
36 {#--- Interface Forward Declarations -#} | 38 {#--- Interface Forward Declarations -#} |
37 {% for interface in interfaces %} | 39 {% for interface in interfaces %} |
38 class {{interface.name}}; | 40 class {{interface.name}}; |
39 typedef mojo::InterfacePtr<{{interface.name}}> {{interface.name}}Ptr; | 41 typedef mojo::InterfacePtr<{{interface.name}}> {{interface.name}}Ptr; |
40 {% endfor %} | 42 {% endfor %} |
41 | 43 |
44 {#--- Struct Forward Declarations -#} | |
45 {% for struct in structs %} | |
46 class {{struct.name}}; | |
47 {% if struct|should_inline %} | |
48 typedef mojo::InlinedStructPtr<{{struct.name}}> {{struct.name}}Ptr; | |
yzshen1
2014/05/22 17:13:53
It seems users always create/use FooPtr instead of
| |
49 {% include "wrapper_class_declaration.tmpl" %} | |
50 {% else %} | |
51 typedef mojo::StructPtr<{{struct.name}}> {{struct.name}}Ptr; | |
52 {% endif %} | |
53 {% endfor %} | |
54 | |
42 {#--- Structs #} | 55 {#--- Structs #} |
43 {% for struct in structs %} | 56 {% for struct in structs %} |
44 {% include "wrapper_class_declaration.tmpl" %} | 57 {% if not struct|should_inline %} |
58 {% include "wrapper_class_declaration.tmpl" %} | |
59 {% endif %} | |
45 {%- endfor %} | 60 {%- endfor %} |
46 | 61 |
47 {#--- Interfaces -#} | 62 {#--- Interfaces -#} |
48 {% for interface in interfaces %} | 63 {% for interface in interfaces %} |
49 {% include "interface_declaration.tmpl" %} | 64 {% include "interface_declaration.tmpl" %} |
50 {%- endfor %} | 65 {%- endfor %} |
51 | 66 |
52 {#--- Interface Proxies -#} | 67 {#--- Interface Proxies -#} |
53 {% for interface in interfaces %} | 68 {% for interface in interfaces %} |
54 {% include "interface_proxy_declaration.tmpl" %} | 69 {% include "interface_proxy_declaration.tmpl" %} |
55 {%- endfor %} | 70 {%- endfor %} |
56 | 71 |
57 {#--- Interface Stubs -#} | 72 {#--- Interface Stubs -#} |
58 {% for interface in interfaces %} | 73 {% for interface in interfaces %} |
59 {% include "interface_stub_declaration.tmpl" %} | 74 {% include "interface_stub_declaration.tmpl" %} |
60 {%- endfor %} | 75 {%- endfor %} |
61 | 76 |
62 {#--- Interface Request Validators -#} | 77 {#--- Interface Request Validators -#} |
63 {% for interface in interfaces %} | 78 {% for interface in interfaces %} |
64 {% include "interface_request_validator_declaration.tmpl" %} | 79 {% include "interface_request_validator_declaration.tmpl" %} |
65 {%- endfor %} | 80 {%- endfor %} |
66 | 81 |
67 {#--- Interface Response Validators -#} | 82 {#--- Interface Response Validators -#} |
68 {% for interface in interfaces if interface|has_callbacks %} | 83 {% for interface in interfaces if interface|has_callbacks %} |
69 {% include "interface_response_validator_declaration.tmpl" %} | 84 {% include "interface_response_validator_declaration.tmpl" %} |
70 {%- endfor %} | 85 {%- endfor %} |
71 | 86 |
87 {#--- Struct Serialization Helpers -#} | |
88 {% if structs %} | |
89 {% for struct in structs %} | |
90 {% include "struct_serialization_declaration.tmpl" %} | |
91 {%- endfor %} | |
92 {%- endif %} | |
93 | |
72 {%- for namespace in namespaces_as_array|reverse %} | 94 {%- for namespace in namespaces_as_array|reverse %} |
73 } // namespace {{namespace}} | 95 } // namespace {{namespace}} |
74 {%- endfor %} | 96 {%- endfor %} |
75 | 97 |
76 {#--- Enum TypeTraits Specializations #} | 98 {#--- Enum TypeTraits Specializations #} |
77 {% if enums %} | |
78 namespace mojo { | 99 namespace mojo { |
79 namespace internal { | 100 namespace internal { |
101 {% if enums %} | |
80 {% for enum in enums %} | 102 {% for enum in enums %} |
81 {% include "enum_traits.tmpl" %} | 103 {% include "enum_traits.tmpl" %} |
82 {%- endfor %} | 104 {%- endfor %} |
105 {%- endif %} | |
83 } // namespace internal | 106 } // namespace internal |
84 } // namespace mojo | 107 } // namespace mojo |
85 {%- endif %} | |
86 | 108 |
87 #endif // {{header_guard}} | 109 #endif // {{header_guard}} |
OLD | NEW |