OLD | NEW |
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 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h" | 5 #include "mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h" |
6 #include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h" | |
7 | 6 |
8 namespace mojo { | 7 namespace mojo { |
9 | 8 |
10 // static | 9 // static |
11 bool StructTraits<test::StructWithTraits, test::StructWithTraitsImpl>::Read( | 10 bool StructTraits<test::StructWithTraits, test::StructWithTraitsImpl>::Read( |
12 test::StructWithTraits_Reader r, | 11 test::StructWithTraitsDataView data, |
13 test::StructWithTraitsImpl* out) { | 12 test::StructWithTraitsImpl* out) { |
14 out->set_bool(r.f_bool()); | 13 out->set_bool(data.f_bool()); |
15 out->set_uint32(r.f_uint32()); | 14 out->set_uint32(data.f_uint32()); |
16 out->set_uint64(r.f_uint64()); | 15 out->set_uint64(data.f_uint64()); |
17 out->set_string(r.f_string().as_string()); | 16 base::StringPiece f_string, f_string2; |
18 return r.f_string() == r.f_string2(); | 17 if (!data.ReadFString(&f_string) || !data.ReadFString2(&f_string2)) |
| 18 return false; |
| 19 out->set_string(f_string.as_string()); |
| 20 return f_string == f_string2; |
19 } | 21 } |
20 | 22 |
21 } // namespace mojo | 23 } // namespace mojo |
OLD | NEW |