WvStreams
include/unilistiter.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 2002-2005 Net Integration Technologies, Inc.
4 *
5 * A simple implementation of a UniConfGen iterator.
6 */
7#ifndef __UNILISTITER_H
8#define __UNILISTITER_H
9
10#include "uniconfgen.h"
11#include "wvscatterhash.h"
12#include "wvstringcache.h"
13#include "wvstringlist.h"
14
27class UniListIter : public UniConfGen::Iter
28{
29 IUniConfGen *gen;
30
31 DeclareWvScatterTable(UniConfKey);
32 UniConfKeyTable keylook;
33
34
35 UniConfKeyList keys;
36 WvStringList values;
37
38 UniConfKeyList::Iter ki;
39 WvStringList::Iter vi;
40
41 WvStringCache scache;
42
43public:
44 UniListIter(IUniConfGen *_gen);
45
54 void add(const UniConfKey &k, WvStringParm v = WvString::null);
55
65 void autofill(IUniConfGen::Iter *source);
66
67 /***** Overridden members *****/
68 virtual void rewind();
69 virtual bool next();
70 virtual UniConfKey key() const;
71 virtual WvString value() const;
72};
73
74#endif // __UNILISTITER_H
An abstract iterator over keys and values in a generator.
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
An iterator that iterates through a constant list of keys.
virtual WvString value() const
Returns the value of the current key.
void autofill(IUniConfGen::Iter *source)
Automatically fill the contents of this iterator by calling add() for each element of the 'source' it...
virtual UniConfKey key() const
Returns the current key.
void add(const UniConfKey &k, WvStringParm v=WvString::null)
Add a key/value pair to the list that gets returned by this iterator.
virtual bool next()
Seeks to the next element in the sequence.
virtual void rewind()
Rewinds the iterator.
WvString is an implementation of a simple and efficient printable-string class.