13WvConfigSection::WvConfigSection(WvStringParm _name)
19WvConfigSection::~WvConfigSection()
26WvConfigEntry *WvConfigSection::operator[] (WvStringParm ename)
30 for (i.rewind(); i.next();)
32 if (strcasecmp(i().name, ename) == 0)
40const char *WvConfigSection::get(WvStringParm entry,
const char *def_val)
42 WvConfigEntry *e = (*this)[entry];
43 return e ? (
const char *)e->value : def_val;
47void WvConfigSection::set(WvStringParm entry, WvStringParm value)
49 WvString clean_entry = entry;
51 WvConfigEntry *e = (*this)[clean_entry];
54 if (!value || !value[0])
64 append(
new WvConfigEntry(clean_entry, value),
true);
68void WvConfigSection::quick_set(WvStringParm entry, WvStringParm value)
70 WvString clean_entry = entry;
72 append(
new WvConfigEntry(clean_entry, value),
true);
76void WvConfigSection::dump(
WvStream &fp)
80 for (i.rewind(); i.next(); )
82 WvConfigEntry &e = *i;
83 if (e.value && e.value[0])
84 fp.print(
"%s = %s\n", e.name, e.value);
86 fp.print(
"%s =\n", e.name);
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
char * edit()
make the string editable, and return a non-const (char*)
char * trim_string(char *string)
Trims whitespace from the beginning and end of the character string, including carriage return / line...