diff options
author | Martin Willi <martin@strongswan.org> | 2006-10-24 14:20:45 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-10-24 14:20:45 +0000 |
commit | 191a26a6a713e81361bd677bb0297744f03e4f36 (patch) | |
tree | 95bbdbc6be919e5748ddcab93d985592f264e593 /src/libstrongswan/utils/iterator.h | |
parent | 55bbff11ec96f74b27afc36dd8ca3e34ff425b40 (diff) | |
download | strongswan-191a26a6a713e81361bd677bb0297744f03e4f36.tar.bz2 strongswan-191a26a6a713e81361bd677bb0297744f03e4f36.tar.xz |
removed deprecated iterator methods (has_next & current)
added iterator hook to manipulate iterator the clean way
Diffstat (limited to 'src/libstrongswan/utils/iterator.h')
-rw-r--r-- | src/libstrongswan/utils/iterator.h | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/libstrongswan/utils/iterator.h b/src/libstrongswan/utils/iterator.h index e2fd45d46..668fbb764 100644 --- a/src/libstrongswan/utils/iterator.h +++ b/src/libstrongswan/utils/iterator.h @@ -64,30 +64,20 @@ struct iterator_t { * - FALSE otherwise */ bool (*iterate) (iterator_t *this, void** value); - - /** - * @brief Moves to the next element, if available. - * - * A newly created iterator_t object doesn't point to any item. - * Call iterator_t.has_next first to point it to the first item. - * - * @param this calling object - * @return - * - TRUE, if more elements are available, - * - FALSE otherwise - */ - bool (*has_next) (iterator_t *this); - + /** - * @brief Returns the current value at the iterator position. + * @brief Hook a function into the iterator. + * + * Sometimes it is useful to hook in an iterator. The hook function is + * called before any successful return of iterate(). It takes the + * iterator value, may manipulate it (or the references object), and returns + * the value that the iterate() function returns. + * A value of NULL deactivates the iterator hook. * * @param this calling object - * @param[out] value value is set to the current value at iterator position - * @return - * - SUCCESS - * - FAILED if iterator on an invalid position + * @param hook iterator hook which manipulates the iterated value */ - status_t (*current) (iterator_t *this, void **value); + void (*set_iterator_hook) (iterator_t *this, void*(*hook)(void*)); /** * @brief Inserts a new item before the given iterator position. |