WvConf is a file management class used to read/write config files that are formatted in the style of Windows .ini files.
The most common used functions are:
WvConf cfg("filename.ini")
for initialization.
const char *WvConf::get(WvStringParm section, WvStringParm entry, const char *def_val)
gets the value of variable "entry" in section "section". If it is not set, return the default value "def_val".
int WvConf::getint(WvStringParm section, WvStringParm entry, int def_val)
This "int" version of get is smart enough to interpret words like on/off, true/false, and yes/no.
void WvConf::set(WvStringParm section, WvStringParm entry, const char *value)
set the value of [section]entry to be "value".
void WvConf::setint(WvStringParm section, WvStringParm entry, int value)
set the value of [section]entry to be "value". It just converts "value" to a string.
WvString WvConf::getraw(WvString wvconfstr, int &parse_error)
Gets an entry, given a string in the form [section]entry=value. Returns the value or NULL if not found. The parameter parse_error is set to the return value of parse_wvconf_request.
void WvConf::setraw(WvString wvconfstr, const char *&xvalue, int &parse_error)
Takes a string in the form [section]entry=value and sets it. Returns an error code as defined in parse_wvconf_request. The value parameter is also set to the value (useful in rcommand, when we display the value after it has been set).
void WvConf::maybeset(WvStringParm section, WvStringParm entry, const char *value)
only set the value if it isn't already in the config file.
void WvConf::maybesetint(WvStringParm section, WvStringParm entry, int value)
only set the value if it isn't already in the config file.
void WvConf::delete_section(WvStringParm section)
deletes the entire section.