src/cx/list.h

changeset 853
d4baf4dd55c3
parent 764
ccbdbd088455
child 854
fe0d69d72bcd
equal deleted inserted replaced
852:16e2a3391e88 853:d4baf4dd55c3
98 98
99 /** 99 /**
100 * Member function for inserting an element relative to an iterator position. 100 * Member function for inserting an element relative to an iterator position.
101 */ 101 */
102 int (*insert_iter)( 102 int (*insert_iter)(
103 struct cx_mut_iterator_s *iter, 103 struct cx_iterator_s *iter,
104 void const *elem, 104 void const *elem,
105 int prepend 105 int prepend
106 ); 106 );
107 107
108 /** 108 /**
334 * @see cxListInsert() 334 * @see cxListInsert()
335 * @see cxListInsertBefore() 335 * @see cxListInsertBefore()
336 */ 336 */
337 __attribute__((__nonnull__)) 337 __attribute__((__nonnull__))
338 static inline int cxListInsertAfter( 338 static inline int cxListInsertAfter(
339 CxMutIterator *iter, 339 CxIterator *iter,
340 void const *elem 340 void const *elem
341 ) { 341 ) {
342 return ((struct cx_list_s *) iter->src_handle)->cl->insert_iter(iter, elem, 0); 342 return ((struct cx_list_s *) iter->src_handle.m)->cl->insert_iter(iter, elem, 0);
343 } 343 }
344 344
345 /** 345 /**
346 * Inserts an element before the current location of the specified iterator. 346 * Inserts an element before the current location of the specified iterator.
347 * 347 *
357 * @see cxListInsert() 357 * @see cxListInsert()
358 * @see cxListInsertAfter() 358 * @see cxListInsertAfter()
359 */ 359 */
360 __attribute__((__nonnull__)) 360 __attribute__((__nonnull__))
361 static inline int cxListInsertBefore( 361 static inline int cxListInsertBefore(
362 CxMutIterator *iter, 362 CxIterator *iter,
363 void const *elem 363 void const *elem
364 ) { 364 ) {
365 return ((struct cx_list_s *) iter->src_handle)->cl->insert_iter(iter, elem, 1); 365 return ((struct cx_list_s *) iter->src_handle.m)->cl->insert_iter(iter, elem, 1);
366 } 366 }
367 367
368 /** 368 /**
369 * Removes the element at the specified index. 369 * Removes the element at the specified index.
370 * 370 *
479 * @param list the list 479 * @param list the list
480 * @param index the index where the iterator shall point at 480 * @param index the index where the iterator shall point at
481 * @return a new iterator 481 * @return a new iterator
482 */ 482 */
483 __attribute__((__nonnull__, __warn_unused_result__)) 483 __attribute__((__nonnull__, __warn_unused_result__))
484 CxMutIterator cxListMutIteratorAt( 484 CxIterator cxListMutIteratorAt(
485 CxList *list, 485 CxList *list,
486 size_t index 486 size_t index
487 ); 487 );
488 488
489 /** 489 /**
497 * @param list the list 497 * @param list the list
498 * @param index the index where the iterator shall point at 498 * @param index the index where the iterator shall point at
499 * @return a new iterator 499 * @return a new iterator
500 */ 500 */
501 __attribute__((__nonnull__, __warn_unused_result__)) 501 __attribute__((__nonnull__, __warn_unused_result__))
502 CxMutIterator cxListMutBackwardsIteratorAt( 502 CxIterator cxListMutBackwardsIteratorAt(
503 CxList *list, 503 CxList *list,
504 size_t index 504 size_t index
505 ); 505 );
506 506
507 /** 507 /**
528 * 528 *
529 * @param list the list 529 * @param list the list
530 * @return a new iterator 530 * @return a new iterator
531 */ 531 */
532 __attribute__((__nonnull__, __warn_unused_result__)) 532 __attribute__((__nonnull__, __warn_unused_result__))
533 static inline CxMutIterator cxListMutIterator(CxList *list) { 533 static inline CxIterator cxListMutIterator(CxList *list) {
534 return cxListMutIteratorAt(list, 0); 534 return cxListMutIteratorAt(list, 0);
535 } 535 }
536 536
537 537
538 /** 538 /**
559 * 559 *
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 CxMutIterator cxListMutBackwardsIterator(CxList *list) { 564 static inline CxIterator cxListMutBackwardsIterator(CxList *list) {
565 return cxListMutBackwardsIteratorAt(list, list->size - 1); 565 return cxListMutBackwardsIteratorAt(list, list->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.

mercurial