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

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

Issue 268363003: Mojo: Add support for constants to the IDL compiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: JS export constants Created 6 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 | 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 {%- 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
11 #include "mojo/public/cpp/bindings/array.h" 11 #include "mojo/public/cpp/bindings/array.h"
12 #include "mojo/public/cpp/bindings/callback.h" 12 #include "mojo/public/cpp/bindings/callback.h"
13 #include "mojo/public/cpp/bindings/interface.h" 13 #include "mojo/public/cpp/bindings/interface.h"
14 #include "{{module.path}}-internal.h" 14 #include "{{module.path}}-internal.h"
15 {%- for import in imports %} 15 {%- for import in imports %}
16 #include "{{import.module.path}}.h" 16 #include "{{import.module.path}}.h"
17 {%- endfor %} 17 {%- endfor %}
18 18
19 {%- for namespace in namespaces_as_array %} 19 {%- for namespace in namespaces_as_array %}
20 namespace {{namespace}} { 20 namespace {{namespace}} {
21 {%- endfor %} 21 {%- endfor %}
22 22
23 {#--- Constants #}
24 {% for constant in module.constants %}
25 extern const {{constant.kind|cpp_pod_type}} {{constant.name}};
26 {%- endfor %}
27
23 {#--- Enums #} 28 {#--- Enums #}
24 {% for enum in enums %} 29 {% for enum in enums %}
25 {% include "enum_declaration.tmpl" %} 30 {% include "enum_declaration.tmpl" %}
26 {%- endfor %} 31 {%- endfor %}
27 32
28 {#--- Interface Forward Declarations -#} 33 {#--- Interface Forward Declarations -#}
29 {% for interface in interfaces %} 34 {% for interface in interfaces %}
30 class {{interface.name}}; 35 class {{interface.name}};
31 // A typesafe variant of MessagePipeHandle: 36 // A typesafe variant of MessagePipeHandle:
32 typedef mojo::Interface<{{interface.name}}>::Handle {{interface.name}}Handle; 37 typedef mojo::Interface<{{interface.name}}>::Handle {{interface.name}}Handle;
(...skipping 30 matching lines...) Expand all
63 namespace mojo { 68 namespace mojo {
64 namespace internal { 69 namespace internal {
65 {% for enum in enums %} 70 {% for enum in enums %}
66 {% include "enum_traits.tmpl" %} 71 {% include "enum_traits.tmpl" %}
67 {%- endfor %} 72 {%- endfor %}
68 } // namespace internal 73 } // namespace internal
69 } // namespace mojo 74 } // namespace mojo
70 {%- endif %} 75 {%- endif %}
71 76
72 #endif // {{header_guard}} 77 #endif // {{header_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698