#include "cx/map.h"
#include <string.h>
static void cx_empty_map_noop(__attribute__((__unused__)) CxMap *map) {
}
static void *cx_empty_map_get(
__attribute__((__unused__))
const CxMap *map,
__attribute__((__unused__)) CxHashKey key
) {
return NULL;
}
static bool cx_empty_map_iter_valid(__attribute__((__unused__))
const void *iter) {
return false;
}
static CxIterator cx_empty_map_iterator(
const struct cx_map_s *map,
__attribute__((__unused__))
enum cx_map_iterator_type type
) {
CxIterator iter = {
0};
iter.src_handle.c = map;
iter.base.valid = cx_empty_map_iter_valid;
return iter;
}
static struct cx_map_class_s cx_empty_map_class = {
cx_empty_map_noop,
cx_empty_map_noop,
NULL,
cx_empty_map_get,
NULL,
cx_empty_map_iterator
};
CxMap cx_empty_map = {
{
NULL,
NULL,
0,
0,
NULL,
NULL,
NULL,
false
},
&cx_empty_map_class
};
CxMap *
const cxEmptyMap = &cx_empty_map;
CxIterator cxMapMutIteratorValues(CxMap *map) {
CxIterator it = map->cl->iterator(map,
CX_MAP_ITERATOR_VALUES);
it.base.mutating = true;
return it;
}
CxIterator cxMapMutIteratorKeys(CxMap *map) {
CxIterator it = map->cl->iterator(map,
CX_MAP_ITERATOR_KEYS);
it.base.mutating = true;
return it;
}
CxIterator cxMapMutIterator(CxMap *map) {
CxIterator it = map->cl->iterator(map,
CX_MAP_ITERATOR_PAIRS);
it.base.mutating = true;
return it;
}