|
libcmutils 0.6.5
Multi-platform C99 utility library
|
Data Structures | |
| struct | CMUTIL_Iterator |
| Iterator of collection members. More... | |
| struct | CMUTIL_Array |
| Dynamic array of any type element. More... | |
| struct | CMUTIL_MapPair |
| Key-value pair for CMUTIL_Map. More... | |
| struct | CMUTIL_Map |
| Hashmap type with item order preserved. More... | |
| struct | CMUTIL_List |
| A doubly linked list type. More... | |
Macros | |
| #define | CMUTIL_ARRAY_DEFAULT 10 |
| #define | CMUTIL_ArrayCreate() CMUTIL_ArrayCreateEx(CMUTIL_ARRAY_DEFAULT, NULL, NULL) |
| Creates an unsorted dynamic array. | |
| #define | CMUTIL_MAP_DEFAULT 256 |
| #define | CMUTIL_MapCreate() |
| #define | CMUTIL_ListCreate() CMUTIL_ListCreateEx(NULL) |
| Create a new list with default settings. | |
Functions | |
| CMUTIL_Array * | CMUTIL_ArrayCreateEx (size_t initcapacity, CMCompareCB comparator, CMFreeCB freecb) |
| Creates a dynamic array with capacity and optional comparator and free callback. | |
| CMUTIL_Map * | CMUTIL_MapCreateEx (uint32_t bucketsize, CMBool isucase, CMFreeCB freecb, float load_factor) |
| Create a new map with custom settings. | |
| CMUTIL_List * | CMUTIL_ListCreateEx (CMFreeCB freecb) |
| Create a new list with a custom free callback. | |
| #define CMUTIL_ARRAY_DEFAULT 10 |
Default initial capacity of a dynamic array.
| #define CMUTIL_ArrayCreate | ( | ) | CMUTIL_ArrayCreateEx(CMUTIL_ARRAY_DEFAULT, NULL, NULL) |
Creates an unsorted dynamic array.
| #define CMUTIL_MAP_DEFAULT 256 |
The default initial bucket size for the map.
| #define CMUTIL_MapCreate | ( | ) |
Create a new map with default settings.
| #define CMUTIL_ListCreate | ( | ) | CMUTIL_ListCreateEx(NULL) |
Create a new list with default settings.
This macro creates a new CMUTIL_List object without a custom free callback.
| CMUTIL_Array * CMUTIL_ArrayCreateEx | ( | size_t | initcapacity, |
| CMCompareCB | comparator, | ||
| CMFreeCB | freecb | ||
| ) |
Creates a dynamic array with capacity and optional comparator and free callback.
| initcapacity | Initial capacity of this array. |
| comparator | Comparator callback for a sorted array. You must provide this callback if you want to create a sorted array. |
| freecb | Free callback for each item in this array, if this parameter is supplied, this array will take the ownership of its items. |
| CMUTIL_Map * CMUTIL_MapCreateEx | ( | uint32_t | bucketsize, |
| CMBool | isucase, | ||
| CMFreeCB | freecb, | ||
| float | load_factor | ||
| ) |
Create a new map with custom settings.
| bucketsize | The initial number of buckets for the map. |
| isucase | Whether the key of the map should be case-insensitive. |
| freecb | A callback function to free values when the map is destroyed. |
| load_factor | The load factor for the map, 0.75 may appropriate for most use cases. |
| CMUTIL_List * CMUTIL_ListCreateEx | ( | CMFreeCB | freecb | ) |
Create a new list with a custom free callback.
This function creates a new CMUTIL_List object with a specified callback function to free items when the list is destroyed.
| freecb | A callback function to free items when the list is destroyed. If NULL, items will not be freed. |