49 static CxMapIterator cx_empty_map_iterator( |
49 static CxMapIterator cx_empty_map_iterator( |
50 const struct cx_map_s *map, |
50 const struct cx_map_s *map, |
51 cx_attr_unused enum cx_map_iterator_type type |
51 cx_attr_unused enum cx_map_iterator_type type |
52 ) { |
52 ) { |
53 CxMapIterator iter = {0}; |
53 CxMapIterator iter = {0}; |
54 iter.map.c = map; |
54 iter.map = (CxMap*) map; |
55 iter.base.valid = cx_empty_map_iter_valid; |
55 iter.base.valid = cx_empty_map_iter_valid; |
56 return iter; |
56 return iter; |
57 } |
57 } |
58 |
58 |
59 static struct cx_map_class_s cx_empty_map_class = { |
59 static struct cx_map_class_s cx_empty_map_class = { |
105 CxMapIterator cxMapIterator(const CxMap *map) { |
105 CxMapIterator cxMapIterator(const CxMap *map) { |
106 if (map == NULL) map = cxEmptyMap; |
106 if (map == NULL) map = cxEmptyMap; |
107 return map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
107 return map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
108 } |
108 } |
109 |
109 |
110 CxMapIterator cxMapMutIteratorValues(CxMap *map) { |
|
111 if (map == NULL) map = cxEmptyMap; |
|
112 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_VALUES); |
|
113 it.base.mutating = true; |
|
114 return it; |
|
115 } |
|
116 |
|
117 CxMapIterator cxMapMutIteratorKeys(CxMap *map) { |
|
118 if (map == NULL) map = cxEmptyMap; |
|
119 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_KEYS); |
|
120 it.base.mutating = true; |
|
121 return it; |
|
122 } |
|
123 |
|
124 CxMapIterator cxMapMutIterator(CxMap *map) { |
|
125 if (map == NULL) map = cxEmptyMap; |
|
126 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
|
127 it.base.mutating = true; |
|
128 return it; |
|
129 } |
|
130 |
|
131 int cx_map_put(CxMap *map, CxHashKey key, void *value) { |
110 int cx_map_put(CxMap *map, CxHashKey key, void *value) { |
132 return map->cl->put(map, key, value) == NULL; |
111 return map->cl->put(map, key, value) == NULL; |
133 } |
112 } |
134 |
113 |
135 void *cx_map_emplace(CxMap *map, CxHashKey key) { |
114 void *cx_map_emplace(CxMap *map, CxHashKey key) { |