Bond
 
Loading...
Searching...
No Matches
container_interface.h
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#pragma once
5
6#include <bond/core/config.h>
7
8#include "traits.h"
9
10#include <stdint.h>
11
12namespace bond
13{
14
15//
16// container traits - specialize for custom containers
17//
18
19template <typename T> struct
20is_set_container
21 : std::false_type {};
22
23
24template <typename T> struct
25is_map_container
26 : std::false_type {};
27
28
29template <typename T> struct
30is_list_container
31 : std::false_type {};
32
33
34template <typename T> struct
35require_modify_element
36 : std::false_type {};
37
38
39template <typename T> struct
40is_string
41 : std::false_type {};
42
43
44template <typename T> struct
45is_wstring
46 : std::false_type {};
47
48
49template <typename T> struct
50element_type
51{
52 typedef typename T::value_type type;
53};
54
55
56//
57// enumerators - specialize for custom containers
58//
59
60template <typename T>
61class enumerator;
62#if 0
63{
64 explicit enumerator(T& list);
65 bool more() const;
66 typename element_type<T>::type& next();
67};
68#endif
69
70
71template <typename T>
72class const_enumerator;
73#if 0
74{
75 explicit const_enumerator(const T& container);
76 bool more() const;
77 const typename element_type<T>::type& next();
78};
79#endif
80
81
82//
83// container functions - overload for custom containers
84//
85
86#if 0
87template <typename T>
88uint32_t container_size(const T& container);
89
90template <typename T>
91void resize_list(T& list, uint32_t size);
92
93template <typename T, typename E, typename F>
94void modify_element(T& list, E& element, F deserialize);
95
96template <typename T>
97void clear_set(T& set);
98
99template <typename S, typename T>
100void set_insert(S& set, const T& item);
101
102template <typename T>
103void clear_map(T& map);
104
105template <typename M, typename K, typename T>
106T& mapped_at(M& map, const K& key);
107#endif
108
109//
110// string functions - overload for custom strings
111//
112
113#if 0
114template<typename C, typename T>
115const C* string_data(const T& str);
116
117template<typename C, typename T>
118C* string_data(T& str);
119
120template<typename T>
121uint32_t string_length(const T& str);
122
123template<typename T>
124void resize_string(T& str, uint32_t size);
125#endif
126
127} // namespace bond
namespace bond
Definition: apply.h:17