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 #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/bindings_serialization.h" | 12 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" |
13 #include "mojo/public/cpp/bindings/lib/message_builder.h" | 13 #include "mojo/public/cpp/bindings/lib/message_builder.h" |
14 | 14 |
15 {%- for namespace in namespaces_as_array %} | 15 {%- for namespace in namespaces_as_array %} |
16 namespace {{namespace}} { | 16 namespace {{namespace}} { |
17 {%- endfor %} | 17 {%- endfor %} |
| 18 |
| 19 {#--- Constants #} |
| 20 {% for constant in module.constants %} |
| 21 const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant.value|expres
sion_to_text(module)}}; |
| 22 {%- endfor %} |
| 23 |
18 namespace internal { | 24 namespace internal { |
19 namespace { | 25 namespace { |
20 | 26 |
21 #pragma pack(push, 1) | 27 #pragma pack(push, 1) |
22 | 28 |
23 {#--- Interface parameter definitions #} | 29 {#--- Interface parameter definitions #} |
24 {%- for interface in interfaces %} | 30 {%- for interface in interfaces %} |
25 {%- for method in interface.methods %} | 31 {%- for method in interface.methods %} |
26 {%- set method_name = "k%s_%s_Name"|format(interface.name, method.name) %} | 32 {%- set method_name = "k%s_%s_Name"|format(interface.name, method.name) %} |
27 const uint32_t {{method_name}} = {{method.ordinal}}; | 33 const uint32_t {{method_name}} = {{method.ordinal}}; |
(...skipping 15 matching lines...) Expand all Loading... |
43 {%- include "struct_destructor.tmpl" %} | 49 {%- include "struct_destructor.tmpl" %} |
44 {%- endfor %} | 50 {%- endfor %} |
45 | 51 |
46 {#--- Struct definitions #} | 52 {#--- Struct definitions #} |
47 {% for struct in structs %} | 53 {% for struct in structs %} |
48 {%- include "struct_definition.tmpl" %} | 54 {%- include "struct_definition.tmpl" %} |
49 {%- endfor %} | 55 {%- endfor %} |
50 | 56 |
51 } // namespace internal | 57 } // namespace internal |
52 | 58 |
| 59 {#--- Struct Constants #} |
| 60 {%- for struct in structs %} |
| 61 {% for constant in struct.constants %} |
| 62 const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}} = {{cons
tant.value|expression_to_text(module)}}; |
| 63 {%- endfor %} |
| 64 {%- endfor %} |
| 65 |
53 {#--- Struct builder definitions #} | 66 {#--- Struct builder definitions #} |
54 {%- for struct in structs %} | 67 {%- for struct in structs %} |
55 {%- include "struct_builder_definition.tmpl" %} | 68 {%- include "struct_builder_definition.tmpl" %} |
56 {%- endfor %} | 69 {%- endfor %} |
57 | 70 |
58 {#--- Interface definitions #} | 71 {#--- Interface definitions #} |
59 {%- for interface in interfaces %} | 72 {%- for interface in interfaces %} |
60 {%- include "interface_definition.tmpl" %} | 73 {%- include "interface_definition.tmpl" %} |
61 {%- endfor %} | 74 {%- endfor %} |
62 {%- for namespace in namespaces_as_array|reverse %} | 75 {%- for namespace in namespaces_as_array|reverse %} |
63 } // namespace {{namespace}} | 76 } // namespace {{namespace}} |
64 {%- endfor %} | 77 {%- endfor %} |
65 | 78 |
66 #if defined(__clang__) | 79 #if defined(__clang__) |
67 #pragma clang diagnostic pop | 80 #pragma clang diagnostic pop |
68 #endif | 81 #endif |
OLD | NEW |