| 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 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 {#--- Union Forward Declarations -#} | 56 {#--- Union Forward Declarations -#} |
| 57 {% for union in unions %} | 57 {% for union in unions %} |
| 58 class {{union.name}}; | 58 class {{union.name}}; |
| 59 {% if union|should_inline_union %} | 59 {% if union|should_inline_union %} |
| 60 typedef mojo::InlinedStructPtr<{{union.name}}> {{union.name}}Ptr; | 60 typedef mojo::InlinedStructPtr<{{union.name}}> {{union.name}}Ptr; |
| 61 {% else %} | 61 {% else %} |
| 62 typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr; | 62 typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr; |
| 63 {% endif %} | 63 {% endif %} |
| 64 {%- endfor %} | 64 {%- endfor %} |
| 65 | 65 |
| 66 {#--- Unions must be declared first because they can be members of structs #} |
| 67 {#--- Unions #} |
| 68 {% for union in unions %} |
| 69 {% include "wrapper_union_class_declaration.tmpl" %} |
| 70 {%- endfor %} |
| 71 |
| 66 {#--- NOTE: Non-inlined structs may have pointers to inlined structs, so we #} | 72 {#--- NOTE: Non-inlined structs may have pointers to inlined structs, so we #} |
| 67 {#--- need to fully define inlined structs ahead of the others. #} | 73 {#--- need to fully define inlined structs ahead of the others. #} |
| 68 | 74 |
| 69 {#--- Inlined structs #} | 75 {#--- Inlined structs #} |
| 70 {% for struct in structs %} | 76 {% for struct in structs %} |
| 71 {% if struct|should_inline %} | 77 {% if struct|should_inline %} |
| 72 {% include "wrapper_class_declaration.tmpl" %} | 78 {% include "wrapper_class_declaration.tmpl" %} |
| 73 {% endif %} | 79 {% endif %} |
| 74 {%- endfor %} | 80 {%- endfor %} |
| 75 | 81 |
| 76 {#--- Non-inlined structs #} | 82 {#--- Non-inlined structs #} |
| 77 {% for struct in structs %} | 83 {% for struct in structs %} |
| 78 {% if not struct|should_inline %} | 84 {% if not struct|should_inline %} |
| 79 {% include "wrapper_class_declaration.tmpl" %} | 85 {% include "wrapper_class_declaration.tmpl" %} |
| 80 {% endif %} | 86 {% endif %} |
| 81 {%- endfor %} | 87 {%- endfor %} |
| 82 | 88 |
| 83 {#--- Unions #} | |
| 84 {% for union in unions %} | |
| 85 {% include "wrapper_union_class_declaration.tmpl" %} | |
| 86 {%- endfor %} | |
| 87 | |
| 88 {#--- Interfaces -#} | 89 {#--- Interfaces -#} |
| 89 {% for interface in interfaces %} | 90 {% for interface in interfaces %} |
| 90 {% include "interface_declaration.tmpl" %} | 91 {% include "interface_declaration.tmpl" %} |
| 91 {%- endfor %} | 92 {%- endfor %} |
| 92 | 93 |
| 93 {#--- Interface Proxies -#} | 94 {#--- Interface Proxies -#} |
| 94 {% for interface in interfaces %} | 95 {% for interface in interfaces %} |
| 95 {% include "interface_proxy_declaration.tmpl" %} | 96 {% include "interface_proxy_declaration.tmpl" %} |
| 96 {%- endfor %} | 97 {%- endfor %} |
| 97 | 98 |
| 98 {#--- Interface Stubs -#} | 99 {#--- Interface Stubs -#} |
| 99 {% for interface in interfaces %} | 100 {% for interface in interfaces %} |
| 100 {% include "interface_stub_declaration.tmpl" %} | 101 {% include "interface_stub_declaration.tmpl" %} |
| 101 {%- endfor %} | 102 {%- endfor %} |
| 102 | 103 |
| 103 {#--- Interface Request Validators -#} | 104 {#--- Interface Request Validators -#} |
| 104 {% for interface in interfaces %} | 105 {% for interface in interfaces %} |
| 105 {% include "interface_request_validator_declaration.tmpl" %} | 106 {% include "interface_request_validator_declaration.tmpl" %} |
| 106 {%- endfor %} | 107 {%- endfor %} |
| 107 | 108 |
| 108 {#--- Interface Response Validators -#} | 109 {#--- Interface Response Validators -#} |
| 109 {% for interface in interfaces if interface|has_callbacks %} | 110 {% for interface in interfaces if interface|has_callbacks %} |
| 110 {% include "interface_response_validator_declaration.tmpl" %} | 111 {% include "interface_response_validator_declaration.tmpl" %} |
| 111 {%- endfor %} | 112 {%- endfor %} |
| 112 | 113 |
| 113 {%- import "serialization_macros.tmpl" as serialization_macros %} | |
| 114 {#--- Struct Serialization Helpers -#} | 114 {#--- Struct Serialization Helpers -#} |
| 115 {% if structs %} | 115 {% if structs %} |
| 116 {% for struct in structs %} | 116 {% for struct in structs %} |
| 117 {{ serialization_macros.declare_serialization(struct.name) }} | 117 {% include "struct_serialization_declaration.tmpl" %} |
| 118 {%- endfor %} | 118 {%- endfor %} |
| 119 {%- endif %} | 119 {%- endif %} |
| 120 | 120 |
| 121 {#--- Union Serialization Helpers -#} | 121 {#--- Union Serialization Helpers -#} |
| 122 {% if unions %} | 122 {% if unions %} |
| 123 {% for union in unions %} | 123 {% for union in unions %} |
| 124 {{ serialization_macros.declare_serialization(union.name) }} | 124 {% include "union_serialization_declaration.tmpl" %} |
| 125 {%- endfor %} | 125 {%- endfor %} |
| 126 {%- endif %} | 126 {%- endif %} |
| 127 | 127 |
| 128 {%- for namespace in namespaces_as_array|reverse %} | 128 {%- for namespace in namespaces_as_array|reverse %} |
| 129 } // namespace {{namespace}} | 129 } // namespace {{namespace}} |
| 130 {%- endfor %} | 130 {%- endfor %} |
| 131 | 131 |
| 132 #endif // {{header_guard}} | 132 #endif // {{header_guard}} |
| OLD | NEW |