|
a/src/conftree.hxx |
|
b/src/conftree.hxx |
|
... |
|
... |
47 |
* The ConfStack class stacks several Con(Simple/Tree) objects so that
|
47 |
* The ConfStack class stacks several Con(Simple/Tree) objects so that
|
48 |
* parameters from the top of the stack override the values from lower
|
48 |
* parameters from the top of the stack override the values from lower
|
49 |
* (useful to have central/personal config files)
|
49 |
* (useful to have central/personal config files)
|
50 |
*/
|
50 |
*/
|
51 |
|
51 |
|
52 |
#include <time.h> // for time_t
|
52 |
#include <algorithm>
|
53 |
#include <algorithm> // for sort, unique
|
53 |
#include <map>
|
54 |
#include <map> // for map, etc
|
54 |
#include <string>
|
55 |
#include <string> // for string, operator==, etc
|
55 |
#include <vector>
|
56 |
#include <vector> // for vector, etc
|
|
|
57 |
|
56 |
|
58 |
// rh7.3 likes iostream better...
|
57 |
// rh7.3 likes iostream better...
|
59 |
#if defined(__GNUC__) && __GNUC__ < 3
|
58 |
#if defined(__GNUC__) && __GNUC__ < 3
|
60 |
#include <iostream>
|
59 |
#include <iostream>
|
61 |
#else
|
60 |
#else
|
62 |
#include <istream> // for istream, ostream
|
61 |
#include <istream>
|
|
|
62 |
#include <ostream>
|
63 |
#endif
|
63 |
#endif
|
64 |
|
64 |
|
65 |
#include "upmpdutils.hxx" // for path_cat
|
65 |
#include "upmpdutils.hxx"
|
66 |
|
66 |
|
67 |
using std::string;
|
67 |
using std::string;
|
68 |
using std::vector;
|
68 |
using std::vector;
|
69 |
using std::map;
|
69 |
using std::map;
|
70 |
using std::istream;
|
70 |
using std::istream;
|
|
... |
|
... |
391 |
}
|
391 |
}
|
392 |
}
|
392 |
}
|
393 |
return false;
|
393 |
return false;
|
394 |
}
|
394 |
}
|
395 |
|
395 |
|
396 |
virtual int get(const string& name, string& value, const string& sk) const {
|
396 |
virtual int get(const string& name, string& value, const string& sk,
|
|
|
397 |
bool shallow) const {
|
397 |
typename vector<T*>::const_iterator it;
|
398 |
typename vector<T*>::const_iterator it;
|
398 |
for (it = m_confs.begin(); it != m_confs.end(); it++) {
|
399 |
for (it = m_confs.begin(); it != m_confs.end(); it++) {
|
399 |
if ((*it)->get(name, value, sk)) {
|
400 |
if ((*it)->get(name, value, sk)) {
|
400 |
return true;
|
401 |
return true;
|
401 |
}
|
402 |
}
|
|
|
403 |
if (shallow) {
|
|
|
404 |
break;
|
|
|
405 |
}
|
402 |
}
|
406 |
}
|
403 |
return false;
|
407 |
return false;
|
|
|
408 |
}
|
|
|
409 |
virtual int get(const string& name, string& value, const string& sk) const {
|
|
|
410 |
return get(name, value, sk, false);
|
404 |
}
|
411 |
}
|
405 |
|
412 |
|
406 |
virtual bool hasNameAnywhere(const string& nm) const {
|
413 |
virtual bool hasNameAnywhere(const string& nm) const {
|
407 |
typename vector<T*>::const_iterator it;
|
414 |
typename vector<T*>::const_iterator it;
|
408 |
for (it = m_confs.begin(); it != m_confs.end(); it++) {
|
415 |
for (it = m_confs.begin(); it != m_confs.end(); it++) {
|