A selection of relatively minor problems in the build system.
[wvstreams.git] / uniconf / unilistiter.cc
blob789124f9b5187e710324c43029a782a0bd387474
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 2002 Net Integration Technologies, Inc.
4 *
5 * A simple implementation of a UniConfGen iterator. See unilistiter.h.
6 */
7 #include "unilistiter.h"
9 UniListIter::UniListIter(IUniConfGen *_gen)
10 : ki(keys), vi(values)
12 gen = _gen;
16 void UniListIter::add(const UniConfKey &k, WvStringParm v)
18 UniConfKey *nk = new UniConfKey(k);
19 keys.append(nk, true);
20 keylook.add(nk, false);
21 if (!v.isnull())
22 values.append(new WvString(scache.get(v)), true);
26 void UniListIter::autofill(IUniConfGen::Iter *_source)
28 IUniConfGen::Iter &source(*_source);
29 for (source.rewind(); source.next(); )
30 add(source.key(), source.value());
34 void UniListIter::rewind()
36 ki.rewind();
37 vi.rewind();
41 bool UniListIter::next()
43 if (vi.cur())
44 vi.next();
45 return ki.next();
49 UniConfKey UniListIter::key() const
51 return *ki;
55 WvString UniListIter::value() const
57 if (vi.cur())
58 return *vi;
59 else
60 return gen->get(*ki);