#include <unilistiter.h>
Inheritance diagram for UniListIter:
This is handy if you know the list of keys is relatively short and you don't want to write your own iterator, and/or you know your own object state might change during iteration, so you would have to pre-generate the list of keys anyway.
The creator of the iter is responsible for filling the 'keys' and 'values' lists by calling add(). If the 'values' list runs out of values before 'keys', the remaining values will be retrieved from the given generator (using get()) instead.
Definition at line 43 of file unilistiter.h.
Public Member Functions | |
UniListIter (IUniConfGen *_gen) | |
void | add (WvStringParm k, WvStringParm v=noval) |
Add a key/value pair to the list that gets returned by this iterator. | |
void | autofill (IUniConfGen::Iter *source) |
Automatically fill the contents of this iterator by calling add() for each element of the 'source' iterator. | |
virtual void | rewind () |
Rewinds the iterator. | |
virtual bool | next () |
Seeks to the next element in the sequence. | |
virtual UniConfKey | key () const |
Returns the current key. | |
virtual WvString | value () const |
Returns the value of the current key. |
|
Add a key/value pair to the list that gets returned by this iterator. If v is 'noval' (the default), the value of the returned item is retrieved by calling get(k). Otherwise the value is v. This function should only be called by the creator of the iterator, not the end user. Definition at line 58 of file unilistiter.cc. References WvList< T >::append(), WvFastString::cstr(), and WvStringCache::get(). Referenced by autofill(). |
|
Automatically fill the contents of this iterator by calling add() for each element of the 'source' iterator. This is handy if the source iterator might be unsafe (eg. can't handle set() type operations on the generator without restarting the iteration). This function should only be called by the creator of the iterator, not the end user. Definition at line 74 of file unilistiter.cc. References add(). Referenced by UniTransactionGen::iterator(). |
|
Rewinds the iterator. Must be called prior to the first invocation of next(). Implements UniConfGen::Iter. Definition at line 82 of file unilistiter.cc. |
|
Seeks to the next element in the sequence. Returns true if that element exists. Must be called prior to the first invocation of key(). Implements UniConfGen::Iter. Definition at line 89 of file unilistiter.cc. |
|
Returns the value of the current key. You could just do a get(), but maybe your generator has a more efficient way. Implements UniConfGen::Iter. Definition at line 103 of file unilistiter.cc. References IUniConfGen::get(). |