Thu, 18 Dec 2025 17:50:15 +0100
update ucx
| 174 | 1 | /* |
| 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
| 3 | * | |
| 4 | * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions are met: | |
| 8 | * | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
| 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 26 | * POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | /** | |
| 440 | 29 | * @file list.h |
| 30 | * @brief Interface for list implementations. | |
| 31 | * @author Mike Becker | |
| 32 | * @author Olaf Wintermann | |
| 33 | * @copyright 2-Clause BSD License | |
| 174 | 34 | */ |
| 35 | ||
| 36 | #ifndef UCX_LIST_H | |
| 37 | #define UCX_LIST_H | |
| 38 | ||
| 39 | #include "common.h" | |
| 40 | #include "collection.h" | |
| 41 | ||
| 42 | #ifdef __cplusplus | |
| 43 | extern "C" { | |
| 44 | #endif | |
| 45 | ||
| 46 | /** | |
| 47 | * List class type. | |
| 48 | */ | |
| 49 | typedef struct cx_list_class_s cx_list_class; | |
| 50 | ||
| 51 | /** | |
| 52 | * Structure for holding the base data of a list. | |
| 53 | */ | |
| 54 | struct cx_list_s { | |
| 440 | 55 | /** |
| 56 | * Common members for collections. | |
| 57 | */ | |
| 324 | 58 | CX_COLLECTION_BASE; |
| 174 | 59 | /** |
| 60 | * The list class definition. | |
| 61 | */ | |
| 324 | 62 | const cx_list_class *cl; |
| 174 | 63 | }; |
| 64 | ||
| 65 | /** | |
| 66 | * The class definition for arbitrary lists. | |
| 67 | */ | |
| 68 | struct cx_list_class_s { | |
| 69 | /** | |
| 70 | * Destructor function. | |
| 71 | * | |
| 72 | * Implementations SHALL invoke the content destructor functions if provided | |
| 440 | 73 | * and SHALL deallocate the entire list memory. |
| 174 | 74 | */ |
| 440 | 75 | void (*deallocate)(struct cx_list_s *list); |
| 174 | 76 | |
| 77 | /** | |
|
187
24ce2c326d85
implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
78 | * Member function for inserting a single element. |
| 845 | 79 | * The data pointer may be @c NULL, in which case the function shall only allocate memory. |
| 80 | * Returns a pointer to the allocated memory or @c NULL if allocation fails. | |
| 174 | 81 | */ |
| 870 | 82 | void *(*insert_element)(struct cx_list_s *list, size_t index, const void *data); |
| 174 | 83 | |
| 84 | /** | |
| 85 | * Member function for inserting multiple elements. | |
| 440 | 86 | * |
| 870 | 87 | * The data pointer may be @c NULL, in which case the function shall only allocate memory. |
| 88 | * Returns the number of successfully inserted or allocated elements. | |
| 89 | * | |
| 324 | 90 | * @see cx_list_default_insert_array() |
| 174 | 91 | */ |
| 870 | 92 | size_t (*insert_array)(struct cx_list_s *list, size_t index, const void *data, size_t n); |
| 324 | 93 | |
| 94 | /** | |
| 95 | * Member function for inserting sorted elements into a sorted list. | |
| 870 | 96 | * Returns the number of successfully inserted elements. |
| 324 | 97 | * |
| 98 | * @see cx_list_default_insert_sorted() | |
| 99 | */ | |
| 870 | 100 | size_t (*insert_sorted)(struct cx_list_s *list, const void *sorted_data, size_t n); |
| 174 | 101 | |
| 102 | /** | |
| 845 | 103 | * Member function for inserting multiple elements if they do not exist. |
| 870 | 104 | * Implementations shall return the number of successfully processed elements |
| 105 | * (including those which were not added because they are already contained). | |
| 845 | 106 | * @see cx_list_default_insert_unique() |
| 107 | */ | |
| 870 | 108 | size_t (*insert_unique)(struct cx_list_s *list, const void *sorted_data, size_t n); |
| 845 | 109 | |
| 110 | /** | |
| 174 | 111 | * Member function for inserting an element relative to an iterator position. |
| 112 | */ | |
| 870 | 113 | int (*insert_iter)(struct cx_iterator_s *iter, const void *elem, int prepend); |
| 174 | 114 | |
| 115 | /** | |
| 440 | 116 | * Member function for removing elements. |
| 117 | * | |
| 118 | * Implementations SHALL check if @p targetbuf is set and copy the elements | |
| 119 | * to the buffer without invoking any destructor. | |
| 120 | * When @p targetbuf is not set, the destructors SHALL be invoked. | |
| 121 | * | |
| 122 | * The function SHALL return the actual number of elements removed, which | |
| 123 | * might be lower than @p num when going out of bounds. | |
| 174 | 124 | */ |
| 870 | 125 | size_t (*remove)(struct cx_list_s *list, size_t index, size_t num, void *targetbuf); |
| 174 | 126 | |
| 127 | /** | |
| 128 | * Member function for removing all elements. | |
| 129 | */ | |
| 130 | void (*clear)(struct cx_list_s *list); | |
| 131 | ||
| 132 | /** | |
| 133 | * Member function for swapping two elements. | |
| 440 | 134 | * |
| 324 | 135 | * @see cx_list_default_swap() |
| 174 | 136 | */ |
| 870 | 137 | int (*swap)(struct cx_list_s *list, size_t i, size_t j); |
| 174 | 138 | |
| 139 | /** | |
| 140 | * Member function for element lookup. | |
| 141 | */ | |
| 870 | 142 | void *(*at)(const struct cx_list_s *list, size_t index); |
| 174 | 143 | |
| 144 | /** | |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
145 | * Member function for finding and optionally removing an element. |
| 174 | 146 | */ |
| 870 | 147 | size_t (*find_remove)(struct cx_list_s *list, const void *elem, bool remove); |
| 174 | 148 | |
| 149 | /** | |
| 440 | 150 | * Member function for sorting the list. |
| 151 | * | |
| 324 | 152 | * @see cx_list_default_sort() |
| 174 | 153 | */ |
| 154 | void (*sort)(struct cx_list_s *list); | |
| 155 | ||
| 156 | /** | |
| 324 | 157 | * Optional member function for comparing this list |
| 158 | * to another list of the same type. | |
| 845 | 159 | * If set to @c NULL, the comparison won't be optimized. |
| 174 | 160 | */ |
| 870 | 161 | int (*compare)(const struct cx_list_s *list, const struct cx_list_s *other); |
| 174 | 162 | |
| 163 | /** | |
| 164 | * Member function for reversing the order of the items. | |
| 165 | */ | |
| 166 | void (*reverse)(struct cx_list_s *list); | |
| 167 | ||
| 168 | /** | |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
169 | * Optional member function for changing the capacity. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
170 | * If the list does not support overallocation, this can be set to @c NULL. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
171 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
172 | int (*change_capacity)(struct cx_list_s *list, size_t new_capacity); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
173 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
174 | /** |
| 174 | 175 | * Member function for returning an iterator pointing to the specified index. |
| 176 | */ | |
| 870 | 177 | struct cx_iterator_s (*iterator)(const struct cx_list_s *list, size_t index, bool backward); |
| 174 | 178 | }; |
| 179 | ||
| 180 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
181 | * Common type for all list implementations. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
182 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
183 | typedef struct cx_list_s CxList; |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
184 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
185 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
186 | * A shared instance of an empty list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
187 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
188 | * Writing to that list is not allowed. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
189 | * |
| 845 | 190 | * You can use this as a placeholder for initializing CxList pointers |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
191 | * for which you do not want to reserve memory right from the beginning. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
192 | */ |
| 870 | 193 | CX_EXPORT extern CxList *const cxEmptyList; |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
194 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
195 | /** |
| 324 | 196 | * Default implementation of an array insert. |
| 197 | * | |
| 198 | * This function uses the element insert function for each element of the array. | |
| 199 | * | |
| 200 | * Use this in your own list class if you do not want to implement an optimized | |
| 201 | * version for your list. | |
| 202 | * | |
| 203 | * @param list the list | |
| 204 | * @param index the index where to insert the data | |
| 205 | * @param data a pointer to the array of data to insert | |
| 206 | * @param n the number of elements to insert | |
| 207 | * @return the number of elements actually inserted | |
| 208 | */ | |
| 440 | 209 | cx_attr_nonnull |
| 870 | 210 | CX_EXPORT size_t cx_list_default_insert_array(struct cx_list_s *list, |
| 211 | size_t index, const void *data, size_t n); | |
| 324 | 212 | |
| 213 | /** | |
| 214 | * Default implementation of a sorted insert. | |
| 215 | * | |
| 216 | * This function uses the array insert function to insert consecutive groups | |
| 217 | * of sorted data. | |
| 218 | * | |
| 440 | 219 | * The source data @em must already be sorted wrt. the list's compare function. |
| 324 | 220 | * |
| 221 | * Use this in your own list class if you do not want to implement an optimized | |
| 222 | * version for your list. | |
| 223 | * | |
| 224 | * @param list the list | |
| 225 | * @param sorted_data a pointer to the array of pre-sorted data to insert | |
| 226 | * @param n the number of elements to insert | |
| 227 | * @return the number of elements actually inserted | |
| 228 | */ | |
| 440 | 229 | cx_attr_nonnull |
| 870 | 230 | CX_EXPORT size_t cx_list_default_insert_sorted(struct cx_list_s *list, |
| 231 | const void *sorted_data, size_t n); | |
| 324 | 232 | |
| 233 | /** | |
| 845 | 234 | * Default implementation of an array insert where only elements are inserted when they don't exist in the list. |
| 235 | * | |
| 236 | * This function is similar to cx_list_default_insert_sorted(), except it skips elements that are already in the list. | |
| 237 | * | |
| 238 | * @note The return value of this function denotes the number of elements from the @p sorted_data that are definitely | |
| 239 | * contained in the list after completing the call. It is @em not the number of elements that were newly inserted. | |
| 240 | * That means, when no error occurred, the return value should be @p n. | |
| 241 | * | |
| 242 | * Use this in your own list class if you do not want to implement an optimized version for your list. | |
| 243 | * | |
| 244 | * @param list the list | |
| 245 | * @param sorted_data a pointer to the array of pre-sorted data to insert | |
| 246 | * @param n the number of elements to insert | |
| 247 | * @return the number of elements from the @p sorted_data that are definitely present in the list after this call | |
| 248 | */ | |
| 249 | cx_attr_nonnull | |
| 870 | 250 | CX_EXPORT size_t cx_list_default_insert_unique(struct cx_list_s *list, |
| 251 | const void *sorted_data, size_t n); | |
| 845 | 252 | |
| 253 | /** | |
| 324 | 254 | * Default unoptimized sort implementation. |
| 255 | * | |
| 256 | * This function will copy all data to an array, sort the array with standard | |
| 257 | * qsort, and then copy the data back to the list memory. | |
| 258 | * | |
| 259 | * Use this in your own list class if you do not want to implement an optimized | |
| 260 | * version for your list. | |
| 261 | * | |
| 262 | * @param list the list that shall be sorted | |
| 263 | */ | |
| 440 | 264 | cx_attr_nonnull |
| 870 | 265 | CX_EXPORT void cx_list_default_sort(struct cx_list_s *list); |
| 324 | 266 | |
| 267 | /** | |
| 268 | * Default unoptimized swap implementation. | |
| 269 | * | |
| 270 | * Use this in your own list class if you do not want to implement an optimized | |
| 271 | * version for your list. | |
| 272 | * | |
| 273 | * @param list the list in which to swap | |
| 274 | * @param i index of one element | |
| 275 | * @param j index of the other element | |
| 440 | 276 | * @retval zero success |
| 277 | * @retval non-zero when indices are out of bounds or memory | |
| 324 | 278 | * allocation for the temporary buffer fails |
| 279 | */ | |
| 440 | 280 | cx_attr_nonnull |
| 870 | 281 | CX_EXPORT int cx_list_default_swap(struct cx_list_s *list, size_t i, size_t j); |
| 324 | 282 | |
| 283 | /** | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
284 | * Initializes a list struct. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
285 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
286 | * Only use this function if you are creating your own list implementation. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
287 | * The purpose of this function is to be called in the initialization code |
| 845 | 288 | * of your list to set certain members correctly. |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
289 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
290 | * This is particularly important when you want your list to support |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
291 | * #CX_STORE_POINTERS as @p elem_size. This function will wrap the list |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
292 | * class accordingly and make sure that you can implement your list as if |
| 845 | 293 | * it was only storing objects, and the wrapper will automatically enable |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
294 | * the feature of storing pointers. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
295 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
296 | * @par Example |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
297 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
298 | * @code |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
299 | * CxList *myCustomListCreate( |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
300 | * const CxAllocator *allocator, |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
301 | * size_t elem_size |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
302 | * ) { |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
303 | * if (allocator == NULL) { |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
304 | * allocator = cxDefaultAllocator; |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
305 | * } |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
306 | * |
| 1016 | 307 | * MyCustomList *list = cxZalloc(allocator, sizeof(MyCustomList)); |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
308 | * if (list == NULL) return NULL; |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
309 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
310 | * // initialize |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
311 | * cx_list_init((CxList*)list, &my_custom_list_class, |
| 1016 | 312 | * allocator, elem_size); |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
313 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
314 | * // ... some more custom stuff ... |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
315 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
316 | * return (CxList *) list; |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
317 | * } |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
318 | * @endcode |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
319 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
320 | * @param list the list to initialize |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
321 | * @param cl the list class |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
322 | * @param allocator the allocator for the elements |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
323 | * @param elem_size the size of one element |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
324 | */ |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
325 | cx_attr_nonnull_arg(1, 2, 3) |
| 870 | 326 | CX_EXPORT void cx_list_init(struct cx_list_s *list, |
| 327 | struct cx_list_class_s *cl, const struct cx_allocator_s *allocator, | |
| 1016 | 328 | size_t elem_size); |
| 329 | ||
| 330 | /** | |
| 331 | * A @c cx_compare_func2 compatible wrapper for the compare functions of a list. | |
| 332 | * | |
| 333 | * @param left first element | |
| 334 | * @param right second element | |
| 335 | * @param list the list which is comparing the elements | |
| 336 | * @return the comparison result | |
| 337 | */ | |
| 338 | cx_attr_nonnull | |
| 339 | CX_EXPORT int cx_list_compare_wrapper( | |
| 340 | const void *left, const void *right, void *list); | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
341 | |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
342 | /** |
| 174 | 343 | * Returns the number of elements currently stored in the list. |
| 344 | * | |
| 345 | * @param list the list | |
| 346 | * @return the number of currently stored elements | |
| 347 | */ | |
| 440 | 348 | cx_attr_nonnull |
| 870 | 349 | CX_EXPORT size_t cxListSize(const CxList *list); |
| 174 | 350 | |
| 351 | /** | |
| 352 | * Adds an item to the end of the list. | |
| 353 | * | |
| 354 | * @param list the list | |
| 355 | * @param elem a pointer to the element to add | |
| 440 | 356 | * @retval zero success |
| 357 | * @retval non-zero memory allocation failure | |
| 174 | 358 | * @see cxListAddArray() |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
359 | * @see cxListEmplace() |
| 174 | 360 | */ |
| 440 | 361 | cx_attr_nonnull |
| 870 | 362 | CX_EXPORT int cxListAdd(CxList *list, const void *elem); |
| 174 | 363 | |
| 364 | /** | |
| 365 | * Adds multiple items to the end of the list. | |
| 366 | * | |
| 367 | * This method is more efficient than invoking cxListAdd() multiple times. | |
| 368 | * | |
| 369 | * If there is not enough memory to add all elements, the returned value is | |
| 440 | 370 | * less than @p n. |
| 174 | 371 | * |
| 845 | 372 | * If this list is storing pointers instead of objects, @p array is expected to |
| 174 | 373 | * be an array of pointers. |
| 374 | * | |
| 375 | * @param list the list | |
| 376 | * @param array a pointer to the elements to add | |
| 377 | * @param n the number of elements to add | |
| 378 | * @return the number of added elements | |
| 870 | 379 | * @see cxListEmplaceArray() |
| 174 | 380 | */ |
| 440 | 381 | cx_attr_nonnull |
| 870 | 382 | CX_EXPORT size_t cxListAddArray(CxList *list, const void *array, size_t n); |
| 174 | 383 | |
| 384 | /** | |
| 385 | * Inserts an item at the specified index. | |
| 386 | * | |
| 845 | 387 | * If the @p index equals the list @c size, this is effectively cxListAdd(). |
| 174 | 388 | * |
| 389 | * @param list the list | |
| 390 | * @param index the index the element shall have | |
| 391 | * @param elem a pointer to the element to add | |
| 440 | 392 | * @retval zero success |
| 393 | * @retval non-zero memory allocation failure or the index is out of bounds | |
| 174 | 394 | * @see cxListInsertAfter() |
| 395 | * @see cxListInsertBefore() | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
396 | * @see cxListEmplaceAt() |
| 174 | 397 | */ |
| 440 | 398 | cx_attr_nonnull |
| 870 | 399 | CX_EXPORT int cxListInsert(CxList *list, size_t index, const void *elem); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
400 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
401 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
402 | * Allocates memory for an element at the specified index and returns a pointer to that memory. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
403 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
404 | * @remark When the list is storing pointers, this will return a @c void**. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
405 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
406 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
407 | * @param index the index where to emplace the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
408 | * @return a pointer to the allocated memory; @c NULL when the operation fails, or the index is out-of-bounds |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
409 | * @see cxListEmplace() |
| 870 | 410 | * @see cxListEmplaceArrayAt() |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
411 | * @see cxListInsert() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
412 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
413 | cx_attr_nonnull |
| 870 | 414 | CX_EXPORT void *cxListEmplaceAt(CxList *list, size_t index); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
415 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
416 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
417 | * Allocates memory for an element at the end of the list and returns a pointer to that memory. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
418 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
419 | * @remark When the list is storing pointers, this will return a @c void**. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
420 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
421 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
422 | * @return a pointer to the allocated memory; @c NULL when the operation fails, or the index is out-of-bounds |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
423 | * @see cxListEmplaceAt() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
424 | * @see cxListAdd() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
425 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
426 | cx_attr_nonnull |
| 870 | 427 | CX_EXPORT void *cxListEmplace(CxList *list); |
| 428 | ||
| 429 | /** | |
| 430 | * Allocates memory for multiple elements and returns an iterator. | |
| 431 | * | |
| 432 | * The iterator will only iterate over the successfully allocated elements. | |
| 433 | * The @c elem_count attribute is set to that number, and the @c index attribute | |
| 434 | * will range from zero to @c elem_count minus one. | |
| 435 | * | |
| 436 | * @remark When the list is storing pointers, the iterator will iterate over | |
| 437 | * the @c void** elements. | |
| 438 | * | |
| 439 | * @param list the list | |
| 440 | * @param index the index where to insert the new data | |
| 441 | * @param n the number of elements for which to allocate the memory | |
| 442 | * @return an iterator, iterating over the new memory | |
| 443 | * @see cxListEmplaceAt() | |
| 444 | * @see cxListInsertArray() | |
| 445 | */ | |
| 446 | cx_attr_nonnull | |
| 447 | CX_EXPORT CxIterator cxListEmplaceArrayAt(CxList *list, size_t index, size_t n); | |
| 448 | ||
| 449 | /** | |
| 450 | * Allocates memory for multiple elements and returns an iterator. | |
| 451 | * | |
| 452 | * The iterator will only iterate over the successfully allocated elements. | |
| 453 | * The @c elem_count attribute is set to that number, and the @c index attribute | |
| 454 | * will range from zero to @c elem_count minus one. | |
| 455 | * | |
| 456 | * @remark When the list is storing pointers, the iterator will iterate over | |
| 457 | * the @c void** elements. | |
| 458 | * | |
| 459 | * @param list the list | |
| 460 | * @param n the number of elements for which to allocate the memory | |
| 461 | * @return an iterator, iterating over the new memory | |
| 462 | * @see cxListEmplace() | |
| 463 | * @see cxListAddArray() | |
| 464 | */ | |
| 465 | cx_attr_nonnull | |
| 466 | CX_EXPORT CxIterator cxListEmplaceArray(CxList *list, size_t n); | |
| 174 | 467 | |
| 468 | /** | |
| 324 | 469 | * Inserts an item into a sorted list. |
| 470 | * | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
471 | * If the list is not sorted already, the behavior is undefined. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
472 | * |
| 324 | 473 | * @param list the list |
| 474 | * @param elem a pointer to the element to add | |
| 440 | 475 | * @retval zero success |
| 476 | * @retval non-zero memory allocation failure | |
| 324 | 477 | */ |
| 440 | 478 | cx_attr_nonnull |
| 870 | 479 | CX_EXPORT int cxListInsertSorted(CxList *list, const void *elem); |
| 324 | 480 | |
| 481 | /** | |
| 870 | 482 | * Inserts an item into a list if it does not exist. |
| 845 | 483 | * |
| 870 | 484 | * If the list is not sorted already, this function will check all elements |
| 485 | * and append the new element when it was not found. | |
| 486 | * It is strongly recommended to use this function only on sorted lists, where | |
| 487 | * the element, if it is not contained, is inserted at the correct position. | |
| 845 | 488 | * |
| 489 | * @param list the list | |
| 490 | * @param elem a pointer to the element to add | |
| 491 | * @retval zero success (also when the element was already in the list) | |
| 492 | * @retval non-zero memory allocation failure | |
| 493 | */ | |
| 494 | cx_attr_nonnull | |
| 870 | 495 | CX_EXPORT int cxListInsertUnique(CxList *list, const void *elem); |
| 845 | 496 | |
| 497 | /** | |
| 174 | 498 | * Inserts multiple items to the list at the specified index. |
| 845 | 499 | * If the @p index equals the list size, this is effectively cxListAddArray(). |
| 174 | 500 | * |
| 501 | * This method is usually more efficient than invoking cxListInsert() | |
| 502 | * multiple times. | |
| 503 | * | |
| 504 | * If there is not enough memory to add all elements, the returned value is | |
| 440 | 505 | * less than @p n. |
| 174 | 506 | * |
| 845 | 507 | * If this list is storing pointers instead of objects, @p array is expected to |
| 174 | 508 | * be an array of pointers. |
| 509 | * | |
| 510 | * @param list the list | |
| 511 | * @param index the index where to add the elements | |
| 512 | * @param array a pointer to the elements to add | |
| 513 | * @param n the number of elements to add | |
| 514 | * @return the number of added elements | |
| 870 | 515 | * @see cxListEmplaceArrayAt() |
| 174 | 516 | */ |
| 440 | 517 | cx_attr_nonnull |
| 870 | 518 | CX_EXPORT size_t cxListInsertArray(CxList *list, size_t index, const void *array, size_t n); |
| 174 | 519 | |
| 520 | /** | |
| 324 | 521 | * Inserts a sorted array into a sorted list. |
| 522 | * | |
| 845 | 523 | * This method is usually more efficient than inserting each element separately |
| 324 | 524 | * because consecutive chunks of sorted data are inserted in one pass. |
| 525 | * | |
| 526 | * If there is not enough memory to add all elements, the returned value is | |
| 440 | 527 | * less than @p n. |
| 324 | 528 | * |
| 845 | 529 | * If this list is storing pointers instead of objects, @p array is expected to |
| 324 | 530 | * be an array of pointers. |
| 531 | * | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
532 | * If the list is not sorted already, the behavior is undefined. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
533 | * |
| 324 | 534 | * @param list the list |
| 535 | * @param array a pointer to the elements to add | |
| 536 | * @param n the number of elements to add | |
| 537 | * @return the number of added elements | |
| 538 | */ | |
| 440 | 539 | cx_attr_nonnull |
| 870 | 540 | CX_EXPORT size_t cxListInsertSortedArray(CxList *list, const void *array, size_t n); |
| 324 | 541 | |
| 542 | /** | |
| 870 | 543 | * Inserts an array into a list, skipping duplicates. |
| 544 | * | |
| 545 | * The @p list does not need to be sorted (in contrast to cxListInsertSortedArray()). | |
| 546 | * But it is strongly recommended to use this function only on sorted lists, | |
| 547 | * because otherwise it will fall back to an inefficient algorithm which inserts | |
| 548 | * all elements one by one. | |
| 549 | * If the @p list is not sorted, the @p array also does not need to be sorted. | |
| 550 | * But when the @p list is sorted, the @p array must also be sorted. | |
| 845 | 551 | * |
| 552 | * This method is usually more efficient than inserting each element separately | |
| 553 | * because consecutive chunks of sorted data are inserted in one pass. | |
| 554 | * | |
| 555 | * If there is not enough memory to add all elements, the returned value is | |
| 556 | * less than @p n. | |
| 557 | * | |
| 558 | * @note The return value of this function denotes the number of elements | |
| 559 | * from the @p sorted_data that are definitely contained in the list after | |
| 560 | * completing the call. It is @em not the number of elements that were newly | |
| 561 | * inserted. That means, when no error occurred, the return value should | |
| 562 | * be @p n. | |
| 563 | * | |
| 564 | * If this list is storing pointers instead of objects @p array is expected to | |
| 565 | * be an array of pointers. | |
| 566 | * | |
| 567 | * @param list the list | |
| 568 | * @param array a pointer to the elements to add | |
| 569 | * @param n the number of elements to add | |
| 570 | * @return the number of added elements | |
| 571 | * | |
| 572 | * @return the number of elements from the @p sorted_data that are definitely present in the list after this call | |
| 573 | */ | |
| 574 | cx_attr_nonnull | |
| 870 | 575 | CX_EXPORT size_t cxListInsertUniqueArray(CxList *list, const void *array, size_t n); |
| 845 | 576 | |
| 577 | /** | |
| 174 | 578 | * Inserts an element after the current location of the specified iterator. |
| 579 | * | |
| 580 | * The used iterator remains operational, but all other active iterators should | |
| 581 | * be considered invalidated. | |
| 582 | * | |
| 440 | 583 | * If @p iter is not a list iterator, the behavior is undefined. |
| 584 | * If @p iter is a past-the-end iterator, the new element gets appended to the list. | |
| 174 | 585 | * |
| 586 | * @param iter an iterator | |
| 587 | * @param elem the element to insert | |
| 440 | 588 | * @retval zero success |
| 589 | * @retval non-zero memory allocation failure | |
| 174 | 590 | * @see cxListInsert() |
| 591 | * @see cxListInsertBefore() | |
| 592 | */ | |
| 440 | 593 | cx_attr_nonnull |
| 870 | 594 | CX_EXPORT int cxListInsertAfter(CxIterator *iter, const void *elem); |
| 174 | 595 | |
| 596 | /** | |
| 597 | * Inserts an element before the current location of the specified iterator. | |
| 598 | * | |
| 599 | * The used iterator remains operational, but all other active iterators should | |
| 600 | * be considered invalidated. | |
| 601 | * | |
| 440 | 602 | * If @p iter is not a list iterator, the behavior is undefined. |
| 603 | * If @p iter is a past-the-end iterator, the new element gets appended to the list. | |
| 174 | 604 | * |
| 605 | * @param iter an iterator | |
| 606 | * @param elem the element to insert | |
| 440 | 607 | * @retval zero success |
| 608 | * @retval non-zero memory allocation failure | |
| 174 | 609 | * @see cxListInsert() |
| 610 | * @see cxListInsertAfter() | |
| 611 | */ | |
| 440 | 612 | cx_attr_nonnull |
| 870 | 613 | CX_EXPORT int cxListInsertBefore(CxIterator *iter, const void *elem); |
| 174 | 614 | |
| 615 | /** | |
| 616 | * Removes the element at the specified index. | |
| 617 | * | |
| 618 | * If an element destructor function is specified, it is called before | |
| 619 | * removing the element. | |
| 620 | * | |
| 621 | * @param list the list | |
| 622 | * @param index the index of the element | |
| 440 | 623 | * @retval zero success |
| 624 | * @retval non-zero index out of bounds | |
| 174 | 625 | */ |
| 440 | 626 | cx_attr_nonnull |
| 870 | 627 | CX_EXPORT int cxListRemove(CxList *list, size_t index); |
| 440 | 628 | |
| 629 | /** | |
| 630 | * Removes and returns the element at the specified index. | |
| 631 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
632 | * No destructor is called, and instead the element is copied to the |
| 440 | 633 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
634 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
| 440 | 635 | * |
| 636 | * @param list the list | |
| 637 | * @param index the index of the element | |
| 638 | * @param targetbuf a buffer where to copy the element | |
| 639 | * @retval zero success | |
| 640 | * @retval non-zero index out of bounds | |
| 641 | */ | |
| 870 | 642 | cx_attr_nonnull cx_attr_access_w(3) |
| 643 | CX_EXPORT int cxListRemoveAndGet(CxList *list, size_t index, void *targetbuf); | |
| 440 | 644 | |
| 645 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
646 | * Removes and returns the first element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
647 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
648 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
649 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
650 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
651 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
652 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
653 | * @param targetbuf a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
654 | * @retval zero success |
| 845 | 655 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
656 | * @see cxListPopFront() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
657 | * @see cxListRemoveAndGetLast() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
658 | */ |
| 870 | 659 | cx_attr_nonnull cx_attr_access_w(2) |
| 660 | CX_EXPORT int cxListRemoveAndGetFirst(CxList *list, void *targetbuf); | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
661 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
662 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
663 | * Removes and returns the first element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
664 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
665 | * Alias for cxListRemoveAndGetFirst(). |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
666 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
667 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
668 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
669 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
670 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
671 | * @param list (@c CxList*) the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
672 | * @param targetbuf (@c void*) a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
673 | * @retval zero success |
| 845 | 674 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
675 | * @see cxListRemoveAndGetFirst() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
676 | * @see cxListPop() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
677 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
678 | #define cxListPopFront(list, targetbuf) cxListRemoveAndGetFirst((list), (targetbuf)) |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
679 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
680 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
681 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
682 | * Removes and returns the last element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
683 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
684 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
685 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
686 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
687 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
688 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
689 | * @param targetbuf a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
690 | * @retval zero success |
| 845 | 691 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
692 | */ |
| 870 | 693 | cx_attr_nonnull cx_attr_access_w(2) |
| 694 | CX_EXPORT int cxListRemoveAndGetLast(CxList *list, void *targetbuf); | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
695 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
696 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
697 | * Removes and returns the last element of the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
698 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
699 | * Alias for cxListRemoveAndGetLast(). |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
700 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
701 | * No destructor is called, and instead the element is copied to the |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
702 | * @p targetbuf which MUST be large enough to hold the removed element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
703 | * If the list is storing pointers, only the pointer is copied to @p targetbuf. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
704 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
705 | * @param list (@c CxList*) the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
706 | * @param targetbuf (@c void*) a buffer where to copy the element |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
707 | * @retval zero success |
| 845 | 708 | * @retval non-zero the list is empty |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
709 | * @see cxListRemoveAndGetLast() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
710 | * @see cxListPopFront() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
711 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
712 | #define cxListPop(list, targetbuf) cxListRemoveAndGetLast((list), (targetbuf)) |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
713 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
714 | /** |
| 440 | 715 | * Removes multiple element starting at the specified index. |
| 716 | * | |
| 717 | * If an element destructor function is specified, it is called for each | |
| 718 | * element. It is guaranteed that the destructor is called before removing | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
719 | * the element. However, due to possible optimizations, it is neither guaranteed |
| 440 | 720 | * that the destructors are invoked for all elements before starting to remove |
| 721 | * them, nor that the element is removed immediately after the destructor call | |
| 722 | * before proceeding to the next element. | |
| 723 | * | |
| 724 | * @param list the list | |
| 725 | * @param index the index of the element | |
| 726 | * @param num the number of elements to remove | |
| 727 | * @return the actual number of removed elements | |
| 728 | */ | |
| 729 | cx_attr_nonnull | |
| 870 | 730 | CX_EXPORT size_t cxListRemoveArray(CxList *list, size_t index, size_t num); |
| 440 | 731 | |
| 732 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
733 | * Removes and returns multiple elements starting at the specified index. |
| 440 | 734 | * |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
735 | * No destructor is called, and instead the elements are copied to the |
| 440 | 736 | * @p targetbuf which MUST be large enough to hold all removed elements. |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
737 | * If the list is storing pointers, @p targetbuf is expected to be an array of pointers. |
| 440 | 738 | * |
| 739 | * @param list the list | |
| 740 | * @param index the index of the element | |
| 741 | * @param num the number of elements to remove | |
| 742 | * @param targetbuf a buffer where to copy the elements | |
| 743 | * @return the actual number of removed elements | |
| 744 | */ | |
| 870 | 745 | cx_attr_nonnull cx_attr_access_w(4) |
| 746 | CX_EXPORT size_t cxListRemoveArrayAndGet(CxList *list, size_t index, size_t num, void *targetbuf); | |
| 174 | 747 | |
| 748 | /** | |
| 749 | * Removes all elements from this list. | |
| 750 | * | |
| 440 | 751 | * If element destructor functions are specified, they are called for each |
| 174 | 752 | * element before removing them. |
| 753 | * | |
| 754 | * @param list the list | |
| 755 | */ | |
| 440 | 756 | cx_attr_nonnull |
| 870 | 757 | CX_EXPORT void cxListClear(CxList *list); |
| 174 | 758 | |
| 759 | /** | |
| 760 | * Swaps two items in the list. | |
| 761 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
762 | * Implementations should only allocate temporary memory for the swap if |
| 174 | 763 | * it is necessary. |
| 764 | * | |
| 765 | * @param list the list | |
| 766 | * @param i the index of the first element | |
| 767 | * @param j the index of the second element | |
| 440 | 768 | * @retval zero success |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
769 | * @retval non-zero one of the indices is out of bounds, |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
770 | * or the swap needed extra memory, but allocation failed |
| 174 | 771 | */ |
| 440 | 772 | cx_attr_nonnull |
| 870 | 773 | CX_EXPORT int cxListSwap(CxList *list, size_t i, size_t j); |
| 174 | 774 | |
| 775 | /** | |
| 776 | * Returns a pointer to the element at the specified index. | |
| 777 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
778 | * If the list is storing pointers, returns the pointer stored at the specified index. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
779 | * |
| 174 | 780 | * @param list the list |
| 781 | * @param index the index of the element | |
| 440 | 782 | * @return a pointer to the element or @c NULL if the index is out of bounds |
| 174 | 783 | */ |
| 440 | 784 | cx_attr_nonnull |
| 870 | 785 | CX_EXPORT void *cxListAt(const CxList *list, size_t index); |
| 174 | 786 | |
| 787 | /** | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
788 | * Returns a pointer to the first element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
789 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
790 | * If the list is storing pointers, returns the first pointer stored in the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
791 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
792 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
793 | * @return a pointer to the first element or @c NULL if the list is empty |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
794 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
795 | cx_attr_nonnull |
| 870 | 796 | CX_EXPORT void *cxListFirst(const CxList *list); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
797 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
798 | /** |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
799 | * Returns a pointer to the last element. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
800 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
801 | * If the list is storing pointers, returns the last pointer stored in the list. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
802 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
803 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
804 | * @return a pointer to the last element or @c NULL if the list is empty |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
805 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
806 | cx_attr_nonnull |
| 870 | 807 | CX_EXPORT void *cxListLast(const CxList *list); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
808 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
809 | /** |
| 870 | 810 | * Sets the element at the specified index in the list. |
| 811 | * | |
| 812 | * This overwrites the element in-place without calling any destructor | |
| 813 | * on the overwritten element. | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
814 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
815 | * @param list the list to set the element in |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
816 | * @param index the index to set the element at |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
817 | * @param elem element to set |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
818 | * @retval zero on success |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
819 | * @retval non-zero when index is out of bounds |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
820 | */ |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
821 | cx_attr_nonnull |
| 870 | 822 | CX_EXPORT int cxListSet(CxList *list, size_t index, const void *elem); |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
823 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
824 | /** |
| 174 | 825 | * Returns an iterator pointing to the item at the specified index. |
| 826 | * | |
| 827 | * The returned iterator is position-aware. | |
| 828 | * | |
| 845 | 829 | * If the index is out of range or @p list is @c NULL, a past-the-end iterator will be returned. |
| 174 | 830 | * |
| 831 | * @param list the list | |
| 832 | * @param index the index where the iterator shall point at | |
| 833 | * @return a new iterator | |
| 834 | */ | |
| 440 | 835 | cx_attr_nodiscard |
| 870 | 836 | CX_EXPORT CxIterator cxListIteratorAt(const CxList *list, size_t index); |
| 174 | 837 | |
| 838 | /** | |
| 839 | * Returns a backwards iterator pointing to the item at the specified index. | |
| 840 | * | |
| 841 | * The returned iterator is position-aware. | |
| 842 | * | |
| 845 | 843 | * If the index is out of range or @p list is @c NULL, a past-the-end iterator will be returned. |
| 174 | 844 | * |
| 845 | * @param list the list | |
| 846 | * @param index the index where the iterator shall point at | |
| 847 | * @return a new iterator | |
| 848 | */ | |
| 440 | 849 | cx_attr_nodiscard |
| 870 | 850 | CX_EXPORT CxIterator cxListBackwardsIteratorAt(const CxList *list, size_t index); |
| 174 | 851 | |
| 852 | /** | |
| 853 | * Returns an iterator pointing to the first item of the list. | |
| 854 | * | |
| 855 | * The returned iterator is position-aware. | |
| 856 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
857 | * If the list is empty or @c NULL, a past-the-end iterator will be returned. |
| 174 | 858 | * |
| 859 | * @param list the list | |
| 860 | * @return a new iterator | |
| 861 | */ | |
| 440 | 862 | cx_attr_nodiscard |
| 870 | 863 | CX_EXPORT CxIterator cxListIterator(const CxList *list); |
| 174 | 864 | |
| 865 | /** | |
| 866 | * Returns a backwards iterator pointing to the last item of the list. | |
| 867 | * | |
| 868 | * The returned iterator is position-aware. | |
| 869 | * | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
870 | * If the list is empty or @c NULL, a past-the-end iterator will be returned. |
| 174 | 871 | * |
| 872 | * @param list the list | |
| 873 | * @return a new iterator | |
| 874 | */ | |
| 440 | 875 | cx_attr_nodiscard |
| 870 | 876 | CX_EXPORT CxIterator cxListBackwardsIterator(const CxList *list); |
| 174 | 877 | |
| 878 | /** | |
| 440 | 879 | * Returns the index of the first element that equals @p elem. |
| 174 | 880 | * |
| 881 | * Determining equality is performed by the list's comparator function. | |
| 882 | * | |
| 883 | * @param list the list | |
| 884 | * @param elem the element to find | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
885 | * @return the index of the element or the size of the list when the element is not found |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
886 | * @see cxListIndexValid() |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
887 | * @see cxListContains() |
| 174 | 888 | */ |
| 870 | 889 | cx_attr_nonnull cx_attr_nodiscard |
| 890 | CX_EXPORT size_t cxListFind(const CxList *list, const void *elem); | |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
891 | |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
892 | /** |
| 845 | 893 | * Checks if the list contains the specified element. |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
894 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
895 | * The elements are compared with the list's comparator function. |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
896 | * |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
897 | * @param list the list |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
898 | * @param elem the element to find |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
899 | * @retval true if the element is contained |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
900 | * @retval false if the element is not contained |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
901 | * @see cxListFind() |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
902 | */ |
| 870 | 903 | cx_attr_nonnull cx_attr_nodiscard |
| 904 | CX_EXPORT bool cxListContains(const CxList* list, const void* elem); | |
|
629
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
905 | |
|
0385a450c2a6
add list initializer
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
471
diff
changeset
|
906 | /** |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
907 | * Checks if the specified index is within bounds. |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
908 | * |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
909 | * @param list the list |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
910 | * @param index the index |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
911 | * @retval true if the index is within bounds |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
912 | * @retval false if the index is out of bounds |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
913 | */ |
| 870 | 914 | cx_attr_nonnull cx_attr_nodiscard |
| 915 | CX_EXPORT bool cxListIndexValid(const CxList *list, size_t index); | |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
916 | |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
917 | /** |
| 440 | 918 | * Removes and returns the index of the first element that equals @p elem. |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
919 | * |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
920 | * Determining equality is performed by the list's comparator function. |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
921 | * |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
922 | * @param list the list |
|
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
923 | * @param elem the element to find and remove |
|
471
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
924 | * @return the index of the now removed element or the list size |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
925 | * when the element is not found or could not be removed |
|
063a9f29098c
ucx update + fix doc attach/detach + fix ui_set with unbound values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
440
diff
changeset
|
926 | * @see cxListIndexValid() |
|
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
927 | */ |
| 440 | 928 | cx_attr_nonnull |
| 870 | 929 | CX_EXPORT size_t cxListFindRemove(CxList *list, const void *elem); |
| 174 | 930 | |
| 931 | /** | |
| 440 | 932 | * Sorts the list. |
| 174 | 933 | * |
| 440 | 934 | * @remark The underlying sort algorithm is implementation defined. |
| 174 | 935 | * |
| 936 | * @param list the list | |
| 937 | */ | |
| 440 | 938 | cx_attr_nonnull |
| 870 | 939 | CX_EXPORT void cxListSort(CxList *list); |
| 174 | 940 | |
| 941 | /** | |
| 942 | * Reverses the order of the items. | |
| 943 | * | |
| 944 | * @param list the list | |
| 945 | */ | |
| 440 | 946 | cx_attr_nonnull |
| 870 | 947 | CX_EXPORT void cxListReverse(CxList *list); |
| 174 | 948 | |
| 949 | /** | |
| 950 | * Compares a list to another list of the same type. | |
| 951 | * | |
| 952 | * First, the list sizes are compared. | |
| 953 | * If they match, the lists are compared element-wise. | |
| 954 | * | |
| 955 | * @param list the list | |
| 956 | * @param other the list to compare to | |
| 440 | 957 | * @retval zero both lists are equal element wise |
| 870 | 958 | * @retval negative the first list is smaller, |
| 440 | 959 | * or the first non-equal element in the first list is smaller |
| 960 | * @retval positive the first list is larger | |
| 961 | * or the first non-equal element in the first list is larger | |
| 174 | 962 | */ |
| 870 | 963 | cx_attr_nonnull cx_attr_nodiscard |
| 964 | CX_EXPORT int cxListCompare(const CxList *list, const CxList *other); | |
| 174 | 965 | |
| 966 | /** | |
| 967 | * Deallocates the memory of the specified list structure. | |
| 968 | * | |
| 440 | 969 | * Also calls the content destructor functions for each element, if specified. |
| 174 | 970 | * |
| 845 | 971 | * @param list the list that shall be freed |
| 174 | 972 | */ |
| 870 | 973 | CX_EXPORT void cxListFree(CxList *list); |
| 174 | 974 | |
| 975 | ||
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
976 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
977 | * Performs a deep clone of one list into another. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
978 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
979 | * If the destination list already contains elements, the cloned elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
980 | * are appended to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
981 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
982 | * @attention If the cloned elements need to be destroyed by a destructor |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
983 | * function, you must make sure that the destination list also uses this |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
984 | * destructor function. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
985 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
986 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
987 | * @param src the source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
988 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
989 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
990 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
991 | * @retval zero when all elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
992 | * @retval non-zero when an allocation error occurred |
| 1016 | 993 | * @see cxListCloneShallow() |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
994 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
995 | cx_attr_nonnull_arg(1, 2, 3) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
996 | CX_EXPORT int cxListClone(CxList *dst, const CxList *src, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
997 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
998 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
999 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1000 | * Clones elements from a list only if they are not present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1001 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1002 | * If the @p minuend does not contain duplicates, this is equivalent to adding |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1003 | * the set difference to the destination list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1004 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1005 | * This function is optimized for the case when both the @p minuend and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1006 | * @p subtrahend are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1007 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1008 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1009 | * @param minuend the list to subtract elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1010 | * @param subtrahend the elements that shall be subtracted |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1011 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1012 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1013 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1014 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1015 | * @retval non-zero when an allocation error occurred |
| 1016 | 1016 | * @see cxListDifferenceShallow() |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1017 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1018 | cx_attr_nonnull_arg(1, 2, 3, 4) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1019 | CX_EXPORT int cxListDifference(CxList *dst, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1020 | const CxList *minuend, const CxList *subtrahend, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1021 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1022 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1023 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1024 | * Clones elements from a list only if they are also present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1025 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1026 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1027 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1028 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1029 | * If the destination list already contains elements, the intersection is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1030 | * to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1031 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1032 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1033 | * @param src the list to clone the elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1034 | * @param other the list to check the elements for existence |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1035 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1036 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1037 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1038 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1039 | * @retval non-zero when an allocation error occurred |
| 1016 | 1040 | * @see cxListIntersectionShallow() |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1041 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1042 | cx_attr_nonnull_arg(1, 2, 3, 4) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1043 | CX_EXPORT int cxListIntersection(CxList *dst, const CxList *src, const CxList *other, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1044 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1045 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1046 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1047 | * Performs a deep clone of one list into another, skipping duplicates. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1048 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1049 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1050 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1051 | * In that case, the union will also be sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1052 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1053 | * If the destination list already contains elements, the union is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1054 | * to that list. In that case the destination is not necessarily sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1055 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1056 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1057 | * @param src the primary source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1058 | * @param other the other list, where elements are only cloned from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1059 | * when they are not in @p src |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1060 | * @param clone_func the clone function for the elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1061 | * @param clone_allocator the allocator that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1062 | * @param data optional additional data that is passed to the clone function |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1063 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1064 | * @retval non-zero when an allocation error occurred |
| 1016 | 1065 | * @see cxListUnionShallow() |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1066 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1067 | cx_attr_nonnull_arg(1, 2, 3, 4) |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1068 | CX_EXPORT int cxListUnion(CxList *dst, const CxList *src, const CxList *other, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1069 | cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1070 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1071 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1072 | * Performs a shallow clone of one list into another. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1073 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1074 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1075 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1076 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1077 | * If the destination list already contains elements, the cloned elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1078 | * are appended to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1079 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1080 | * @attention If the cloned elements need to be destroyed by a destructor |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1081 | * function, you must make sure that the destination list also uses this |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1082 | * destructor function. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1083 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1084 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1085 | * @param src the source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1086 | * @retval zero when all elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1087 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1088 | * @see cxListClone() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1089 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1090 | cx_attr_nonnull |
| 1016 | 1091 | CX_EXPORT int cxListCloneShallow(CxList *dst, const CxList *src); |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1092 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1093 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1094 | * Clones elements from a list only if they are not present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1095 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1096 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1097 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1098 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1099 | * If the @p minuend does not contain duplicates, this is equivalent to adding |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1100 | * the set difference to the destination list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1101 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1102 | * This function is optimized for the case when both the @p minuend and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1103 | * @p subtrahend are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1104 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1105 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1106 | * @param minuend the list to subtract elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1107 | * @param subtrahend the elements that shall be subtracted |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1108 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1109 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1110 | * @see cxListDifference() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1111 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1112 | cx_attr_nonnull |
| 1016 | 1113 | CX_EXPORT int cxListDifferenceShallow(CxList *dst, |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1114 | const CxList *minuend, const CxList *subtrahend); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1115 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1116 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1117 | * Clones elements from a list only if they are also present in another list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1118 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1119 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1120 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1121 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1122 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1123 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1124 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1125 | * If the destination list already contains elements, the intersection is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1126 | * to that list. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1127 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1128 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1129 | * @param src the list to clone the elements from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1130 | * @param other the list to check the elements for existence |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1131 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1132 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1133 | * @see cxListIntersection() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1134 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1135 | cx_attr_nonnull |
| 1016 | 1136 | CX_EXPORT int cxListIntersectionShallow(CxList *dst, const CxList *src, const CxList *other); |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1137 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1138 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1139 | * Performs a deep clone of one list into another, skipping duplicates. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1140 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1141 | * This function uses the default allocator, if needed, and performs |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1142 | * shallow clones with @c memcpy(). |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1143 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1144 | * This function is optimized for the case when both the @p src and the |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1145 | * @p other list are sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1146 | * In that case, the union will also be sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1147 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1148 | * If the destination list already contains elements, the union is appended |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1149 | * to that list. In that case the destination is not necessarily sorted. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1150 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1151 | * @param dst the destination list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1152 | * @param src the primary source list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1153 | * @param other the other list, where elements are only cloned from |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1154 | * when they are not in @p src |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1155 | * @retval zero when the elements were successfully cloned |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1156 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1157 | * @see cxListUnion() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1158 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1159 | cx_attr_nonnull |
| 1016 | 1160 | CX_EXPORT int cxListUnionShallow(CxList *dst, const CxList *src, const CxList *other); |
|
943
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1161 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1162 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1163 | * Asks the list to reserve enough memory for a given total number of elements. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1164 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1165 | * List implementations are free to choose if reserving memory upfront makes |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1166 | * sense. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1167 | * For example, array-based implementations usually do support reserving memory |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1168 | * for additional elements while linked lists usually don't. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1169 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1170 | * @note When the requested capacity is smaller than the current size, |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1171 | * this function returns zero without performing any action. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1172 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1173 | * @param list the list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1174 | * @param capacity the expected total number of elements |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1175 | * @retval zero on success or when overallocation is not supported |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1176 | * @retval non-zero when an allocation error occurred |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1177 | * @see cxListShrink() |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1178 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1179 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1180 | CX_EXPORT int cxListReserve(CxList *list, size_t capacity); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1181 | |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1182 | /** |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1183 | * Advises the list to free any overallocated memory. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1184 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1185 | * Lists that do not support overallocation simply return zero. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1186 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1187 | * This function usually returns zero, except for very special and custom |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1188 | * list and/or allocator implementations where freeing memory can fail. |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1189 | * |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1190 | * @param list the list |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1191 | * @return usually zero |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1192 | */ |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1193 | cx_attr_nonnull |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1194 | CX_EXPORT int cxListShrink(CxList *list); |
|
9b5948aa5b90
update ucx to version 3.2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
870
diff
changeset
|
1195 | |
| 174 | 1196 | #ifdef __cplusplus |
| 1197 | } // extern "C" | |
| 1198 | #endif | |
| 1199 | ||
| 1200 | #endif // UCX_LIST_H |