OLD | NEW |
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_ARRAY_TRAITS_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_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 29 matching lines...) Expand all Loading... |
40 // // | 40 // // |
41 // // Acquires an iterator positioned at the first element in the container. | 41 // // Acquires an iterator positioned at the first element in the container. |
42 // static ConstIterator GetBegin(const Container<T>& input); | 42 // static ConstIterator GetBegin(const Container<T>& input); |
43 // static Iterator GetBegin(Container<T>& input); | 43 // static Iterator GetBegin(Container<T>& input); |
44 // | 44 // |
45 // // Advances |iterator| to the next position within the container. | 45 // // Advances |iterator| to the next position within the container. |
46 // static void AdvanceIterator(ConstIterator& iterator); | 46 // static void AdvanceIterator(ConstIterator& iterator); |
47 // static void AdvanceIterator(Iterator& iterator); | 47 // static void AdvanceIterator(Iterator& iterator); |
48 // | 48 // |
49 // // Returns a reference to the value at the current position of | 49 // // Returns a reference to the value at the current position of |
50 // // |iterator|. | 50 // // |iterator|. Optionally, the ConstIterator version of GetValue can |
| 51 // // return by value instead of by reference if it makes sense for the |
| 52 // // type. |
51 // static const T& GetValue(ConstIterator& iterator); | 53 // static const T& GetValue(ConstIterator& iterator); |
52 // static T& GetValue(Iterator& iterator); | 54 // static T& GetValue(Iterator& iterator); |
53 // | 55 // |
54 // // These two methods are optional if the iterator methods are | 56 // // These two methods are optional if the iterator methods are |
55 // // implemented. | 57 // // implemented. |
56 // static T& GetAt(Container<T>& input, size_t index); | 58 // static T& GetAt(Container<T>& input, size_t index); |
57 // static const T& GetAt(const Container<T>& input, size_t index); | 59 // static const T& GetAt(const Container<T>& input, size_t index); |
58 // | 60 // |
59 // // Returning false results in deserialization failure and causes the | 61 // // Returning false results in deserialization failure and causes the |
60 // // message pipe receiving it to be disconnected. | 62 // // message pipe receiving it to be disconnected. |
61 // static bool Resize(Container<T>& input, size_t size); | 63 // static bool Resize(Container<T>& input, size_t size); |
62 // }; | 64 // }; |
63 // | 65 // |
64 template <typename T> | 66 template <typename T> |
65 struct ArrayTraits; | 67 struct ArrayTraits; |
66 | 68 |
67 } // namespace mojo | 69 } // namespace mojo |
68 | 70 |
69 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ | 71 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ |
OLD | NEW |