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

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

Issue 884043003: Cpp bindings: add typedef for callbacks. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: use using instead of typedef in cpp templates Created 5 years, 10 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
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 22 matching lines...) Expand all
33 {%- endfor %} 33 {%- endfor %}
34 34
35 {#--- Enums #} 35 {#--- Enums #}
36 {% for enum in enums %} 36 {% for enum in enums %}
37 {% include "enum_declaration.tmpl" %} 37 {% include "enum_declaration.tmpl" %}
38 {%- endfor %} 38 {%- endfor %}
39 39
40 {#--- Interface Forward Declarations -#} 40 {#--- Interface Forward Declarations -#}
41 {% for interface in interfaces %} 41 {% for interface in interfaces %}
42 class {{interface.name}}; 42 class {{interface.name}};
43 typedef mojo::InterfacePtr<{{interface.name}}> {{interface.name}}Ptr; 43 using {{interface.name}}Ptr = mojo::InterfacePtr<{{interface.name}}>;
44 {% endfor %} 44 {% endfor %}
45 45
46 {#--- Struct Forward Declarations -#} 46 {#--- Struct Forward Declarations -#}
47 {% for struct in structs %} 47 {% for struct in structs %}
48 class {{struct.name}}; 48 class {{struct.name}};
49 {% if struct|should_inline %} 49 {% if struct|should_inline %}
50 typedef mojo::InlinedStructPtr<{{struct.name}}> {{struct.name}}Ptr; 50 using {{struct.name}}Ptr = mojo::InlinedStructPtr<{{struct.name}}>;
51 {% else %} 51 {% else %}
52 typedef mojo::StructPtr<{{struct.name}}> {{struct.name}}Ptr; 52 using {{struct.name}}Ptr = mojo::StructPtr<{{struct.name}}>;
53 {% endif %} 53 {% endif %}
54 {% endfor %} 54 {% endfor %}
55 55
56 {#--- NOTE: Non-inlined structs may have pointers to inlined structs, so we #} 56 {#--- NOTE: Non-inlined structs may have pointers to inlined structs, so we #}
57 {#--- need to fully define inlined structs ahead of the others. #} 57 {#--- need to fully define inlined structs ahead of the others. #}
58 58
59 {#--- Inlined structs #} 59 {#--- Inlined structs #}
60 {% for struct in structs %} 60 {% for struct in structs %}
61 {% if struct|should_inline %} 61 {% if struct|should_inline %}
62 {% include "wrapper_class_declaration.tmpl" %} 62 {% include "wrapper_class_declaration.tmpl" %}
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 {% for struct in structs %} 100 {% for struct in structs %}
101 {% include "struct_serialization_declaration.tmpl" %} 101 {% include "struct_serialization_declaration.tmpl" %}
102 {%- endfor %} 102 {%- endfor %}
103 {%- endif %} 103 {%- endif %}
104 104
105 {%- for namespace in namespaces_as_array|reverse %} 105 {%- for namespace in namespaces_as_array|reverse %}
106 } // namespace {{namespace}} 106 } // namespace {{namespace}}
107 {%- endfor %} 107 {%- endfor %}
108 108
109 #endif // {{header_guard}} 109 #endif // {{header_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698