00001
00002
00003
00004
00005
00006
00007
00008
00009
#include "wvconf.h"
00010
00011 int main()
00012 {
00013
WvConfigSectionList sectlist;
00014 sectlist.append(
new WvConfigSection(
"Hello"),
true);
00015 sectlist.append(
new WvConfigSection(
"Hellooo"),
true);
00016 sectlist.append(
new WvConfigSection(
"\n# test\n"),
true);
00017 sectlist.append(
new WvConfigSection(
"aaaa"),
true);
00018 sectlist.append(
new WvConfigSection(
"bbbb"),
true);
00019
00020 WvConfigSectionList::Iter zzz(sectlist);
00021 zzz.rewind();zzz.next();
00022
WvConfigSection *sect = &*zzz;
00023
00024
if(!sect) {
00025 printf(
"crap\n");
00026
return 0;
00027 }
00028
00029 sect->
set(
"suck",
"blah");
00030 sect->
set(
"buck",
"more blah");
00031 sect->
set(
"luck",
"even more");
00032 sect->
set(
"duck",
"bored now");
00033
00034
00035 zzz.rewind(); zzz.next();
00036 sect = &*zzz;
00037
00038
WvConfigEntry *luck = (*zzz)[
"luck"];
00039
00040
if(!!luck)
00041 {
00042
WvString value = luck->
value;
00043 value =
WvString(
"DIRTIED! [%s]", value);
00044 luck->
value = value;
00045 printf(
"Lucky me [%s]\n", luck->
value.
edit());
00046 }
00047
else
00048 zzz->quick_set(
"weeeee",
"waaaaah");
00049
00050 zzz->quick_set(
"weeeee",
"ARGH");
00051
00052
00053 printf(
"--- list everything ---\n");
00054
for(zzz.rewind(); zzz.next(); )
00055 {
00056 printf(
"[%s]\n", zzz->
name.
edit());
00057 zzz->dump(*
wvcon);
00058 }
00059 printf(
"------- end list ------\n");
00060
00061
return 0;
00062
00063 }