X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/ac3670b33981698a02c5e95ab4f11cb3fe57562d..29e9a2de0b45893850bbf56ee38e7fd235a6df15:/projects/sgconf/utils.h diff --git a/projects/sgconf/utils.h b/projects/sgconf/utils.h deleted file mode 100644 index 3793c9cd..00000000 --- a/projects/sgconf/utils.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __STG_SGCONF_UTILS_H__ -#define __STG_SGCONF_UTILS_H__ - -#include "stg/common.h" -#include "stg/resetable.h" - -#include -#include - -namespace SGCONF -{ - -template -inline -void MaybeSet(const std::map & options, const std::string & name, RESETABLE & res) -{ -std::map::const_iterator it(options.find(name)); -if (it == options.end()) - return; -T value; -if (str2x(it->second, value) < 0) - return; -res = value; -} - -template -inline -void MaybeSet(const std::map & options, const std::string & name, T & res, F conv) -{ -std::map::const_iterator it(options.find(name)); -if (it == options.end()) - return; -conv(it->second, res); -} - -template <> -inline -void MaybeSet(const std::map & options, const std::string & name, RESETABLE & res) -{ -std::map::const_iterator it(options.find(name)); -if (it == options.end()) - return; -res = it->second; -} - -} // namespace SGCONF - -#endif