211 * @return true, if this list is storing pointers |
211 * @return true, if this list is storing pointers |
212 * @see cxListStorePointers() |
212 * @see cxListStorePointers() |
213 */ |
213 */ |
214 __attribute__((__nonnull__)) |
214 __attribute__((__nonnull__)) |
215 static inline bool cxListIsStoringPointers(CxList const *list) { |
215 static inline bool cxListIsStoringPointers(CxList const *list) { |
216 return list->base.store_pointer; |
216 return list->collection.store_pointer; |
217 } |
217 } |
218 |
218 |
219 /** |
219 /** |
220 * Returns the number of elements currently stored in the list. |
220 * Returns the number of elements currently stored in the list. |
221 * |
221 * |
222 * @param list the list |
222 * @param list the list |
223 * @return the number of currently stored elements |
223 * @return the number of currently stored elements |
224 */ |
224 */ |
225 __attribute__((__nonnull__)) |
225 __attribute__((__nonnull__)) |
226 static inline size_t cxListSize(CxList const *list) { |
226 static inline size_t cxListSize(CxList const *list) { |
227 return list->base.size; |
227 return list->collection.size; |
228 } |
228 } |
229 |
229 |
230 /** |
230 /** |
231 * Adds an item to the end of the list. |
231 * Adds an item to the end of the list. |
232 * |
232 * |
238 __attribute__((__nonnull__)) |
238 __attribute__((__nonnull__)) |
239 static inline int cxListAdd( |
239 static inline int cxListAdd( |
240 CxList *list, |
240 CxList *list, |
241 void const *elem |
241 void const *elem |
242 ) { |
242 ) { |
243 return list->cl->insert_element(list, list->base.size, elem); |
243 return list->cl->insert_element(list, list->collection.size, elem); |
244 } |
244 } |
245 |
245 |
246 /** |
246 /** |
247 * Adds multiple items to the end of the list. |
247 * Adds multiple items to the end of the list. |
248 * |
248 * |
545 * @param list the list |
545 * @param list the list |
546 * @return a new iterator |
546 * @return a new iterator |
547 */ |
547 */ |
548 __attribute__((__nonnull__, __warn_unused_result__)) |
548 __attribute__((__nonnull__, __warn_unused_result__)) |
549 static inline CxIterator cxListBackwardsIterator(CxList const *list) { |
549 static inline CxIterator cxListBackwardsIterator(CxList const *list) { |
550 return list->cl->iterator(list, list->base.size - 1, true); |
550 return list->cl->iterator(list, list->collection.size - 1, true); |
551 } |
551 } |
552 |
552 |
553 /** |
553 /** |
554 * Returns a mutating backwards iterator pointing to the last item of the list. |
554 * Returns a mutating backwards iterator pointing to the last item of the list. |
555 * |
555 * |
560 * @param list the list |
560 * @param list the list |
561 * @return a new iterator |
561 * @return a new iterator |
562 */ |
562 */ |
563 __attribute__((__nonnull__, __warn_unused_result__)) |
563 __attribute__((__nonnull__, __warn_unused_result__)) |
564 static inline CxIterator cxListMutBackwardsIterator(CxList *list) { |
564 static inline CxIterator cxListMutBackwardsIterator(CxList *list) { |
565 return cxListMutBackwardsIteratorAt(list, list->base.size - 1); |
565 return cxListMutBackwardsIteratorAt(list, list->collection.size - 1); |
566 } |
566 } |
567 |
567 |
568 /** |
568 /** |
569 * Returns the index of the first element that equals \p elem. |
569 * Returns the index of the first element that equals \p elem. |
570 * |
570 * |