111 |
111 |
112 /** |
112 /** |
113 * Iterator over the key/value pairs. |
113 * Iterator over the key/value pairs. |
114 */ |
114 */ |
115 __attribute__((__nonnull__, __warn_unused_result__)) |
115 __attribute__((__nonnull__, __warn_unused_result__)) |
116 CxIterator (*iterator)(CxMap const *map); |
116 CxIterator (*iterator)(CxMap *map); |
117 |
117 |
118 /** |
118 /** |
119 * Iterator over the keys. |
119 * Iterator over the keys. |
120 */ |
120 */ |
121 __attribute__((__nonnull__, __warn_unused_result__)) |
121 __attribute__((__nonnull__, __warn_unused_result__)) |
122 CxIterator (*iterator_keys)(CxMap const *map); |
122 CxIterator (*iterator_keys)(CxMap *map); |
123 |
123 |
124 /** |
124 /** |
125 * Iterator over the values. |
125 * Iterator over the values. |
126 */ |
126 */ |
127 __attribute__((__nonnull__, __warn_unused_result__)) |
127 __attribute__((__nonnull__, __warn_unused_result__)) |
128 CxIterator (*iterator_values)(CxMap const *map); |
128 CxIterator (*iterator_values)(CxMap *map); |
129 }; |
129 }; |
130 |
130 |
131 /** |
131 /** |
132 * A map entry. |
132 * A map entry. |
133 */ |
133 */ |
134 struct cx_map_entry_s { |
134 struct cx_map_entry_s { |
135 /** |
135 /** |
136 * The key. |
136 * A pointer to the key. |
137 */ |
137 */ |
138 CxDataPtr key; |
138 CxDataPtr const *key; |
139 /** |
139 /** |
140 * The value. |
140 * A pointer to the value. |
141 */ |
141 */ |
142 void const *value; |
142 void *value; |
143 }; |
143 }; |
144 |
144 |
145 |
145 |
146 /** |
146 /** |
147 * Deallocates the memory of the specified map. |
147 * Deallocates the memory of the specified map. |
222 * |
222 * |
223 * @param map the map to create the iterator for |
223 * @param map the map to create the iterator for |
224 * @return an iterator for the currently stored values |
224 * @return an iterator for the currently stored values |
225 */ |
225 */ |
226 __attribute__((__nonnull__, __warn_unused_result__)) |
226 __attribute__((__nonnull__, __warn_unused_result__)) |
227 static inline CxIterator cxMapIteratorValues(CxMap const *map) { |
227 static inline CxIterator cxMapIteratorValues(CxMap *map) { |
228 return map->cl->iterator_values(map); |
228 return map->cl->iterator_values(map); |
229 } |
229 } |
230 |
230 |
231 /** |
231 /** |
232 * Creates a key iterator for a map. |
232 * Creates a key iterator for a map. |
236 * |
236 * |
237 * @param map the map to create the iterator for |
237 * @param map the map to create the iterator for |
238 * @return an iterator for the currently stored keys |
238 * @return an iterator for the currently stored keys |
239 */ |
239 */ |
240 __attribute__((__nonnull__, __warn_unused_result__)) |
240 __attribute__((__nonnull__, __warn_unused_result__)) |
241 static inline CxIterator cxMapIteratorKeys(CxMap const *map) { |
241 static inline CxIterator cxMapIteratorKeys(CxMap *map) { |
242 return map->cl->iterator_keys(map); |
242 return map->cl->iterator_keys(map); |
243 } |
243 } |
244 |
244 |
245 /** |
245 /** |
246 * Creates an iterator for a map. |
246 * Creates an iterator for a map. |
254 * @return an iterator for the currently stored keys |
254 * @return an iterator for the currently stored keys |
255 * @see cxMapIteratorKeys() |
255 * @see cxMapIteratorKeys() |
256 * @see cxMapIteratorValues() |
256 * @see cxMapIteratorValues() |
257 */ |
257 */ |
258 __attribute__((__nonnull__, __warn_unused_result__)) |
258 __attribute__((__nonnull__, __warn_unused_result__)) |
259 static inline CxIterator cxMapIterator(CxMap const *map) { |
259 static inline CxIterator cxMapIterator(CxMap *map) { |
260 return map->cl->iterator(map); |
260 return map->cl->iterator(map); |
261 } |
261 } |
262 |
262 |
263 |
263 |
264 #ifdef __cplusplus |
264 #ifdef __cplusplus |