36
36
* SDynamicArray is an imlpementation of a dynamic array, it is usefule when
37
37
* dealing with lare amounts of data that may change over time, or with an
38
38
* unknowned numebr of items.
40
40
* Note that accsess time is constant, but write time is not guarenteed to be.
42
42
* When the size of the array is equal to the number of elements in it, it will
43
43
* re-allocate the array with a larger size.
65
65
* @param len The length of the initial array.
66
66
* @param free_func The function to be used when freeing the items. Can be NULL.
67
* If free_func is NULL, it will use the standard library's
67
* If free_func is NULL, it will use the standard library's
70
70
* The free function should have the the signature <tt> (DynamicArray * self,
102
102
* Frees the dynamic array.
104
104
* after this is run the data will be lost.
107
s_dynamic_array_free (SDynamicArray * self, sboolean free_data);
107
s_dynamic_array_free (SDynamicArray * self,
111
112
* Get an item from the array.
114
s_dynamic_array_get (SDynamicArray * self, size_t index);
115
s_dynamic_array_get (SDynamicArray * self,
120
s_dynamic_array_set (SDynamicArray * self, size_t index, spointer item);
119
* Set an item at index.
121
* @param self The Dynamic Array to set the item on.
122
* @param index The index at which to set the item.
123
* @para item The item to put in the array.
126
s_dynamic_array_set (SDynamicArray * self,
130
* Append an item to a dynamic array.
131
* @note The item will not be added to the first free slot in the array, but
132
* in the first slot after the last item.
134
* @param self The dynamic array to add the item to.
135
* @param item The item to add.
138
s_dynamic_array_append (SDynamicArray * self,
123
142
* Get the size of the array, this is not the same as the length of the array.
124
143
* The size is the number of elements that can be allocated without resizing
127
146
* To get the length of the array use s_dynamic_array_len ().
182
201
s_dynamic_array_serialize_json (SDynamicArray * self);
185
* appends itmes to an the array
204
* appends itmes to an the array
187
206
* If the from_json function is not set, this will couse undefined behaviour.