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

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: 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 {%- if variant -%}
6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%}
7 {%- else -%}
8 {%- set variant_path = module.path -%}
9 {%- endif -%}
10
5 {%- set header_guard = "%s_INTERNAL_H_"| 11 {%- set header_guard = "%s_INTERNAL_H_"|
6 format(module.path|upper|replace("/","_")|replace(".","_")) %} 12 format(variant_path|upper|replace("/","_")|replace(".","_")|replace("-", "_")) %}
yzshen1 2015/12/15 00:09:10 nit: I understand that we don't have style guide f
7 13
8 #ifndef {{header_guard}} 14 #ifndef {{header_guard}}
9 #define {{header_guard}} 15 #define {{header_guard}}
10 16
11 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" 17 #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
12 #include "mojo/public/cpp/bindings/lib/buffer.h" 18 #include "mojo/public/cpp/bindings/lib/buffer.h"
13 #include "mojo/public/cpp/bindings/lib/union_accessor.h" 19 #include "mojo/public/cpp/bindings/lib/union_accessor.h"
14 #include "mojo/public/cpp/bindings/lib/value_traits.h" 20 #include "mojo/public/cpp/bindings/lib/value_traits.h"
15 #include "mojo/public/cpp/bindings/struct_ptr.h" 21 #include "mojo/public/cpp/bindings/struct_ptr.h"
16 22
17 {%- for import in imports %} 23 {%- for import in imports %}
18 #include "{{import.module.path}}-internal.h" 24 #include "{{import.module.path}}-internal.h"
19 {%- endfor %} 25 {%- endfor %}
20 26
21 namespace mojo { 27 namespace mojo {
22 namespace internal { 28 namespace internal {
23 class BoundsChecker; 29 class BoundsChecker;
24 } 30 }
25 } 31 }
26 32
27 {%- for namespace in namespaces_as_array %} 33 {%- for namespace in namespaces_as_array %}
28 namespace {{namespace}} { 34 namespace {{namespace}} {
29 {%- endfor %} 35 {%- endfor %}
36 {%- if variant %}
37 namespace {{variant}} {
38 {%- endif %}
30 39
31 {#--- Wrapper forward declarations #} 40 {#--- Wrapper forward declarations #}
32 {% for struct in structs %} 41 {% for struct in structs %}
33 class {{struct.name}}; 42 class {{struct.name}};
34 {%- endfor %} 43 {%- endfor %}
35 44
36 {#--- Wrapper forward declarations for unions #} 45 {#--- Wrapper forward declarations for unions #}
37 {% for union in unions %} 46 {% for union in unions %}
38 class {{union.name}}; 47 class {{union.name}};
39 {%- endfor %} 48 {%- endfor %}
(...skipping 18 matching lines...) Expand all
58 {%- endfor %} 67 {%- endfor %}
59 68
60 {#--- Class declarations #} 69 {#--- Class declarations #}
61 {% for struct in structs %} 70 {% for struct in structs %}
62 {% include "struct_declaration.tmpl" %} 71 {% include "struct_declaration.tmpl" %}
63 {%- endfor %} 72 {%- endfor %}
64 73
65 #pragma pack(pop) 74 #pragma pack(pop)
66 75
67 } // namespace internal 76 } // namespace internal
77 {%- if variant %}
78 } // namespace {{variant}}
79 {%- endif %}
68 {%- for namespace in namespaces_as_array|reverse %} 80 {%- for namespace in namespaces_as_array|reverse %}
69 } // namespace {{namespace}} 81 } // namespace {{namespace}}
70 {%- endfor %} 82 {%- endfor %}
71 83
72 #endif // {{header_guard}} 84 #endif // {{header_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698