MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / parseIntChecked

Function parseIntChecked

src/format.cpp:428–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426// Range-checked narrowing: sets *ok = false if parsed value doesn't fit in T
427template<class T, class ParseT>
428static 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
440QByteArray parseValue(NodeKind kind, const QString& text, bool* ok) {
441 *ok = false;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected