| 176 | } |
| 177 | throw std::runtime_error(std::string(key) + " must be true/false, yes/no, on/off, or 1/0"); |
| 178 | } |
| 179 | |
| 180 | std::optional<int> parse_int_option( |
| 181 | const std::unordered_map<std::string, std::string> & options, |
| 182 | std::initializer_list<std::string_view> keys) { |
| 183 | if (const auto match = find_option_match(options, keys)) { |
| 184 | return parse_int_value(match->value, match->key); |
| 185 | } |
| 186 | return std::nullopt; |
| 187 | } |
| 188 | |
| 189 | std::optional<float> parse_float_option( |
| 190 | const std::unordered_map<std::string, std::string> & options, |
| 191 | std::initializer_list<std::string_view> keys) { |
| 192 | if (const auto match = find_option_match(options, keys)) { |
| 193 | return parse_float_value(match->value, match->key); |
no test coverage detected