| 150 | } |
| 151 | |
| 152 | std::optional<float> OHDUtil::string_to_float(const std::string& s) { |
| 153 | try { |
| 154 | auto ret = std::stof(s); |
| 155 | return ret; |
| 156 | } catch (...) { |
| 157 | openhd::log::get_default()->warn("Cannot convert [{}] to float", s); |
| 158 | return std::nullopt; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | std::optional<long> OHDUtil::string_to_long_hex(const std::string& s) { |
| 163 | if (!contains(s, "0x")) return std::nullopt; |
nothing calls this directly
no outgoing calls
no test coverage detected