1 #ifndef __STG_SGCONF_UTILS_H__
2 #define __STG_SGCONF_UTILS_H__
4 #include "stg/common.h"
5 #include "stg/resetable.h"
15 void MaybeSet(const std::map<std::string, std::string> & options, const std::string & name, RESETABLE<T> & res)
17 std::map<std::string, std::string>::const_iterator it(options.find(name));
18 if (it == options.end())
21 if (str2x(it->second, value) < 0)
26 template <typename T, typename F>
28 void MaybeSet(const std::map<std::string, std::string> & options, const std::string & name, RESETABLE<T> & res, F conv)
30 std::map<std::string, std::string>::const_iterator it(options.find(name));
31 if (it == options.end())
33 conv(it->second, res);
38 void MaybeSet<std::string>(const std::map<std::string, std::string> & options, const std::string & name, RESETABLE<std::string> & res)
40 std::map<std::string, std::string>::const_iterator it(options.find(name));
41 if (it == options.end())