| 210 | |
| 211 | |
| 212 | bool parser_isValidReal(string str) { |
| 213 | |
| 214 | // reject str if it doesn't match regex |
| 215 | if (!parser_isAnySizedReal(str)) |
| 216 | return false; |
| 217 | |
| 218 | // check number is in-range of qreal via duck-typing |
| 219 | try { |
| 220 | precisionAgnosticStringToFloat(str); |
| 221 | } catch (const out_of_range&) { |
| 222 | return false; |
| 223 | |
| 224 | // error if our regex permitted an unparsable string |
| 225 | } catch (const invalid_argument&) { |
| 226 | error_attemptedToParseRealFromInvalidString(); |
| 227 | } |
| 228 | |
| 229 | return true; |
| 230 | } |
| 231 | |
| 232 | |
| 233 | qreal parser_parseReal(string str) { |
no test coverage detected