1
/* iterator.c - The iterator support-data structure.
3
* Copyright (C) 2001 Oskar Liljeblad
5
* This file is part of the file renaming utilities (renameutils)
8
* This software is copyrighted work licensed under the terms of the
9
* GNU General Public License. Please consult the file `COPYING' for
19
iterator_has_next(Iterator *it)
21
return it->class->has_next(it);
25
iterator_next(Iterator *it)
27
return it->class->next(it);
31
iterator_previous(Iterator *it)
33
if (it->class->previous == NULL)
34
internal_error("Called iterator_previous on iterator that doesn't support it");
35
return it->class->previous(it);
39
iterator_remove(Iterator *it)
41
if (it->class->remove == NULL)
42
internal_error("Called iterator_remove on iterator that doesn't support it");
43
it->class->remove(it);
47
iterator_add(Iterator *it, void *value)
49
if (it->class->add == NULL)
50
internal_error("Called iterator_add on iterator that doesn't support it");
51
it->class->add(it, value);
55
iterator_restart(Iterator *it)
57
it->class->restart(it);
61
iterator_free(Iterator *it)
63
if (it->class->free == NULL)