WvStreams
Main Page
Modules
Classes
Files
File List
File Members
uniconf
unilistiter.cc
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"
8
9
UniListIter::UniListIter(
IUniConfGen
*_gen)
10
: ki(keys), vi(values)
11
{
12
gen = _gen;
13
}
14
15
16
void
UniListIter::add
(
const
UniConfKey
&k,
WvStringParm
v)
17
{
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
);
23
}
24
25
26
void
UniListIter::autofill
(IUniConfGen::Iter *_source)
27
{
28
IUniConfGen::Iter &source(*_source);
29
for
(source.rewind(); source.next(); )
30
add
(source.key(), source.value());
31
}
32
33
34
void
UniListIter::rewind
()
35
{
36
ki.rewind();
37
vi.rewind();
38
}
39
40
41
bool
UniListIter::next
()
42
{
43
if
(vi.cur())
44
vi.next();
45
return
ki.next();
46
}
47
48
49
UniConfKey
UniListIter::key
()
const
50
{
51
return
*ki;
52
}
53
54
55
WvString
UniListIter::value
()
const
56
{
57
if
(vi.cur())
58
return
*vi;
59
else
60
return
gen->
get
(*ki);
61
}
Generated on Mon Jul 16 2012 13:15:39 for WvStreams by
1.8.1.1