Index: mojo/public/cpp/bindings/tests/struct_with_traits_impl.h |
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h b/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h |
index 3ba8ef6430abf59f925d9450e4d5ff2cc4928ca6..25a17f403152430c0fdab23aa4a5e0972cc17c56 100644 |
--- a/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h |
+++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl.h |
@@ -8,12 +8,22 @@ |
#include <stdint.h> |
#include <string> |
+#include <vector> |
#include "base/strings/string_piece.h" |
namespace mojo { |
namespace test { |
+struct NestedStructWithTraitsImpl { |
+ public: |
+ bool operator==(const NestedStructWithTraitsImpl& other) const { |
+ return value == other.value; |
+ } |
+ |
+ int32_t value = 0; |
+}; |
+ |
// A type which knows how to look like a mojo::test::StructWithTraits mojom type |
// by way of mojo::StructTraits. |
class StructWithTraitsImpl { |
@@ -31,13 +41,32 @@ class StructWithTraitsImpl { |
uint64_t get_uint64() const { return uint64_; } |
void set_string(std::string value) { string_ = value; } |
- base::StringPiece get_string() const { return string_; } |
+ base::StringPiece get_string_as_string_piece() const { return string_; } |
+ const std::string& get_string() const { return string_; } |
+ |
+ const std::vector<std::string>& get_string_array() const { |
+ return string_array_; |
+ } |
+ std::vector<std::string>& get_mutable_string_array() { return string_array_; } |
+ |
+ const NestedStructWithTraitsImpl& get_struct() const { return struct_; } |
+ NestedStructWithTraitsImpl& get_mutable_struct() { return struct_; } |
+ |
+ const std::vector<NestedStructWithTraitsImpl>& get_struct_array() const { |
+ return struct_array_; |
+ } |
+ std::vector<NestedStructWithTraitsImpl>& get_mutable_struct_array() { |
+ return struct_array_; |
+ } |
private: |
bool bool_ = false; |
uint32_t uint32_ = 0; |
uint64_t uint64_ = 0; |
std::string string_; |
+ std::vector<std::string> string_array_; |
+ NestedStructWithTraitsImpl struct_; |
+ std::vector<NestedStructWithTraitsImpl> struct_array_; |
}; |
} // namespace test |