1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* Copyright © 2023-2024 Apple Inc. */
#ifndef MLX_MAP_H
#define MLX_MAP_H
#include "mlx/c/array.h"
#include "mlx/c/string.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup mlx_map_string_to_array String-to-array map
* MLX string-to-array map object.
*/
/**@{*/
/**
* A string-to-array map
*/
typedef struct mlx_map_string_to_array_* mlx_map_string_to_array;
/**
* Returns a new empty string-to-array map.
*/
mlx_map_string_to_array mlx_map_string_to_array_new(void);
/**
* Insert a new `value` at the specified `key` in the map.
* Returns `true` if the value was actually inserted.
*/
bool mlx_map_string_to_array_insert(
mlx_map_string_to_array map,
const mlx_string key,
const mlx_array value);
/**
* Returns the value indexed at the specified `key` in the map.
* Returns `NULL` if no value was found for `key`.
*/
mlx_array mlx_map_string_to_array_get(
mlx_map_string_to_array map,
const mlx_string key);
/**
* An iterator over a string-to-array map.
*/
typedef struct mlx_map_string_to_array_iterator_*
mlx_map_string_to_array_iterator;
/**
* Returns a new iterator over the given map.
*/
mlx_map_string_to_array_iterator mlx_map_string_to_array_iterate(
mlx_map_string_to_array map);
/**
* Increment iterator.
* Returns `true` if iterator could actually be incremented.
*/
bool mlx_map_string_to_array_iterator_next(mlx_map_string_to_array_iterator it);
/**
* Returns `true` iif iterator is at the end of the map.
*/
bool mlx_map_string_to_array_iterator_end(mlx_map_string_to_array_iterator it);
/**
* Returns the key associated to the current iterator position in the map.
*/
mlx_string mlx_map_string_to_array_iterator_key(
mlx_map_string_to_array_iterator it);
/**
* Returns the value associated to the current iterator position in the map.
*/
mlx_array mlx_map_string_to_array_iterator_value(
mlx_map_string_to_array_iterator it);
/**
* A string-to-string map
*/
typedef struct mlx_map_string_to_string_* mlx_map_string_to_string;
/**
* Returns a new empty string-to-string map.
*/
mlx_map_string_to_string mlx_map_string_to_string_new(void);
/**
* Insert a new `value` at the specified `key` in the map.
* Returns `true` if the value was actually inserted.
*/
bool mlx_map_string_to_string_insert(
mlx_map_string_to_string map,
const mlx_string key,
const mlx_string value);
/**
* Returns the value indexed at the specified `key` in the map.
* Returns `NULL` if no value was found for `key`.
*/
mlx_string mlx_map_string_to_string_get(
mlx_map_string_to_string map,
const mlx_string key);
/**
* An iterator over a string-to-string map.
*/
typedef struct mlx_map_string_to_string_iterator_*
mlx_map_string_to_string_iterator;
/**
* Returns a new iterator over the given map.
*/
mlx_map_string_to_string_iterator mlx_map_string_to_string_iterate(
mlx_map_string_to_string map);
/**
* Increment iterator.
* Returns `true` if iterator could actually be incremented.
*/
bool mlx_map_string_to_string_iterator_next(
mlx_map_string_to_string_iterator it);
/**
* Returns `true` iif iterator is at the end of the map.
*/
bool mlx_map_string_to_string_iterator_end(
mlx_map_string_to_string_iterator it);
/**
* Returns the key associated to the current iterator position in the map.
*/
mlx_string mlx_map_string_to_string_iterator_key(
mlx_map_string_to_string_iterator it);
/**
* Returns the value associated to the current iterator position in the map.
*/
mlx_string mlx_map_string_to_string_iterator_value(
mlx_map_string_to_string_iterator it);
/**@}*/
#ifdef __cplusplus
}
#endif
#endif