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

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

Issue 1821073002: Mojo bindings: Fix typemap includes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 29 matching lines...) Expand all
40 base::StringPiece get_string() const { return string_; } 40 base::StringPiece get_string() const { return string_; }
41 41
42 private: 42 private:
43 bool bool_ = false; 43 bool bool_ = false;
44 uint32_t uint32_ = 0; 44 uint32_t uint32_ = 0;
45 uint64_t uint64_ = 0; 45 uint64_t uint64_ = 0;
46 std::string string_; 46 std::string string_;
47 }; 47 };
48 48
49 } // namespace test 49 } // namespace test
50
51 template <>
52 struct StructTraits<test::StructWithTraits, test::StructWithTraitsImpl> {
53 // Deserialization to test::StructTraitsImpl.
54 static bool Read(test::StructWithTraits_Reader r,
55 test::StructWithTraitsImpl* out);
56
57 // Fields in test::StructWithTraits.
58 // See src/mojo/public/interfaces/bindings/tests/test_native_types.mojom.
59 static bool f_bool(const test::StructWithTraitsImpl& value) {
60 return value.get_bool();
61 }
62
63 static uint32_t f_uint32(const test::StructWithTraitsImpl& value) {
64 return value.get_uint32();
65 }
66
67 static uint64_t f_uint64(const test::StructWithTraitsImpl& value) {
68 return value.get_uint64();
69 }
70
71 static base::StringPiece f_string(const test::StructWithTraitsImpl& value) {
72 return value.get_string();
73 }
74 };
75
76 } // namespace mojo 50 } // namespace mojo
77 51
78 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_H_ 52 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_STRUCT_WITH_TRAITS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698