82 |
82 |
83 CxMap *const cxEmptyMap = &cx_empty_map; |
83 CxMap *const cxEmptyMap = &cx_empty_map; |
84 |
84 |
85 // </editor-fold> |
85 // </editor-fold> |
86 |
86 |
|
87 void cxMapClear(CxMap *map) { |
|
88 map->cl->clear(map); |
|
89 } |
|
90 |
|
91 size_t cxMapSize(const CxMap *map) { |
|
92 return map->collection.size; |
|
93 } |
|
94 |
|
95 CxMapIterator cxMapIteratorValues(const CxMap *map) { |
|
96 if (map == NULL) map = cxEmptyMap; |
|
97 return map->cl->iterator(map, CX_MAP_ITERATOR_VALUES); |
|
98 } |
|
99 |
|
100 CxMapIterator cxMapIteratorKeys(const CxMap *map) { |
|
101 if (map == NULL) map = cxEmptyMap; |
|
102 return map->cl->iterator(map, CX_MAP_ITERATOR_KEYS); |
|
103 } |
|
104 |
|
105 CxMapIterator cxMapIterator(const CxMap *map) { |
|
106 if (map == NULL) map = cxEmptyMap; |
|
107 return map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
|
108 } |
|
109 |
87 CxMapIterator cxMapMutIteratorValues(CxMap *map) { |
110 CxMapIterator cxMapMutIteratorValues(CxMap *map) { |
88 if (map == NULL) map = cxEmptyMap; |
111 if (map == NULL) map = cxEmptyMap; |
89 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_VALUES); |
112 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_VALUES); |
90 it.base.mutating = true; |
113 it.base.mutating = true; |
91 return it; |
114 return it; |
103 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
126 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
104 it.base.mutating = true; |
127 it.base.mutating = true; |
105 return it; |
128 return it; |
106 } |
129 } |
107 |
130 |
|
131 int cx_map_put(CxMap *map, CxHashKey key, void *value) { |
|
132 return map->cl->put(map, key, value) == NULL; |
|
133 } |
|
134 |
|
135 void *cx_map_emplace(CxMap *map, CxHashKey key) { |
|
136 return map->cl->put(map, key, NULL); |
|
137 } |
|
138 |
|
139 void *cx_map_get(const CxMap *map, CxHashKey key) { |
|
140 return map->cl->get(map, key); |
|
141 } |
|
142 |
|
143 int cx_map_remove(CxMap *map, CxHashKey key, void *targetbuf) { |
|
144 return map->cl->remove(map, key, targetbuf); |
|
145 } |
|
146 |
108 void cxMapFree(CxMap *map) { |
147 void cxMapFree(CxMap *map) { |
109 if (map == NULL) return; |
148 if (map == NULL) return; |
110 map->cl->deallocate(map); |
149 map->cl->deallocate(map); |
111 } |
150 } |