|
a/src/utils/conftree.h |
|
b/src/utils/conftree.h |
|
... |
|
... |
163 |
|
163 |
|
164 |
/**
|
164 |
/**
|
165 |
* Set value for named parameter in specified subsection (or global)
|
165 |
* Set value for named parameter in specified subsection (or global)
|
166 |
* @return 0 for error, 1 else
|
166 |
* @return 0 for error, 1 else
|
167 |
*/
|
167 |
*/
|
168 |
virtual int set(const string &nm, const string &val, const string &sk = string());
|
168 |
virtual int set(const string &nm, const string &val,
|
|
|
169 |
const string &sk = string());
|
169 |
|
170 |
|
170 |
/**
|
171 |
/**
|
171 |
* Remove name and value from config
|
172 |
* Remove name and value from config
|
172 |
*/
|
173 |
*/
|
173 |
virtual int erase(const string &name, const string &sk);
|
174 |
virtual int erase(const string &name, const string &sk);
|
|
... |
|
... |
206 |
/**
|
207 |
/**
|
207 |
* Return all subkeys
|
208 |
* Return all subkeys
|
208 |
*/
|
209 |
*/
|
209 |
virtual list<string> getSubKeys(bool) {return getSubKeys();}
|
210 |
virtual list<string> getSubKeys(bool) {return getSubKeys();}
|
210 |
virtual list<string> getSubKeys();
|
211 |
virtual list<string> getSubKeys();
|
|
|
212 |
/** Test for subkey existence */
|
|
|
213 |
virtual bool hasSubKey(const string& sk)
|
|
|
214 |
{
|
|
|
215 |
return m_submaps.find(sk) != m_submaps.end();
|
|
|
216 |
}
|
211 |
|
217 |
|
212 |
virtual string getFilename() {return m_filename;}
|
218 |
virtual string getFilename() {return m_filename;}
|
213 |
|
219 |
|
214 |
/**
|
220 |
/**
|
215 |
* Copy constructor. Expensive but less so than a full rebuild
|
221 |
* Copy constructor. Expensive but less so than a full rebuild
|
|
... |
|
... |
423 |
return m_confs.front()->holdWrites(on);
|
429 |
return m_confs.front()->holdWrites(on);
|
424 |
}
|
430 |
}
|
425 |
|
431 |
|
426 |
virtual list<string> getNames(const string &sk, const char *pattern = 0)
|
432 |
virtual list<string> getNames(const string &sk, const char *pattern = 0)
|
427 |
{
|
433 |
{
|
|
|
434 |
return getNames1(sk, pattern, false);
|
|
|
435 |
}
|
|
|
436 |
virtual list<string> getNamesShallow(const string &sk, const char *patt = 0)
|
|
|
437 |
{
|
|
|
438 |
return getNames1(sk, patt, true);
|
|
|
439 |
}
|
|
|
440 |
|
|
|
441 |
virtual list<string> getNames1(const string &sk, const char *pattern,
|
|
|
442 |
bool shallow)
|
|
|
443 |
{
|
428 |
list<string> nms;
|
444 |
list<string> nms;
|
429 |
typename list<T*>::iterator it;
|
445 |
typename list<T*>::iterator it;
|
|
|
446 |
bool skfound = false;
|
430 |
for (it = m_confs.begin();it != m_confs.end(); it++) {
|
447 |
for (it = m_confs.begin();it != m_confs.end(); it++) {
|
431 |
list<string> lst;
|
448 |
if ((*it)->hasSubKey(sk)) {
|
|
|
449 |
skfound = true;
|
432 |
lst = (*it)->getNames(sk, pattern);
|
450 |
list<string> lst = (*it)->getNames(sk, pattern);
|
433 |
nms.insert(nms.end(), lst.begin(), lst.end());
|
451 |
nms.insert(nms.end(), lst.begin(), lst.end());
|
|
|
452 |
}
|
|
|
453 |
if (shallow && skfound)
|
|
|
454 |
break;
|
434 |
}
|
455 |
}
|
435 |
nms.sort();
|
456 |
nms.sort();
|
436 |
nms.unique();
|
457 |
nms.unique();
|
437 |
return nms;
|
458 |
return nms;
|
438 |
}
|
459 |
}
|