insert_item_before(this, enumerator->current, item);
}
-METHOD(linked_list_t, insert_after, void,
- private_linked_list_t *this, private_enumerator_t *enumerator,
- void *item)
-{
- insert_item_after(this, enumerator->current, item);
-}
-
METHOD(linked_list_t, replace, void*,
private_linked_list_t *this, private_enumerator_t *enumerator,
void *item)
.find_last = (void*)_find_last,
.insert_first = _insert_first,
.insert_last = _insert_last,
- .insert_after = (void*)_insert_after,
.insert_before = (void*)_insert_before,
.replace = (void*)_replace,
.remove_first = _remove_first,
/**
* Create an enumerator over the list.
*
- * The enumerator is a "lightweight" iterator. It only has two methods
- * and should therefore be much easier to implement.
+ * @note The enumerator's position is invalid before the first call
+ * to enumerate().
*
* @return enumerator over list items
*/
/**
* Inserts a new item before the item the enumerator currently points to.
*
+ * If the enumerator's position is invalid, e.g. at the end of the list,
+ * the item is inserted last. This is helpful when inserting items into a
+ * sorted list.
+ *
* @note The position of the enumerator is not changed.
- * @note If the enumerator's position is invalid, the item is inserted last.
*
* @param enumerator enumerator with position
* @param item item value to insert in list
void *item);
/**
- * Inserts a new item after the item the enumerator currently points to.
- *
- * @note The position of the enumerator is not changed (thus the next item
- * the enumerator returns will be the inserted item).
- *
- * @note If the enumerator's position is invalid, the item is inserted last.
- *
- * @param enumerator enumerator with position
- * @param item item value to insert in list
- */
- void (*insert_after)(linked_list_t *this, enumerator_t *enumerator,
- void *item);
-
- /**
* Replaces the item the enumerator currently points to with the given item.
*
* @param enumerator enumerator with position