|
CVEC v1.0.0-build
Functional C++ vector-like manipulation for C
|
Go to the source code of this file.
Classes | |
| struct | CVEC |
| Custom generic dynamic vector type. More... | |
Functions | |
| int | __cvec_del (CVEC *_vec, void *_elem) |
| Delete first occurrence of matching value. | |
| int | __cvec_delIndex (CVEC *_vec, void *_elem, const size_t start) |
| Delete matching element starting search at index. | |
| int | __cvec_destroySplit (CVEC *_vec) |
| Cleanup after split operations. | |
| int | __cvec_find (const CVEC *_vec, void *_find) |
| Search for an element in the vector. | |
| bool | __cvec_hasEnoughCap (const CVEC *_vec, const size_t _additions) |
| Check whether capacity is sufficient for requested additions. | |
| int | __cvec_push (CVEC *_vec, void *_elem) |
| Insert at end of vector. | |
| int | __cvec_pushFront (CVEC *_vec, void *_elem) |
| Insert new element at beginning. | |
| int | __cvec_pushIndex (CVEC *_vec, const size_t _index, void *_elem) |
| Insert element at specific index, shifting elements as needed. | |
| int | __cvec_set (CVEC *_vec, const size_t _index, void *_set) |
| Replace value at given index. | |
| bool | cvec_at (const CVEC *_vec, const size_t _index) |
| Check whether element exists at index. | |
| bool | cvec_atCap (const CVEC *_vec, const size_t _index) |
| Check whether element exists within vector capacity. | |
| void | cvec_clear (CVEC *_vec) |
| Clear vector contents but keep capacity unchanged. | |
| int | cvec_destroy (CVEC *_vec) |
| Destroy a CVEC, freeing allocated memory and invalidating the structure. | |
| int | cvec_emptyAll (CVEC *_vec) |
| Clear all elements and reset size to zero without freeing memory. | |
| void * | cvec_get (const CVEC *_vec, const size_t _index) |
| Get a pointer to an element at specified index. | |
| CVEC | cvec_init (int _cap, size_t _elemSize) |
| Initialize a new vector with requested capacity and element size. | |
| CVEC | cvec_initCopy (const CVEC *_src) |
| Create a deep copy of an existing CVEC. | |
| int | cvec_merge (CVEC *_toMerge, const CVEC *_input) |
| Merge contents of _input vector into _toMerge. | |
| int | cvec_popBack (CVEC *_vec) |
| Remove the last element. | |
| int | cvec_popFront (CVEC *_vec) |
| Remove the first element, shifting all others left. | |
| int | cvec_remove (CVEC *_vec, const size_t _index) |
| Remove an element at a specific index. | |
| int | cvec_reverse (CVEC *_vec) |
| Reverse the order of elements in place. | |
| int | cvec_shrink (CVEC *_vec) |
| Shrink allocated memory to match current size. | |
| int | cvec_split (CVEC *_vec, char *_str, const char *_del) |
| Split a string by delimiter and store parts inside CVEC. | |
| void | cvec_swap (CVEC *_a, CVEC *_b) |
| Swap two CVEC instances. | |
| int __cvec_del | ( | CVEC * | _vec, |
| void * | _elem ) |
Delete first occurrence of matching value.
| int __cvec_delIndex | ( | CVEC * | _vec, |
| void * | _elem, | ||
| const size_t | start ) |
Delete matching element starting search at index.
| int __cvec_destroySplit | ( | CVEC * | _vec | ) |
Cleanup after split operations.
| int __cvec_find | ( | const CVEC * | _vec, |
| void * | _find ) |
Search for an element in the vector.
| bool __cvec_hasEnoughCap | ( | const CVEC * | _vec, |
| const size_t | _additions ) |
Check whether capacity is sufficient for requested additions.
| int __cvec_push | ( | CVEC * | _vec, |
| void * | _elem ) |
Insert at end of vector.
| _vec | Vector |
| _elem | Pointer to element data to store |
| int __cvec_pushFront | ( | CVEC * | _vec, |
| void * | _elem ) |
Insert new element at beginning.
| int __cvec_pushIndex | ( | CVEC * | _vec, |
| const size_t | _index, | ||
| void * | _elem ) |
Insert element at specific index, shifting elements as needed.
| int __cvec_set | ( | CVEC * | _vec, |
| const size_t | _index, | ||
| void * | _set ) |
Replace value at given index.
| bool cvec_at | ( | const CVEC * | _vec, |
| const size_t | _index ) |
Check whether element exists at index.
| _vec | Vector to inspect |
| _index | Element index |
| bool cvec_atCap | ( | const CVEC * | _vec, |
| const size_t | _index ) |
Check whether element exists within vector capacity.
| _vec | Vector to inspect |
| _index | Index inside original allocated capacity |
| void cvec_clear | ( | CVEC * | _vec | ) |
Clear vector contents but keep capacity unchanged.
| _vec | Pointer to vector |
| int cvec_destroy | ( | CVEC * | _vec | ) |
| int cvec_emptyAll | ( | CVEC * | _vec | ) |
Clear all elements and reset size to zero without freeing memory.
| _vec | Pointer to the vector |
| void * cvec_get | ( | const CVEC * | _vec, |
| const size_t | _index ) |
Get a pointer to an element at specified index.
| _vec | Vector to inspect |
| _index | Position to access |
| CVEC cvec_init | ( | int | _cap, |
| size_t | _elemSize ) |
Initialize a new vector with requested capacity and element size.
| _cap | Initial capacity (number of elements, not bytes) |
| _elemSize | Size in bytes of each element |
Merge contents of _input vector into _toMerge.
Appends all items from _input to _toMerge, expanding capacity if allowed.
| _toMerge | Destination vector to merge into |
| _input | Vector to merge from |
| int cvec_popBack | ( | CVEC * | _vec | ) |
Remove the last element.
| _vec | Vector to modify |
| int cvec_popFront | ( | CVEC * | _vec | ) |
Remove the first element, shifting all others left.
| _vec | Vector to modify |
| int cvec_remove | ( | CVEC * | _vec, |
| const size_t | _index ) |
Remove an element at a specific index.
Shifts trailing elements left by one.
| _vec | Pointer to vector |
| _index | Index to remove |
| int cvec_reverse | ( | CVEC * | _vec | ) |
Reverse the order of elements in place.
| _vec | Pointer to CVEC |
| int cvec_shrink | ( | CVEC * | _vec | ) |
Shrink allocated memory to match current size.
| _vec | Pointer to vector |
| int cvec_split | ( | CVEC * | _vec, |
| char * | _str, | ||
| const char * | _del ) |
Split a string by delimiter and store parts inside CVEC.
Internal __usedSplit tracks cleanup ownership.
| _vec | Destination vector |
| _str | Input string to tokenize |
| _del | Delimiter string |