Chromium Code Reviews| Index: mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
| diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
| index 4b1e658f67d733dcf9dd997eeb46bac10679ada0..536a662ac1c47c12544b3827c3d0d977628150df 100644 |
| --- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
| +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
| @@ -2,8 +2,14 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +{%- if variant -%} |
| +{%- set variant_path = "%s-%s"|format(module.path, variant) -%} |
| +{%- else -%} |
| +{%- set variant_path = module.path -%} |
| +{%- endif -%} |
| + |
| {%- set header_guard = "%s_H_"| |
| - format(module.path|upper|replace("/","_")|replace(".","_")) %} |
| + format(variant_path|upper|replace("/","_")|replace(".","_")|replace("-", "_")) %} |
|
yzshen1
2015/12/15 00:09:10
Please consider following the 80-char rule.
|
| #ifndef {{header_guard}} |
| #define {{header_guard}} |
| @@ -24,7 +30,7 @@ |
| #include "mojo/public/cpp/bindings/no_interface.h" |
| #include "mojo/public/cpp/bindings/string.h" |
| #include "mojo/public/cpp/bindings/struct_ptr.h" |
| -#include "{{module.path}}-internal.h" |
| +#include "{{variant_path}}-internal.h" |
| {%- for import in imports %} |
| #include "{{import.module.path}}.h" |
| {%- endfor %} |
| @@ -32,6 +38,9 @@ |
| {%- for namespace in namespaces_as_array %} |
| namespace {{namespace}} { |
| {%- endfor %} |
| +{%- if variant %} |
| +namespace {{variant}} { |
| +{%- endif %} |
| {#--- Enums #} |
| {% from "enum_macros.tmpl" import enum_decl -%} |
| @@ -139,6 +148,9 @@ typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr; |
| {%- endfor %} |
| {%- endif %} |
| +{%- if variant %} |
| +} // namespace {{variant}} |
| +{%- endif %} |
| {%- for namespace in namespaces_as_array|reverse %} |
| } // namespace {{namespace}} |
| {%- endfor %} |