15 : _current(input.data()), _end(input.data() + input.size())
19 void reset(std::string_view input) noexcept
21 _current = input.data();
22 _end = input.data() + input.size();
28 return parseNumber(value);
31 [[nodiscard]]
bool hasMore() const noexcept
33 return _current < _end;
40 void skipSpaces() noexcept
42 while (_current < _end && *_current ==
' ')
46 template <
typename T>
bool parseNumber(T &value) noexcept
51 if constexpr (std::is_integral_v<T>)
54 long long tmp = std::strtoll(_current, &next, 10);
55 if (_current == next || errno == ERANGE)
57 value =
static_cast<T
>(tmp);
59 else if constexpr (std::is_unsigned_v<T>)
61 unsigned long long tmp = std::strtoull(_current, &next, 10);
62 if (_current == next || errno == ERANGE)
64 value =
static_cast<T
>(tmp);
66 else if constexpr (std::is_floating_point_v<T>)
68 long double tmp = std::strtold(_current, &next);
69 if (_current == next || errno == ERANGE)
71 value =
static_cast<T
>(tmp);
75 static_assert(!
sizeof(T *),
"parseNumber only supports integral or floating types");
Definition: NumParser.h:12
bool operator>>(T &value) noexcept
Definition: NumParser.h:25
bool hasMore() const noexcept
Definition: NumParser.h:31
void reset(std::string_view input) noexcept
Definition: NumParser.h:19
NumParser(std::string_view input) noexcept
Definition: NumParser.h:14
Definition: AllFlavorsShape.h:14