Commit 148e7eec authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

add getConfParam->std::set

parent 90bae886
......@@ -395,7 +395,7 @@ bool RclConfig::getConfParam(const string &name, bool *bvp, bool shallow) const
}
bool RclConfig::getConfParam(const string &name, vector<string> *svvp,
bool shallow) const
bool shallow) const
{
if (!svvp)
return false;
......@@ -406,8 +406,20 @@ bool RclConfig::getConfParam(const string &name, vector<string> *svvp,
return stringToStrings(s, *svvp);
}
bool RclConfig::getConfParam(const string &name, unordered_set<string> *out,
bool shallow) const
{
vector<string> v;
if (!out || !getConfParam(name, &v, shallow)) {
return false;
}
out->clear();
out->insert(v.begin(), v.end());
return true;
}
bool RclConfig::getConfParam(const string &name, vector<int> *vip,
bool shallow) const
bool shallow) const
{
if (!vip)
return false;
......@@ -420,7 +432,8 @@ bool RclConfig::getConfParam(const string &name, vector<int> *vip,
char *ep;
vip->push_back(strtol(vs[i].c_str(), &ep, 0));
if (ep == vs[i].c_str()) {
LOGDEB("RclConfig::getConfParam: bad int value in [" << (name) << "]\n" );
LOGDEB("RclConfig::getConfParam: bad int value in [" << name <<
"]\n");
return false;
}
}
......
......@@ -140,6 +140,10 @@ class RclConfig {
* (stringToStrings). Can fail if the string is malformed. */
bool getConfParam(const string &name, vector<string> *value,
bool shallow=false) const;
/** Variant with conversion to unordered_set<string>
* (stringToStrings). Can fail if the string is malformed. */
bool getConfParam(const string &name, std::unordered_set<std::string> *v,
bool shallow=false) const;
/** Variant with conversion to vector<int> */
bool getConfParam(const string &name, vector<int> *value,
bool shallow=false) const;
......@@ -189,8 +193,7 @@ class RclConfig {
string getIdxStatusFile() const;
/** Do path translation according to the ptrans table */
void urlrewrite(const string& dbdir, string& url) const;
ConfSimple *getPTrans()
{
ConfSimple *getPTrans() {
return m_ptrans;
}
/** Get Web Queue directory name */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment