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

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

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows bustage Created 6 years, 6 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 | Annotate | Revision Log
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 #if defined(__clang__) 5 #if defined(__clang__)
6 #pragma clang diagnostic push 6 #pragma clang diagnostic push
7 #pragma clang diagnostic ignored "-Wunused-private-field" 7 #pragma clang diagnostic ignored "-Wunused-private-field"
8 #endif 8 #endif
9 9
10 #include "{{module.path}}.h" 10 #include "{{module.path}}.h"
11 11
12 #include "mojo/public/cpp/bindings/lib/array_serialization.h"
12 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" 13 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
14 #include "mojo/public/cpp/bindings/lib/string_serialization.h"
13 #include "mojo/public/cpp/bindings/lib/message_builder.h" 15 #include "mojo/public/cpp/bindings/lib/message_builder.h"
14 16
15 {%- for namespace in namespaces_as_array %} 17 {%- for namespace in namespaces_as_array %}
16 namespace {{namespace}} { 18 namespace {{namespace}} {
17 {%- endfor %} 19 {%- endfor %}
18 20
19 {#--- Constants #} 21 {#--- Constants #}
20 {% for constant in module.constants %} 22 {% for constant in module.constants %}
21 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant.value|expres sion_to_text(module)}}; 23 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant.value|expres sion_to_text(module)}};
22 {%- endfor %} 24 {%- endfor %}
(...skipping 14 matching lines...) Expand all
37 {%- set struct = method|response_struct_from_method %} 39 {%- set struct = method|response_struct_from_method %}
38 {%- include "params_definition.tmpl" %} 40 {%- include "params_definition.tmpl" %}
39 {%- endif %} 41 {%- endif %}
40 {%- endfor %} 42 {%- endfor %}
41 {%- endfor %} 43 {%- endfor %}
42 44
43 #pragma pack(pop) 45 #pragma pack(pop)
44 46
45 } // namespace 47 } // namespace
46 48
47 {#--- Struct destructors #}
48 {%- for struct in structs %}
49 {%- include "struct_destructor.tmpl" %}
50 {%- endfor %}
51
52 {#--- Struct definitions #} 49 {#--- Struct definitions #}
53 {% for struct in structs %} 50 {% for struct in structs %}
54 {%- include "struct_definition.tmpl" %} 51 {%- include "struct_definition.tmpl" %}
55 {%- endfor %} 52 {%- endfor %}
56 53
57 } // namespace internal 54 } // namespace internal
58 55
59 {#--- Struct Constants #} 56 {#--- Struct Constants #}
60 {%- for struct in structs %} 57 {%- for struct in structs %}
61 {% for constant in struct.constants %} 58 {% for constant in struct.constants %}
62 const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}} = {{cons tant.value|expression_to_text(module)}}; 59 const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}} = {{cons tant.value|expression_to_text(module)}};
63 {%- endfor %} 60 {%- endfor %}
64 {%- endfor %} 61 {%- endfor %}
65 62
66 {#--- Struct builder definitions #} 63 {#--- Struct builder definitions #}
67 {%- for struct in structs %} 64 {%- for struct in structs %}
68 {%- include "struct_builder_definition.tmpl" %} 65 {%- include "wrapper_class_definition.tmpl" %}
69 {%- endfor %} 66 {%- endfor %}
70 67
71 {#--- Interface definitions #} 68 {#--- Interface definitions #}
72 {%- for interface in interfaces %} 69 {%- for interface in interfaces %}
73 {%- include "interface_definition.tmpl" %} 70 {%- include "interface_definition.tmpl" %}
74 {%- endfor %} 71 {%- endfor %}
72
73 {#--- Struct Serialization Helpers #}
74 {%- for struct in structs %}
75 {%- include "struct_serialization_definition.tmpl" %}
76 {%- endfor %}
77
75 {%- for namespace in namespaces_as_array|reverse %} 78 {%- for namespace in namespaces_as_array|reverse %}
76 } // namespace {{namespace}} 79 } // namespace {{namespace}}
77 {%- endfor %} 80 {%- endfor %}
78 81
79 #if defined(__clang__) 82 #if defined(__clang__)
80 #pragma clang diagnostic pop 83 #pragma clang diagnostic pop
81 #endif 84 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698