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

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

Issue 1127843002: Interfaces declared first in header file. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « mojo/public/interfaces/bindings/tests/test_structs.mojom ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 {#--- Union Forward Declarations -#} 64 {#--- Union Forward Declarations -#}
65 {% for union in unions %} 65 {% for union in unions %}
66 class {{union.name}}; 66 class {{union.name}};
67 {% if union|should_inline_union %} 67 {% if union|should_inline_union %}
68 typedef mojo::InlinedStructPtr<{{union.name}}> {{union.name}}Ptr; 68 typedef mojo::InlinedStructPtr<{{union.name}}> {{union.name}}Ptr;
69 {% else %} 69 {% else %}
70 typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr; 70 typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr;
71 {% endif %} 71 {% endif %}
72 {%- endfor %} 72 {%- endfor %}
73 73
74 {#--- Unions must be declared first because they can be members of structs #}
75 {#--- Unions #}
76 {% for union in unions %}
77 {% include "wrapper_union_class_declaration.tmpl" %}
78 {%- endfor %}
79
80 {#--- NOTE: Non-inlined structs may have pointers to inlined structs, so we #}
81 {#--- need to fully define inlined structs ahead of the others. #}
82
83 {#--- Inlined structs #}
84 {% for struct in structs %}
85 {% if struct|should_inline %}
86 {% include "wrapper_class_declaration.tmpl" %}
87 {% endif %}
88 {%- endfor %}
89
90 {#--- Non-inlined structs #}
91 {% for struct in structs %}
92 {% if not struct|should_inline %}
93 {% include "wrapper_class_declaration.tmpl" %}
94 {% endif %}
95 {%- endfor %}
96
97 {#--- Interfaces -#} 74 {#--- Interfaces -#}
98 {% for interface in interfaces %} 75 {% for interface in interfaces %}
99 {% include "interface_declaration.tmpl" %} 76 {% include "interface_declaration.tmpl" %}
100 {%- endfor %} 77 {%- endfor %}
101 78
102 {#--- Interface Proxies -#} 79 {#--- Interface Proxies -#}
103 {% for interface in interfaces %} 80 {% for interface in interfaces %}
104 {% include "interface_proxy_declaration.tmpl" %} 81 {% include "interface_proxy_declaration.tmpl" %}
105 {%- endfor %} 82 {%- endfor %}
106 83
107 {#--- Interface Stubs -#} 84 {#--- Interface Stubs -#}
108 {% for interface in interfaces %} 85 {% for interface in interfaces %}
109 {% include "interface_stub_declaration.tmpl" %} 86 {% include "interface_stub_declaration.tmpl" %}
110 {%- endfor %} 87 {%- endfor %}
111 88
112 {#--- Interface Request Validators -#} 89 {#--- Interface Request Validators -#}
113 {% for interface in interfaces %} 90 {% for interface in interfaces %}
114 {% include "interface_request_validator_declaration.tmpl" %} 91 {% include "interface_request_validator_declaration.tmpl" %}
115 {%- endfor %} 92 {%- endfor %}
116 93
117 {#--- Interface Response Validators -#} 94 {#--- Interface Response Validators -#}
118 {% for interface in interfaces if interface|has_callbacks %} 95 {% for interface in interfaces if interface|has_callbacks %}
119 {% include "interface_response_validator_declaration.tmpl" %} 96 {% include "interface_response_validator_declaration.tmpl" %}
120 {%- endfor %} 97 {%- endfor %}
121 98
99 {#--- Unions must be declared first because they can be members of structs #}
100 {#--- Unions #}
101 {% for union in unions %}
102 {% include "wrapper_union_class_declaration.tmpl" %}
103 {%- endfor %}
104
105 {#--- NOTE: Non-inlined structs may have pointers to inlined structs, so we #}
106 {#--- need to fully define inlined structs ahead of the others. #}
107
108 {#--- Inlined structs #}
109 {% for struct in structs %}
110 {% if struct|should_inline %}
111 {% include "wrapper_class_declaration.tmpl" %}
112 {% endif %}
113 {%- endfor %}
114
115 {#--- Non-inlined structs #}
116 {% for struct in structs %}
117 {% if not struct|should_inline %}
118 {% include "wrapper_class_declaration.tmpl" %}
119 {% endif %}
120 {%- endfor %}
121
122 {#--- Struct Serialization Helpers -#} 122 {#--- Struct Serialization Helpers -#}
123 {% if structs %} 123 {% if structs %}
124 {% for struct in structs %} 124 {% for struct in structs %}
125 {% include "struct_serialization_declaration.tmpl" %} 125 {% include "struct_serialization_declaration.tmpl" %}
126 {%- endfor %} 126 {%- endfor %}
127 {%- endif %} 127 {%- endif %}
128 128
129 {#--- Union Serialization Helpers -#} 129 {#--- Union Serialization Helpers -#}
130 {% if unions %} 130 {% if unions %}
131 {% for union in unions %} 131 {% for union in unions %}
132 {% include "union_serialization_declaration.tmpl" %} 132 {% include "union_serialization_declaration.tmpl" %}
133 {%- endfor %} 133 {%- endfor %}
134 {%- endif %} 134 {%- endif %}
135 135
136 {%- for namespace in namespaces_as_array|reverse %} 136 {%- for namespace in namespaces_as_array|reverse %}
137 } // namespace {{namespace}} 137 } // namespace {{namespace}}
138 {%- endfor %} 138 {%- endfor %}
139 139
140 #endif // {{header_guard}} 140 #endif // {{header_guard}}
OLDNEW
« no previous file with comments | « mojo/public/interfaces/bindings/tests/test_structs.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698