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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
index 2d748fc95455cd23fb777ba83fcaa19d443f89e7..9dea070c5b1cc4baa61336ee746a47c238a8cad4 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module-internal.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_INTERNAL_H_"|
- format(module.path|upper|replace("/","_")|replace(".","_")) %}
+ 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
#ifndef {{header_guard}}
#define {{header_guard}}
@@ -27,6 +33,9 @@ class BoundsChecker;
{%- for namespace in namespaces_as_array %}
namespace {{namespace}} {
{%- endfor %}
+{%- if variant %}
+namespace {{variant}} {
+{%- endif %}
{#--- Wrapper forward declarations #}
{% for struct in structs %}
@@ -65,6 +74,9 @@ class {{union.name}}_Data;
#pragma pack(pop)
} // namespace internal
+{%- if variant %}
+} // namespace {{variant}}
+{%- endif %}
{%- for namespace in namespaces_as_array|reverse %}
} // namespace {{namespace}}
{%- endfor %}

Powered by Google App Engine
This is Rietveld 408576698