boost::optional<double> asDouble(const JsonObject &json, const std::string &errorBad, Severity severity) { if(json.isDouble()) { return boost::optional<double>(json.asDouble()); } return boost::none; }
boost::optional<double> STADIC_API getDouble(const JsonObject &json, const std::string &key) { JsonObject value = json[key]; if(value.isNull()) { return boost::none; } else if(value.isDouble()) { return boost::optional<double>(value.asDouble()); } return boost::none; }
boost::optional<double> getDouble(const JsonObject &json, const std::string &key, const std::string &errorMissing, const std::string &errorBad, Severity severity) { JsonObject value = json[key]; if(value.isNull()) { STADIC_LOG(severity, errorMissing); } else { if(value.isDouble()) { return boost::optional<double>(value.asDouble()); } else { STADIC_LOG(severity, errorBad); } } return boost::none; }