OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ | |
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ | |
7 | |
8 namespace mojo { | |
9 | |
10 // This must be specialized for any type |T| to be serialized/deserialized as | |
11 // a mojom struct of type |MojomType|. | |
12 // | |
13 // Each specialization must implement a few things: | |
14 // | |
15 // 1. Static getters for each field in the Mojom type. These should be | |
16 // of the form: | |
17 // | |
18 // static <return type> <field name>(const T&) | |
19 // | |
20 // and should return a serializable form of the named field as extracted | |
21 // from the referenced |T| instance. | |
22 // | |
23 // 2. A static Read method to initialize a new |T| from a MojomType::Reader: | |
24 // | |
25 // static bool Read(MojomType::Reader r, T* out); | |
Jeffrey Yasskin
2016/01/28 18:01:40
Could you document whether a 'true' or 'false' ret
| |
26 // | |
27 // The generated MojomType::Reader type provides a convenient, inexpensive | |
28 // view of a serialized struct's field data. | |
29 // | |
30 template <typename MojomType, typename T> | |
31 struct StructTraits; | |
32 | |
33 } // namespace mojo | |
34 | |
35 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_ | |
OLD | NEW |