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

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

Issue 2229793003: Mojo C++ bindings: change union reader of struct data view to be a template. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@87_union_typemapping
Patch Set: Created 4 years, 4 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 | « no previous file | 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_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl
index 4a4948cdbb60ff35f77b8813f16252fd91c60a94..550258f275016a6608f88072481e078eae9f9c95 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl
@@ -20,7 +20,8 @@ class {{struct.name}}DataView {
inline void Get{{name|under_to_camel}}DataView(
{{kind|cpp_data_view_type}}* output);
- bool Read{{name|under_to_camel}}({{kind|cpp_wrapper_type}}* output) {
+ template <typename UserType>
+ bool Read{{name|under_to_camel}}(UserType* output) {
{%- if pf.min_version != 0 %}
auto pointer = data_->header_.version >= {{pf.min_version}}
? &data_->{{name}} : nullptr;
@@ -29,7 +30,7 @@ class {{struct.name}}DataView {
{%- endif %}
return mojo::internal::Deserialize<{{kind|unmapped_type_for_serializer}}>(
pointer, output, context_);
-}
+ }
{%- elif kind|is_object_kind %}
inline void Get{{name|under_to_camel}}DataView(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698