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

Side by Side Diff: mojo/public/cpp/bindings/map_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/map.h ('k') | mojo/public/cpp/bindings/map_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_H_
7
8 namespace mojo {
9
10 // This must be specialized for any type |T| to be serialized/deserialized as
11 // a mojom map.
12 //
13 // Usually you would like to do a partial specialization for a map template.
14 // Imagine you want to specialize it for CustomMap<>, you need to implement:
15 //
16 // template <typename K, typename V>
17 // struct MapTraits<CustomMap<K, V>> {
18 // using Key = K;
19 // using Value = V;
20 //
21 // // These two methods are optional. Please see comments in struct_traits.h
22 // static bool IsNull(const CustomMap<K, V>& input);
23 // static void SetToNull(CustomMap<K, V>* output);
24 //
25 // static size_t GetSize(const CustomMap<K, V>& input);
26 //
27 // static CustomConstIterator GetBegin(const CustomMap<K, V>& input);
28 // static CustomIterator GetBegin(CustomMap<K, V>& input);
29 //
30 // static void AdvanceIterator(CustomConstIterator& iterator);
31 // static void AdvanceIterator(CustomIterator& iterator);
32 //
33 // static const K& GetKey(CustomIterator& iterator);
34 // static const K& GetKey(CustomConstIterator& iterator);
35 //
36 // static V& GetValue(CustomIterator& iterator);
37 // static const V& GetValue(CustomConstIterator& iterator);
38 //
39 // static void Insert(CustomMap<K, V>& input,
40 // const K& key,
41 // V&& value);
42 // static void Insert(CustomMap<K, V>& input,
43 // const K& key,
44 // const V& value);
45 //
46 // static void SetToEmpty(CustomMap<K, V>* output);
47 // };
48 //
49 template <typename T>
50 struct MapTraits;
51
52 } // namespace mojo
53
54 #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/map.h ('k') | mojo/public/cpp/bindings/map_traits_standard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698