363 |
} |
} |
364 |
} |
} |
365 |
|
|
366 |
|
|
367 |
|
const char * TrueBoolStrings[] = { "yes", "true","enable", 0}; |
368 |
|
|
369 |
|
|
370 |
|
bool |
371 |
|
ConfigSection::get_as_bool(const std::string&key) |
372 |
|
{ |
373 |
|
std::string v = get(key); |
374 |
|
|
375 |
|
const char ** ptr = TrueBoolStrings; |
376 |
|
|
377 |
|
while (*ptr != 0) |
378 |
|
{ |
379 |
|
if (v == *ptr)return true; |
380 |
|
++ptr; |
381 |
|
} |
382 |
|
|
383 |
|
return false; |
384 |
|
} |
385 |
std::string |
std::string |
386 |
ConfigSection::get(const std::string&key)const |
ConfigSection::get(const std::string&key)const |
387 |
{ |
{ |
405 |
|
|
406 |
} |
} |
407 |
|
|
408 |
|
bool |
409 |
|
ConfigSection::get_b(const std::string& key, bool d) |
410 |
|
{ |
411 |
|
try |
412 |
|
{ |
413 |
|
return get_as_bool(key); |
414 |
|
} |
415 |
|
catch(ConfigMissingKey&x) |
416 |
|
{ |
417 |
|
return d; |
418 |
|
} |
419 |
|
} |
420 |
|
|
421 |
|
|
422 |
void |
void |
423 |
ConfigSection::set(const std::string& key, const std::string& value) |
ConfigSection::set(const std::string& key, const std::string& value) |
424 |
{ |
{ |