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

Side by Side Diff: mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h

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, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_TRAITS_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_TRAITS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_TRAITS_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_TRAITS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 static const test::NestedStructWithTraitsImpl& f_struct( 67 static const test::NestedStructWithTraitsImpl& f_struct(
68 const test::StructWithTraitsImpl& value) { 68 const test::StructWithTraitsImpl& value) {
69 return value.get_struct(); 69 return value.get_struct();
70 } 70 }
71 71
72 static const std::vector<test::NestedStructWithTraitsImpl>& f_struct_array( 72 static const std::vector<test::NestedStructWithTraitsImpl>& f_struct_array(
73 const test::StructWithTraitsImpl& value) { 73 const test::StructWithTraitsImpl& value) {
74 return value.get_struct_array(); 74 return value.get_struct_array();
75 } 75 }
76
77 static const std::map<std::string, test::NestedStructWithTraitsImpl>&
78 f_struct_map(const test::StructWithTraitsImpl& value) {
79 return value.get_struct_map();
80 }
76 }; 81 };
77 82
78 template <> 83 template <>
79 struct StructTraits<test::PassByValueStructWithTraits, 84 struct StructTraits<test::PassByValueStructWithTraits,
80 test::PassByValueStructWithTraitsImpl> { 85 test::PassByValueStructWithTraitsImpl> {
81 // Deserialization to test::PassByValueStructTraitsImpl. 86 // Deserialization to test::PassByValueStructTraitsImpl.
82 static bool Read(test::PassByValueStructWithTraitsDataView data, 87 static bool Read(test::PassByValueStructWithTraitsDataView data,
83 test::PassByValueStructWithTraitsImpl* out); 88 test::PassByValueStructWithTraitsImpl* out);
84 89
85 // Fields in test::PassByValueStructWithTraits. 90 // Fields in test::PassByValueStructWithTraits.
86 // See src/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom. 91 // See src/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.
87 static ScopedHandle& f_handle(test::PassByValueStructWithTraitsImpl& value) { 92 static ScopedHandle& f_handle(test::PassByValueStructWithTraitsImpl& value) {
88 return value.get_mutable_handle(); 93 return value.get_mutable_handle();
89 } 94 }
90 }; 95 };
91 96
92 } // namespace mojo 97 } // namespace mojo
93 98
94 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_TRAITS_H_ 99 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698