//-----------------------------------------------------------------------------
SETTINGS_IMPL::SETTINGS_IMPL()
- : strError(),
+ : SETTINGS(),
+ strError(),
modulesPath("/usr/lib/stg"),
dirName(DIR_NUM),
confDir("/etc/stargazer"),
}
//-----------------------------------------------------------------------------
SETTINGS_IMPL::SETTINGS_IMPL(const std::string & cd)
- : strError(),
+ : SETTINGS(),
+ strError(),
modulesPath("/usr/lib/stg"),
dirName(DIR_NUM),
confDir(cd),
}
//-----------------------------------------------------------------------------
SETTINGS_IMPL::SETTINGS_IMPL(const SETTINGS_IMPL & rval)
- : strError(),
+ : SETTINGS(),
+ strError(),
modulesPath(rval.modulesPath),
dirName(rval.dirName),
confDir(rval.confDir),
{
}
//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseYesNo(const string & value, bool * val)
-{
-if (0 == strcasecmp(value.c_str(), "yes"))
- {
- *val = true;
- return 0;
- }
-if (0 == strcasecmp(value.c_str(), "no"))
- {
- *val = false;
- return 0;
- }
-
-strError = "Incorrect value \'" + value + "\'.";
-return -1;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseInt(const string & value, int * val)
-{
-if (str2x<int>(value, *val))
- {
- strError = "Cannot convert \'" + value + "\' to integer.";
- return -1;
- }
-return 0;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseUnsigned(const string & value, unsigned * val)
-{
-if (str2x<unsigned>(value, *val))
- {
- strError = "Cannot convert \'" + value + "\' to unsigned integer.";
- return -1;
- }
-return 0;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseIntInRange(const string & value, int min, int max, int * val)
-{
-if (ParseInt(value, val) != 0)
- return -1;
-
-if (*val < min || *val > max)
- {
- strError = "Value \'" + value + "\' out of range.";
- return -1;
- }
-
-return 0;
-}
-//-----------------------------------------------------------------------------
-int SETTINGS_IMPL::ParseUnsignedInRange(const string & value, unsigned min, unsigned max, unsigned * val)
-{
-if (ParseUnsigned(value, val) != 0)
- return -1;
-
-if (*val < min || *val > max)
- {
- strError = "Value \'" + value + "\' out of range.";
- return -1;
- }
-
-return 0;
-}
-//-----------------------------------------------------------------------------
int SETTINGS_IMPL::ParseModuleSettings(const DOTCONFDocumentNode * node, vector<PARAM_VALUE> * params)
{
const DOTCONFDocumentNode * childNode;