44 |
44 |
45 static bool cx_empty_map_iter_valid(cx_attr_unused const void *iter) { |
45 static bool cx_empty_map_iter_valid(cx_attr_unused const void *iter) { |
46 return false; |
46 return false; |
47 } |
47 } |
48 |
48 |
49 static CxIterator 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 CxIterator iter = {0}; |
53 CxMapIterator iter = {0}; |
54 iter.src_handle.c = map; |
54 iter.map.c = 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 = { |
64 NULL, |
64 NULL, |
65 cx_empty_map_iterator |
65 cx_empty_map_iterator |
66 }; |
66 }; |
67 |
67 |
68 CxMap cx_empty_map = { |
68 CxMap cx_empty_map = { |
69 { |
69 { |
70 NULL, |
70 NULL, |
71 NULL, |
71 NULL, |
72 0, |
72 0, |
73 0, |
73 0, |
74 NULL, |
74 NULL, |
75 NULL, |
75 NULL, |
76 NULL, |
76 NULL, |
77 false |
77 false, |
78 }, |
78 true |
79 &cx_empty_map_class |
79 }, |
|
80 &cx_empty_map_class |
80 }; |
81 }; |
81 |
82 |
82 CxMap *const cxEmptyMap = &cx_empty_map; |
83 CxMap *const cxEmptyMap = &cx_empty_map; |
83 |
84 |
84 // </editor-fold> |
85 // </editor-fold> |
85 |
86 |
86 CxIterator cxMapMutIteratorValues(CxMap *map) { |
87 CxMapIterator cxMapMutIteratorValues(CxMap *map) { |
87 CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_VALUES); |
88 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_VALUES); |
88 it.base.mutating = true; |
89 it.base.mutating = true; |
89 return it; |
90 return it; |
90 } |
91 } |
91 |
92 |
92 CxIterator cxMapMutIteratorKeys(CxMap *map) { |
93 CxMapIterator cxMapMutIteratorKeys(CxMap *map) { |
93 CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_KEYS); |
94 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_KEYS); |
94 it.base.mutating = true; |
95 it.base.mutating = true; |
95 return it; |
96 return it; |
96 } |
97 } |
97 |
98 |
98 CxIterator cxMapMutIterator(CxMap *map) { |
99 CxMapIterator cxMapMutIterator(CxMap *map) { |
99 CxIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
100 CxMapIterator it = map->cl->iterator(map, CX_MAP_ITERATOR_PAIRS); |
100 it.base.mutating = true; |
101 it.base.mutating = true; |
101 return it; |
102 return it; |
102 } |
103 } |
103 |
104 |
104 void cxMapFree(CxMap *map) { |
105 void cxMapFree(CxMap *map) { |