]> git.saurik.com Git - apple/libc.git/blob - collections/PublicHeader/_collections_map.h
Libc-1439.100.3.tar.gz
[apple/libc.git] / collections / PublicHeader / _collections_map.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 (the '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 #ifndef __OS_COLLECTIONS_MAP_H
25 #define __OS_COLLECTIONS_MAP_H
26
27 #include <os/collections_map.h>
28
29 OS_ASSUME_NONNULL_BEGIN
30 __BEGIN_DECLS
31
32 #ifndef os_map_str_payload_handler_t
33 typedef bool (^os_map_str_payload_handler_t) (const char *, void *);
34 #endif
35
36 #ifndef os_map_32_payload_handler_t
37 typedef bool (^os_map_32_payload_handler_t) (uint32_t, void *);
38 #endif
39
40 #ifndef os_map_64_payload_handler_t
41 typedef bool (^os_map_64_payload_handler_t) (uint64_t, void *);
42 #endif
43
44 #ifndef os_map_128_payload_handler_t
45 typedef bool (^os_map_128_payload_handler_t) (os_map_128_key_t, void *);
46 #endif
47
48 OS_EXPORT
49 const char *
50 os_map_str_entry(os_map_str_t *m, const char *key);
51
52 OS_OVERLOADABLE OS_ALWAYS_INLINE
53 static inline const char * _Nullable
54 os_map_entry(os_map_str_t *m, const char *key)
55 {
56 return os_map_str_entry(m, key);
57 }
58
59 __END_DECLS
60 OS_ASSUME_NONNULL_END
61
62 #define IN_MAP(PREFIX, SUFFIX) PREFIX ## os_map_str ## SUFFIX
63 #define os_map_key_t const char *
64 #include "_collections_map.in.h"
65 #undef IN_MAP
66 #undef os_map_key_t
67
68 #define IN_MAP(PREFIX, SUFFIX) PREFIX ## os_map_32 ## SUFFIX
69 #define os_map_key_t uint32_t
70 #include "_collections_map.in.h"
71 #undef IN_MAP
72 #undef os_map_key_t
73
74 #define IN_MAP(PREFIX, SUFFIX) PREFIX ## os_map_64 ## SUFFIX
75 #define os_map_key_t uint64_t
76 #include "_collections_map.in.h"
77 #undef IN_MAP
78 #undef os_map_key_t
79
80 #define IN_MAP(PREFIX, SUFFIX) PREFIX ## os_map_128 ## SUFFIX
81 #define os_map_key_t os_map_128_key_t
82 #include "_collections_map.in.h"
83 #undef IN_MAP
84 #undef os_map_key_t
85
86 #endif /* __OS_COLLECTIONS_MAP_H */