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

Side by Side Diff: mojo/public/cpp/bindings/array_traits.h

Issue 1978003002: Mojo C++ bindings: add detailed comments for String/Array/StructTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@29_wtf_vector
Patch Set: Created 4 years, 7 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 | « no previous file | mojo/public/cpp/bindings/array_traits_standard.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 UserType 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 // TODO(yzshen): This is work in progress. Add better documentation once the 13 // Usually you would like to do a partial specialization for an array/vector
14 // interface becomes more stable. 14 // template. Imagine you want to specialize it for CustomArray<>, you need to
15 template <typename UserType> 15 // implement:
16 //
17 // template <typename T>
18 // struct ArrayTraits<CustomArray<T>> {
19 // using Element = T;
20 //
21 // // These two methods are optional. Please see comments in struct_traits.h
22 // static bool IsNull(const CustomArray<T>& input);
23 // static void SetToNull(CustomArray<T>* output);
24 //
25 // static size_t GetSize(const CustomArray<T>& input);
26 //
27 // static T* GetData(CustomArray<T>& input);
28 // static const T* GetData(const CustomArray<T>& input);
29 //
30 // static T& GetAt(CustomArray<T>& input, size_t index);
31 // static const T& GetAt(const CustomArray<T>& input, size_t index);
32 //
33 // static void Resize(CustomArray<T>& input, size_t size);
34 // };
35 //
36 template <typename T>
16 struct ArrayTraits; 37 struct ArrayTraits;
17 38
18 } // namespace mojo 39 } // namespace mojo
19 40
20 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ 41 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/array_traits_standard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698