insert_item_after(this, enumerator->current, item);
}
+METHOD(linked_list_t, replace, void*,
+ private_linked_list_t *this, private_enumerator_t *enumerator,
+ void *item)
+{
+ void *old = NULL;
+ if (enumerator->current)
+ {
+ old = enumerator->current->value;
+ enumerator->current->value = item;
+ }
+ return old;
+}
+
METHOD(linked_list_t, get_last, status_t,
private_linked_list_t *this, void **item)
{
.insert_last = _insert_last,
.insert_after = (void*)_insert_after,
.insert_before = (void*)_insert_before,
+ .replace = (void*)_replace,
.remove_first = _remove_first,
.remove_last = _remove_last,
.remove = _remove_,
void *item);
/**
+ * Replaces the item the enumerator currently points to with the given item.
+ *
+ * @param enumerator enumerator with position
+ * @param item item value to replace current item with
+ * @return current item or NULL if the enumerator is at an
+ * invalid position
+ */
+ void *(*replace)(linked_list_t *this, enumerator_t *enumerator, void *item);
+
+ /**
* Remove an item from the list where the enumerator points to.
*
* @param enumerator enumerator with position