Index: mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h |
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h |
index 0cfc5e7a520fe76c7127ee00aa9b26f0f1c8bc77..a48430ee7a31d5375a0e1d3da2aea200e31af33d 100644 |
--- a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h |
+++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h |
@@ -8,6 +8,7 @@ |
#include <stdint.h> |
#include <string> |
+#include <vector> |
#include "base/strings/string_piece.h" |
#include "mojo/public/cpp/bindings/struct_traits.h" |
@@ -17,6 +18,16 @@ |
namespace mojo { |
template <> |
+struct StructTraits<test::StructWithTraitsElement, |
+ test::StructWithTraitsElementImpl> { |
+ static bool Read(test::StructWithTraitsElementDataView data, |
+ test::StructWithTraitsElementImpl* output); |
+ static int32_t value(const test::StructWithTraitsElementImpl& input) { |
+ return input.value; |
+ } |
+}; |
+ |
+template <> |
struct StructTraits<test::StructWithTraits, test::StructWithTraitsImpl> { |
// Deserialization to test::StructTraitsImpl. |
static bool Read(test::StructWithTraitsDataView data, |
@@ -37,12 +48,27 @@ struct StructTraits<test::StructWithTraits, test::StructWithTraitsImpl> { |
} |
static base::StringPiece f_string(const test::StructWithTraitsImpl& value) { |
- return value.get_string(); |
+ return value.get_string_as_string_piece(); |
} |
- static base::StringPiece f_string2(const test::StructWithTraitsImpl& value) { |
+ static const std::string& f_string2(const test::StructWithTraitsImpl& value) { |
return value.get_string(); |
} |
+ |
+ static const std::vector<std::string>& f_array_string( |
+ const test::StructWithTraitsImpl& value) { |
+ return value.get_array_string(); |
+ } |
+ |
+ static const test::StructWithTraitsElementImpl& f_element( |
+ const test::StructWithTraitsImpl& value) { |
+ return value.get_element(); |
+ } |
+ |
+ static const std::vector<test::StructWithTraitsElementImpl>& f_array_element( |
+ const test::StructWithTraitsImpl& value) { |
+ return value.get_array_element(); |
+ } |
}; |
} // namespace mojo |