]> git.saurik.com Git - apple/libc.git/blob - collections/PublicHeader/_collections_map.in.h
Libc-1439.100.3.tar.gz
[apple/libc.git] / collections / PublicHeader / _collections_map.in.h
1 /*
2 * Copyright (c) 2019 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (mhe 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 OS_ASSUME_NONNULL_BEGIN
25 __BEGIN_DECLS
26
27 #define os_map_t IN_MAP(,_t)
28
29 OS_EXPORT
30 void
31 IN_MAP(,_init)(os_map_t *m, os_map_config_t * _Nullable config,
32 int struct_version);
33
34 OS_OVERLOADABLE OS_ALWAYS_INLINE
35 static inline void
36 os_map_init(os_map_t *m, os_map_config_t * _Nullable config) {
37 IN_MAP(,_init)(m, config, OS_MAP_CONFIG_S_VERSION);
38 }
39
40 OS_EXPORT
41 void
42 IN_MAP(,_destroy)(os_map_t *m);
43
44 OS_OVERLOADABLE OS_ALWAYS_INLINE
45 static inline void
46 os_map_destroy(os_map_t *m) {
47 IN_MAP(,_destroy)(m);
48 }
49
50 OS_EXPORT
51 void
52 IN_MAP(,_insert)(os_map_t *m, os_map_key_t key, void *val);
53
54 OS_OVERLOADABLE OS_ALWAYS_INLINE
55 static inline void
56 os_map_insert(os_map_t *m, os_map_key_t key, void *val) {
57 IN_MAP(,_insert)(m, key, val);
58 }
59
60 OS_EXPORT
61 void *
62 IN_MAP(,_find)(os_map_t *m, os_map_key_t key);
63
64 OS_OVERLOADABLE OS_ALWAYS_INLINE
65 static inline void * _Nullable
66 os_map_find(os_map_t *m, os_map_key_t key) {
67 return IN_MAP(,_find)(m, key);
68 }
69
70 OS_EXPORT
71 void *
72 IN_MAP(,_delete)(os_map_t *m, os_map_key_t key);
73
74 OS_OVERLOADABLE OS_ALWAYS_INLINE
75 static inline void * _Nullable
76 os_map_delete(os_map_t *m, os_map_key_t key) {
77 return IN_MAP(,_delete)(m, key);
78 }
79
80 OS_EXPORT
81 void
82 IN_MAP(,_clear)(os_map_t *m,
83 OS_NOESCAPE IN_MAP(,_payload_handler_t) handler);
84
85 OS_OVERLOADABLE OS_ALWAYS_INLINE
86 static inline void
87 os_map_clear(os_map_t *m,
88 OS_NOESCAPE IN_MAP(,_payload_handler_t) handler) {
89 IN_MAP(,_clear)(m, handler);
90 }
91
92 OS_EXPORT
93 size_t
94 IN_MAP(,_count)(os_map_t *m);
95
96 OS_OVERLOADABLE OS_ALWAYS_INLINE
97 static inline size_t
98 os_map_count(os_map_t *m) {
99 return IN_MAP(,_count)(m);
100 }
101
102 OS_EXPORT
103 void
104 IN_MAP(,_foreach)(os_map_t *m,
105 OS_NOESCAPE IN_MAP(,_payload_handler_t) handler);
106
107 OS_OVERLOADABLE OS_ALWAYS_INLINE
108 static inline void
109 os_map_foreach(os_map_t *m,
110 OS_NOESCAPE IN_MAP(,_payload_handler_t) handler) {
111 IN_MAP(,_foreach)(m, handler);
112 }
113
114 __END_DECLS
115 OS_ASSUME_NONNULL_END