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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl

Issue 2014403002: Mojo C++ bindings: custom type mapping of map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl
index 4fc70d414f7059529ed9fd271a28bcd652286a10..bf16baddbdaaa52bd573fa40dcbbd179d65a0465 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl
@@ -8,20 +8,9 @@
{%- for pf in struct.packed.packed_fields_in_ordinal_order %}
{%- set kind = pf.field.kind -%}
{%- set name = pf.field.name -%}
-{%- if kind|is_struct_kind or kind|is_array_kind or kind|is_string_kind %}
+{%- if kind|is_struct_kind or kind|is_array_kind or kind|is_string_kind or
+ kind|is_map_kind %}
{#- Does nothing. They are already defined in the class declaration. #}
-{%- elif kind|is_map_kind %}
-bool {{struct.name}}DataView::Read{{name|under_to_camel}}(
- {{kind|cpp_wrapper_type}}* value) {
-{%- if pf.min_version != 0 %}
- auto pointer = data_->header_.version >= {{pf.min_version}}
- ? data_->{{name}}.ptr : nullptr;
-{%- else %}
- auto pointer = data_->{{name}}.ptr;
-{%- endif %}
- return mojo::internal::Deserialize<{{kind|unmapped_type_for_serializer}}>(
- pointer, value, context_);
-}
{%- elif kind|is_union_kind %}
bool {{struct.name}}DataView::Read{{name|under_to_camel}}(
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698