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

Side by Side Diff: mojo/public/cpp/bindings/array_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
« no previous file with comments | « mojo/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/lib/array_serialization.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
11 // a mojom array. 11 // a mojom array.
12 // 12 //
13 // Usually you would like to do a partial specialization for an array/vector 13 // Usually you would like to do a partial specialization for an array/vector
14 // template. Imagine you want to specialize it for CustomArray<>, you need to 14 // template. Imagine you want to specialize it for CustomArray<>, you need to
15 // implement: 15 // implement:
16 // 16 //
17 // template <typename T> 17 // template <typename T>
18 // struct ArrayTraits<CustomArray<T>> { 18 // struct ArrayTraits<CustomArray<T>> {
19 // using Element = T; 19 // using Element = T;
20 // 20 //
21 // // These two methods are optional. Please see comments in struct_traits.h 21 // // These two methods are optional. Please see comments in struct_traits.h
22 // static bool IsNull(const CustomArray<T>& input); 22 // static bool IsNull(const CustomArray<T>& input);
23 // static void SetToNull(CustomArray<T>* output); 23 // static void SetToNull(CustomArray<T>* output);
24 // 24 //
25 // static size_t GetSize(const CustomArray<T>& input); 25 // static size_t GetSize(const CustomArray<T>& input);
26 // 26 //
27 // // These two methods are optional. They are used to access the
28 // // underlying storage of the array to speed up copy of POD types.
27 // static T* GetData(CustomArray<T>& input); 29 // static T* GetData(CustomArray<T>& input);
28 // static const T* GetData(const CustomArray<T>& input); 30 // static const T* GetData(const CustomArray<T>& input);
29 // 31 //
30 // static T& GetAt(CustomArray<T>& input, size_t index); 32 // static T& GetAt(CustomArray<T>& input, size_t index);
31 // static const T& GetAt(const CustomArray<T>& input, size_t index); 33 // static const T& GetAt(const CustomArray<T>& input, size_t index);
32 // 34 //
33 // static void Resize(CustomArray<T>& input, size_t size); 35 // static void Resize(CustomArray<T>& input, size_t size);
34 // }; 36 // };
35 // 37 //
36 template <typename T> 38 template <typename T>
37 struct ArrayTraits; 39 struct ArrayTraits;
38 40
39 } // namespace mojo 41 } // namespace mojo
40 42
41 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ 43 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/lib/array_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698