| OLD | NEW |
| 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 10 matching lines...) Expand all Loading... |
| 21 // static <return type> <field name>(const T& input); | 21 // static <return type> <field name>(const T& input); |
| 22 // | 22 // |
| 23 // and should return a serializable form of the named field as extracted | 23 // and should return a serializable form of the named field as extracted |
| 24 // from |input|. | 24 // from |input|. |
| 25 // | 25 // |
| 26 // Serializable form of a field: | 26 // Serializable form of a field: |
| 27 // Value or reference of the same type used in the generated stuct | 27 // Value or reference of the same type used in the generated stuct |
| 28 // wrapper type, or the following alternatives: | 28 // wrapper type, or the following alternatives: |
| 29 // - string: | 29 // - string: |
| 30 // Value or reference of any type that has a StringTraits defined. | 30 // Value or reference of any type that has a StringTraits defined. |
| 31 // Supported by default: base::StringPiece, std::string, mojo::String, | 31 // Supported by default: base::StringPiece, std::string, |
| 32 // WTF::String (in blink). | 32 // WTF::String (in blink). |
| 33 // | 33 // |
| 34 // - array: | 34 // - array: |
| 35 // Value or reference of any type that has an ArrayTraits defined. | 35 // Value or reference of any type that has an ArrayTraits defined. |
| 36 // Supported by default: std::vector, CArray, mojo::Array, WTF::Vector | 36 // Supported by default: std::vector, CArray, mojo::Array, WTF::Vector |
| 37 // (in blink), mojo::WTFArray (in blink). | 37 // (in blink), mojo::WTFArray (in blink). |
| 38 // | 38 // |
| 39 // - map: | 39 // - map: |
| 40 // Value or reference of any type that has a MapTraits defined. | 40 // Value or reference of any type that has a MapTraits defined. |
| 41 // Supported by default: std::map, std::unordered_map, | 41 // Supported by default: std::map, std::unordered_map, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // | 157 // |
| 158 // static bool Read(FooDataView data, CustomFoo* output); | 158 // static bool Read(FooDataView data, CustomFoo* output); |
| 159 // }; | 159 // }; |
| 160 // | 160 // |
| 161 template <typename DataViewType, typename T> | 161 template <typename DataViewType, typename T> |
| 162 struct StructTraits; | 162 struct StructTraits; |
| 163 | 163 |
| 164 } // namespace mojo | 164 } // namespace mojo |
| 165 | 165 |
| 166 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ | 166 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ |
| OLD | NEW |