config checking: only test skippedPaths existence for user-added values, not defaults

This commit is contained in:
Jean-Francois Dockes
2015-06-08 13:20:06 +02:00
parent 4989d1f991
commit c7f5318e43
4 changed files with 31 additions and 17 deletions
+10 -8
View File
@@ -380,10 +380,10 @@ void RclConfig::setKeyDir(const string &dir)
m_defcharset.erase();
}
bool RclConfig::getConfParam(const string &name, int *ivp) const
bool RclConfig::getConfParam(const string &name, int *ivp, bool shallow) const
{
string value;
if (!getConfParam(name, value))
if (!getConfParam(name, value, shallow))
return false;
errno = 0;
long lval = strtol(value.c_str(), 0, 0);
@@ -394,37 +394,39 @@ bool RclConfig::getConfParam(const string &name, int *ivp) const
return true;
}
bool RclConfig::getConfParam(const string &name, bool *bvp) const
bool RclConfig::getConfParam(const string &name, bool *bvp, bool shallow) const
{
if (!bvp)
return false;
*bvp = false;
string s;
if (!getConfParam(name, s))
if (!getConfParam(name, s, shallow))
return false;
*bvp = stringToBool(s);
return true;
}
bool RclConfig::getConfParam(const string &name, vector<string> *svvp) const
bool RclConfig::getConfParam(const string &name, vector<string> *svvp,
bool shallow) const
{
if (!svvp)
return false;
svvp->clear();
string s;
if (!getConfParam(name, s))
if (!getConfParam(name, s, shallow))
return false;
return stringToStrings(s, *svvp);
}
bool RclConfig::getConfParam(const string &name, vector<int> *vip) const
bool RclConfig::getConfParam(const string &name, vector<int> *vip,
bool shallow) const
{
if (!vip)
return false;
vip->clear();
vector<string> vs;
if (!getConfParam(name, &vs))
if (!getConfParam(name, &vs, shallow))
return false;
vip->reserve(vs.size());
for (unsigned int i = 0; i < vs.size(); i++) {
+10 -6
View File
@@ -123,21 +123,25 @@ class RclConfig {
string getKeyDir() const {return m_keydir;}
/** Get generic configuration parameter according to current keydir */
bool getConfParam(const string &name, string &value) const
bool getConfParam(const string &name, string &value,
bool shallow=false) const
{
if (m_conf == 0)
return false;
return m_conf->get(name, value, m_keydir);
return m_conf->get(name, value, m_keydir, shallow);
}
/** Variant with autoconversion to int */
bool getConfParam(const string &name, int *value) const;
bool getConfParam(const string &name, int *value, bool shallow=false) const;
/** Variant with autoconversion to bool */
bool getConfParam(const string &name, bool *value) const;
bool getConfParam(const string &name, bool *value,
bool shallow=false) const;
/** Variant with conversion to vector<string>
* (stringToStrings). Can fail if the string is malformed. */
bool getConfParam(const string &name, vector<string> *value) const;
bool getConfParam(const string &name, vector<string> *value,
bool shallow=false) const;
/** Variant with conversion to vector<int> */
bool getConfParam(const string &name, vector<int> *value) const;
bool getConfParam(const string &name, vector<int> *value,
bool shallow=false) const;
enum ThrStage {ThrIntern=0, ThrSplit=1, ThrDbWrite=2};
pair<int, int> getThrConf(ThrStage who) const;