5inline ::string ellipsis(const_char_pointer psz, character_count len)
8 auto lenTotal = string_safe_length(scopedstr, len);
13 return ::string(scopedstr, len - 3) +
"...";
27inline ::u64 consume_natural(const_char_pointer &psz, const_char_pointer pszBegin, ::i32 iRadix)
30 char_pointer endptr =
nullptr;
32 auto u = strtoull(scopedstr, &endptr, iRadix);
37 if (::is_null(pszBegin))
44 throw_exception(error_premature_end_of_file,
"not natural number near \"" + ellipsis(maximum(scopedstr - 10, pszBegin), 20) +
"\"");
55inline ::i64 consume_integer(const_char_pointer &psz, const_char_pointer pszBegin, ::i32 iRadix)
59 char_pointer endptr =
nullptr;
61 auto i = strtoll(scopedstr, &endptr, 10);
66 if (::is_null(pszBegin))
73 throw_exception(error_parsing,
"not integer near \"" + ellipsis(maximum(scopedstr - 10, pszBegin), 20) +
"\"");
84inline ::f64 consume_floating(const_char_pointer &psz, const_char_pointer pszBegin, ::i32 iRadix = 10)
87 char_pointer endptr =
nullptr;
89 auto d = strtod(scopedstr, &endptr);
94 if (::is_null(pszBegin))
101 throw_exception(error_premature_end_of_file,
"not floating near \"" + ellipsis(maximum(scopedstr - 10, pszBegin), 20) +
"\"");
112#include "_impl_text_stream.h"