2018-03-25 14:32:11 +02:00
|
|
|
#ifndef UTIL_H
|
|
|
|
#define UTIL_H
|
2014-07-08 14:54:27 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <fstream>
|
|
|
|
|
2018-03-25 14:32:11 +02:00
|
|
|
std::string read_setting(const std::string &name, std::istream &is);
|
2014-07-08 14:54:27 +02:00
|
|
|
|
2018-03-25 14:32:11 +02:00
|
|
|
inline std::string read_setting_default(const std::string &name, std::istream &is, const std::string &def)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
return read_setting(name, is);
|
2020-03-27 19:32:30 +01:00
|
|
|
} catch(const std::runtime_error &e) {
|
2018-03-25 14:32:11 +02:00
|
|
|
return def;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // UTIL_H
|