| 426 | // Range-checked narrowing: sets *ok = false if parsed value doesn't fit in T |
| 427 | template<class T, class ParseT> |
| 428 | static QByteArray parseIntChecked(ParseT val, bool* ok) { |
| 429 | if (*ok) { |
| 430 | using L = std::numeric_limits<T>; |
| 431 | if constexpr (std::is_signed_v<T>) { |
| 432 | if (val < (ParseT)L::min() || val > (ParseT)L::max()) *ok = false; |
| 433 | } else { |
| 434 | if (val > (ParseT)L::max()) *ok = false; |
| 435 | } |
| 436 | } |
| 437 | return *ok ? toBytes<T>(static_cast<T>(val)) : QByteArray{}; |
| 438 | } |
| 439 | |
| 440 | QByteArray parseValue(NodeKind kind, const QString& text, bool* ok) { |
| 441 | *ok = false; |
nothing calls this directly
no outgoing calls
no test coverage detected