| 141 | } |
| 142 | |
| 143 | bool ParsePositiveDouble(const std::string& text, double* value) { |
| 144 | if (text.empty()) { |
| 145 | return false; |
| 146 | } |
| 147 | char* end = nullptr; |
| 148 | const double parsed = std::strtod(text.c_str(), &end); |
| 149 | if (end == text.c_str() || *end != '\0' || parsed <= 0.0) { |
| 150 | return false; |
| 151 | } |
| 152 | *value = parsed; |
| 153 | return true; |
| 154 | } |
| 155 | |
| 156 | bool ParseNonNegativeDouble(const std::string& text, double* value) { |
| 157 | if (text.empty()) { |
no test coverage detected