Switch to unified view

a/src/utils/conftree.cpp b/src/utils/conftree.cpp
...
...
196
    }       
196
    }       
197
197
198
    parseinput(input);
198
    parseinput(input);
199
}
199
}
200
200
201
ConfSimple::StatusCode ConfSimple::getStatus()
201
ConfSimple::StatusCode ConfSimple::getStatus() const
202
{
202
{
203
    switch (status) {
203
    switch (status) {
204
    case STATUS_RO: return STATUS_RO;
204
    case STATUS_RO: return STATUS_RO;
205
    case STATUS_RW: return STATUS_RW;
205
    case STATUS_RW: return STATUS_RW;
206
    default: return STATUS_ERROR;
206
    default: return STATUS_ERROR;
207
    }
207
    }
208
}
208
}
209
209
210
int ConfSimple::get(const string &nm, string &value, const string &sk)
210
int ConfSimple::get(const string &nm, string &value, const string &sk) const
211
{
211
{
212
    if (!ok())
212
    if (!ok())
213
    return 0;
213
    return 0;
214
214
215
    // Find submap
215
    // Find submap
216
    map<string, map<string, string> >::iterator ss;
216
    map<string, map<string, string> >::const_iterator ss;
217
    if ((ss = m_submaps.find(sk)) == m_submaps.end()) 
217
    if ((ss = m_submaps.find(sk)) == m_submaps.end()) 
218
    return 0;
218
    return 0;
219
219
220
    // Find named value
220
    // Find named value
221
    map<string, string>::iterator s;
221
    map<string, string>::const_iterator s;
222
    if ((s = ss->second.find(nm)) == ss->second.end()) 
222
    if ((s = ss->second.find(nm)) == ss->second.end()) 
223
    return 0;
223
    return 0;
224
    value = s->second;
224
    value = s->second;
225
    return 1;
225
    return 1;
226
}
226
}
...
...
440
}
440
}
441
441
442
// Write out the tree in configuration file format:
442
// Write out the tree in configuration file format:
443
// This does not check holdWrites, this is done by write(void), which
443
// This does not check holdWrites, this is done by write(void), which
444
// lets ie: listall work even when holdWrites is set
444
// lets ie: listall work even when holdWrites is set
445
bool ConfSimple::write(ostream& out)
445
bool ConfSimple::write(ostream& out) const
446
{
446
{
447
    if (!ok())
447
    if (!ok())
448
    return false;
448
    return false;
449
    string sk;
449
    string sk;
450
    for (list<ConfLine>::const_iterator it = m_order.begin(); 
450
    for (list<ConfLine>::const_iterator it = m_order.begin(); 
...
...
544
// //////////////////////////////////////////////////////////////////////////
544
// //////////////////////////////////////////////////////////////////////////
545
// ConfTree Methods: conftree interpret keys like a hierarchical file tree
545
// ConfTree Methods: conftree interpret keys like a hierarchical file tree
546
// //////////////////////////////////////////////////////////////////////////
546
// //////////////////////////////////////////////////////////////////////////
547
547
548
int ConfTree::get(const std::string &name, string &value, const string &sk)
548
int ConfTree::get(const std::string &name, string &value, const string &sk)
549
    const
549
{
550
{
550
    if (sk.empty() || sk[0] != '/') {
551
    if (sk.empty() || sk[0] != '/') {
551
    //  LOGDEB((stderr, "ConfTree::get: looking in global space\n"));
552
    //  LOGDEB((stderr, "ConfTree::get: looking in global space\n"));
552
    return ConfSimple::get(name, value, sk);
553
    return ConfSimple::get(name, value, sk);
553
    }
554
    }