Typedefs | |
typedef cx_tree | cx_map |
The map datatype. | |
typedef cx_tree_iterator | cx_map_iterator |
The map iterator datatype. | |
typedef cx_tree_const_iterator | cx_map_const_iterator |
The map constant iterator datatype. | |
typedef cx_tree_compare_func | cx_map_compare_func |
The map's key comparison operator function. | |
Functions | |
cx_map_iterator | cx_map_begin (const cx_map *map) |
Get an iterator to the first pair in a map. | |
cx_map_iterator | cx_map_end (const cx_map *map) |
Get an iterator for the position after the last pair in the map. | |
cx_map_iterator | cx_map_next (const cx_map *map, cx_map_const_iterator position) |
Get an iterator for the next pair in the map. | |
cx_map_iterator | cx_map_previous (const cx_map *map, cx_map_const_iterator position) |
Get an iterator for the previous pair in the map. | |
void | cx_map_clear (cx_map *map) |
Remove all pairs from a map. | |
cxbool | cx_map_empty (const cx_map *map) |
Check whether a map is empty. | |
cx_map * | cx_map_new (cx_map_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy) |
Create a new map without any elements. | |
void | cx_map_delete (cx_map *map) |
Destroy a map and all its elements. | |
cxsize | cx_map_size (const cx_map *map) |
Get the actual number of pairs in the map. | |
cxsize | cx_map_max_size (const cx_map *map) |
Get the maximum number of pairs possible. | |
cx_map_compare_func | cx_map_key_comp (const cx_map *map) |
Retrieve a map's key comparison function. | |
void | cx_map_swap (cx_map *map1, cx_map *map2) |
Swap the contents of two maps. | |
cxptr | cx_map_assign (cx_map *map, cx_map_iterator position, cxcptr data) |
Assign data to an iterator position. | |
cxptr | cx_map_put (cx_map *map, cxcptr key, cxcptr data) |
Set the value of a pair matching the given key. | |
cxptr | cx_map_get_key (const cx_map *map, cx_map_const_iterator position) |
Get the key from a given iterator position. | |
cxptr | cx_map_get_value (const cx_map *map, cx_map_const_iterator position) |
Get the data from a given iterator position. | |
cxptr | cx_map_get (cx_map *map, cxcptr key) |
Get the data for a given key. | |
cx_map_iterator | cx_map_find (const cx_map *map, cxcptr key) |
Locate an element in the map. | |
cx_map_iterator | cx_map_lower_bound (const cx_map *map, cxcptr key) |
Find the beginning of a subsequence matching a given key. | |
cx_map_iterator | cx_map_upper_bound (const cx_map *map, cxcptr key) |
Find the end of a subsequence matching a given key. | |
void | cx_map_equal_range (const cx_map *map, cxcptr key, cx_map_iterator *begin, cx_map_iterator *end) |
Find a subsequence matching a given key. | |
cxsize | cx_map_count (const cx_map *map, cxcptr key) |
Get the number of elements matching a key. | |
cx_map_iterator | cx_map_insert (cx_map *map, cxcptr key, cxcptr data) |
Attempt to insert data into a map. | |
void | cx_map_erase_position (cx_map *map, cx_map_iterator position) |
Erase an element from a map. | |
void | cx_map_erase_range (cx_map *map, cx_map_iterator begin, cx_map_iterator end) |
Erase a range of elements from a map. | |
cxsize | cx_map_erase (cx_map *map, cxcptr key) |
Erase an element from a map according to the provided key. |
#include <cxmap.h>
|
The map datatype. The internal representation of a map is a balanced binary tree. For this reason cx_map is just an alias for cx_tree. |
|
The map's key comparison operator function.
This type of function is used internally by a map when key comparisons are necessary. It must return
|
|
The map constant iterator datatype. The map constant iterator is just an alias for the cx_tree_const_iterator datatype. |
|
The map iterator datatype. The map iterator is just an alias for the cx_tree_iterator datatype. |
|
Assign data to an iterator position.
|
|
Get an iterator to the first pair in a map.
|
|
Remove all pairs from a map.
|
|
Get the number of elements matching a key.
|
|
Destroy a map and all its elements.
|
|
Check whether a map is empty.
return (cx_map_size(map) == 0); |
|
Get an iterator for the position after the last pair in the map.
|
|
Find a subsequence matching a given key.
|
|
Erase an element from a map according to the provided key.
|
|
Erase an element from a map.
|
|
Erase a range of elements from a map.
|
|
Locate an element in the map.
|
|
Get the data for a given key.
NULL as the associated default value, which is then returned. |
|
Get the key from a given iterator position.
|
|
Get the data from a given iterator position.
|
|
Attempt to insert data into a map.
|
|
Retrieve a map's key comparison function.
|
|
Find the beginning of a subsequence matching a given key.
|
|
Get the maximum number of pairs possible.
|
|
Create a new map without any elements.
The map's key comparison function is set to compare. It must return
The destructors for a map node's key and value field are set to key_destroy and value_destroy. Whenever a map node is destroyed these functions are used to deallocate the memory used by the key and the value. Each of the destructors might be
|
|
Get an iterator for the next pair in the map.
|
|
Get an iterator for the previous pair in the map.
|
|
Set the value of a pair matching the given key.
|
|
Get the actual number of pairs in the map.
|
|
Swap the contents of two maps.
|
|
Find the end of a subsequence matching a given key.
|