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

Side by Side Diff: mojo/public/cpp/bindings/struct_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_STRUCT_TRAITS_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
7 7
8 namespace mojo { 8 namespace mojo {
9 9
10 // This must be specialized for any type |T| to be serialized/deserialized as 10 // This must be specialized for any type |T| to be serialized/deserialized as
(...skipping 12 matching lines...) Expand all
23 // Value or reference of the same type used in |MojomType|, or the 23 // Value or reference of the same type used in |MojomType|, or the
24 // following alternatives: 24 // following alternatives:
25 // - string: 25 // - string:
26 // Value or reference of any type that has a StringTraits defined. 26 // Value or reference of any type that has a StringTraits defined.
27 // Supported by default: base::StringPiece, std::string. 27 // Supported by default: base::StringPiece, std::string.
28 // 28 //
29 // - array: 29 // - array:
30 // Value or reference of any type that has an ArrayTraits defined. 30 // Value or reference of any type that has an ArrayTraits defined.
31 // Supported by default: std::vector, WTF::Vector (in blink). 31 // Supported by default: std::vector, WTF::Vector (in blink).
32 // 32 //
33 // - map:
34 // Value or reference of any type that has a MapTraits defined.
35 // Supported by default: std::map.
36 //
33 // - struct: 37 // - struct:
34 // Value or reference of any type that has a StructTraits defined. 38 // Value or reference of any type that has a StructTraits defined.
35 // 39 //
36 // During serialization, getters for string/struct/array/map/union fields 40 // During serialization, getters for string/struct/array/map/union fields
37 // are called twice (one for size calculation and one for actual 41 // are called twice (one for size calculation and one for actual
38 // serialization); while the others are called once. 42 // serialization); while the others are called once.
39 // 43 //
40 // 2. A static Read() method to set the contents of a |T| instance from a 44 // 2. A static Read() method to set the contents of a |T| instance from a
41 // |MojomType|DataView (e.g., if |MojomType| is test::Example, the data 45 // |MojomType|DataView (e.g., if |MojomType| is test::Example, the data
42 // view will be test::ExampleDataView). 46 // view will be test::ExampleDataView).
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // 136 //
133 // static bool Read(FooDataView data, CustomFoo* output); 137 // static bool Read(FooDataView data, CustomFoo* output);
134 // }; 138 // };
135 // 139 //
136 template <typename MojomType, typename T> 140 template <typename MojomType, typename T>
137 struct StructTraits; 141 struct StructTraits;
138 142
139 } // namespace mojo 143 } // namespace mojo
140 144
141 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ 145 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/map_traits_stl.h ('k') | mojo/public/cpp/bindings/tests/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698