WvStreams
nofile.cc
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * Plays with WvConfigSectionList (without the WvConf file interface wrapper)
6 *
7 */
8 
9 #include "wvconf.h"
10 
11 int main()
12 {
13  WvConfigSectionList sectlist;
14  sectlist.append(new WvConfigSection("Hello"), true);
15  sectlist.append(new WvConfigSection("Hellooo"), true);
16  sectlist.append(new WvConfigSection("\n# test\n"), true);
17  sectlist.append(new WvConfigSection("aaaa"), true);
18  sectlist.append(new WvConfigSection("bbbb"), true);
19 
20  WvConfigSectionList::Iter zzz(sectlist);
21  zzz.rewind();zzz.next();
22  WvConfigSection *sect = &*zzz;
23 
24  if(!sect) {
25  printf("crap\n");
26  return 0;
27  }
28 
29  sect->set("suck", "blah");
30  sect->set("buck", "more blah");
31  sect->set("luck", "even more");
32  sect->set("duck", "bored now");
33 
34 
35  zzz.rewind(); zzz.next();
36  sect = &*zzz;
37 
38  WvConfigEntry *luck = (*zzz)["luck"];
39 
40  if(!!luck)
41  {
42  WvString value = luck->value;
43  value = WvString("DIRTIED! [%s]", value);
44  luck->value = value;
45  printf("Lucky me [%s]\n", luck->value.edit());
46  }
47  else
48  zzz->quick_set("weeeee", "waaaaah");
49 
50  zzz->quick_set("weeeee", "ARGH");
51 
52 
53  printf("--- list everything ---\n");
54  for(zzz.rewind(); zzz.next(); )
55  {
56  printf("[%s]\n", zzz->name.edit());
57  zzz->dump(*wvcon);
58  }
59  printf("------- end list ------\n");
60 
61  return 0;
62 
63 }
WvString::edit
char * edit()
make the string editable, and return a non-const (char*)
Definition: wvstring.h:397
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
WvConfigSection
Definition: wvconf.h:53
WvConfigEntry
Definition: wvconf.h:35