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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/module.cc.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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
index dddb6abbecf3d041e01171dfbbd996049fa5b6d5..fd2f610fee6f157076ef7cf651a8a47bca270cc6 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
@@ -2,6 +2,12 @@
// 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 %}
+
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
@@ -12,7 +18,7 @@
#pragma warning(disable:4756)
#endif
-#include "{{module.path}}.h"
+#include "{{variant_path}}.h"
#include <math.h>
@@ -34,6 +40,9 @@
{%- for namespace in namespaces_as_array %}
namespace {{namespace}} {
{%- endfor %}
+{%- if variant %}
+namespace {{variant}} {
+{%- endif %}
{#--- Constants #}
{%- for constant in module.constants %}
@@ -121,6 +130,9 @@ MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{struc
{%- include "union_serialization_definition.tmpl" %}
{%- endfor %}
+{%- if variant %}
+} // namespace {{variant}}
+{%- endif %}
{%- for namespace in namespaces_as_array|reverse %}
} // namespace {{namespace}}
{%- endfor %}

Powered by Google App Engine
This is Rietveld 408576698