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

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

Issue 1517043004: [mojo] Add typemap and variant support to generators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pickle3
Patch Set: set proper upstream Created 5 years 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_INTERNAL_H_"| 5 {%- if variant -%}
6 format(module.path|upper|replace("/","_")|replace(".","_")) %} 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%}
7 {%- else -%}
8 {%- set variant_path = module.path -%}
9 {%- endif -%}
10
11 {%- set header_guard = "%s_INTERNAL_H_"|format(
12 variant_path|upper|replace("/","_")|replace(".","_")|
13 replace("-", "_")) %}
7 14
8 #ifndef {{header_guard}} 15 #ifndef {{header_guard}}
9 #define {{header_guard}} 16 #define {{header_guard}}
10 17
11 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" 18 #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
12 #include "mojo/public/cpp/bindings/lib/buffer.h" 19 #include "mojo/public/cpp/bindings/lib/buffer.h"
13 #include "mojo/public/cpp/bindings/lib/union_accessor.h" 20 #include "mojo/public/cpp/bindings/lib/union_accessor.h"
14 #include "mojo/public/cpp/bindings/lib/value_traits.h" 21 #include "mojo/public/cpp/bindings/lib/value_traits.h"
15 #include "mojo/public/cpp/bindings/struct_ptr.h" 22 #include "mojo/public/cpp/bindings/struct_ptr.h"
16 23
17 {%- for import in imports %} 24 {%- for import in imports %}
18 #include "{{import.module.path}}-internal.h" 25 #include "{{import.module.path}}-internal.h"
19 {%- endfor %} 26 {%- endfor %}
20 27
21 namespace mojo { 28 namespace mojo {
22 namespace internal { 29 namespace internal {
23 class BoundsChecker; 30 class BoundsChecker;
24 } 31 }
25 } 32 }
26 33
27 {%- for namespace in namespaces_as_array %} 34 {%- for namespace in namespaces_as_array %}
28 namespace {{namespace}} { 35 namespace {{namespace}} {
29 {%- endfor %} 36 {%- endfor %}
37 {%- if variant %}
38 namespace {{variant}} {
39 {%- endif %}
30 40
31 {#--- Wrapper forward declarations #} 41 {#--- Wrapper forward declarations #}
32 {% for struct in structs %} 42 {% for struct in structs %}
33 class {{struct.name}}; 43 class {{struct.name}};
34 {%- endfor %} 44 {%- endfor %}
35 45
36 {#--- Wrapper forward declarations for unions #} 46 {#--- Wrapper forward declarations for unions #}
37 {% for union in unions %} 47 {% for union in unions %}
38 class {{union.name}}; 48 class {{union.name}};
39 {%- endfor %} 49 {%- endfor %}
(...skipping 18 matching lines...) Expand all
58 {%- endfor %} 68 {%- endfor %}
59 69
60 {#--- Class declarations #} 70 {#--- Class declarations #}
61 {% for struct in structs %} 71 {% for struct in structs %}
62 {% include "struct_declaration.tmpl" %} 72 {% include "struct_declaration.tmpl" %}
63 {%- endfor %} 73 {%- endfor %}
64 74
65 #pragma pack(pop) 75 #pragma pack(pop)
66 76
67 } // namespace internal 77 } // namespace internal
78 {%- if variant %}
79 } // namespace {{variant}}
80 {%- endif %}
68 {%- for namespace in namespaces_as_array|reverse %} 81 {%- for namespace in namespaces_as_array|reverse %}
69 } // namespace {{namespace}} 82 } // namespace {{namespace}}
70 {%- endfor %} 83 {%- endfor %}
71 84
72 #endif // {{header_guard}} 85 #endif // {{header_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698