15 return c >=
'0' && c <=
'9';
20 return c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r' || c ==
'\f' || c ==
'\v';
25 if (!str)
return false;
32 if (*str ==
'\0')
return false;
34 bool negative =
false;
38 }
else if (*str ==
'+') {
42 if (*str ==
'\0' || !
isDigit(*str))
return false;
45 const fl::u32 max_div_10 = 214748364U;
46 const fl::u32 max_mod_10 = 7U;
47 const fl::u32 max_neg_div_10 = 214748364U;
48 const fl::u32 max_neg_mod_10 = 8U;
51 fl::u32 digit = *str -
'0';
55 if (
value > max_neg_div_10 || (
value == max_neg_div_10 && digit > max_neg_mod_10)) {
59 if (
value > max_div_10 || (
value == max_div_10 && digit > max_mod_10)) {
69 if (*str !=
'\0')
return false;
82 if (!str)
return false;
89 if (*str ==
'\0')
return false;
94 }
else if (*str ==
'-') {
98 if (*str ==
'\0' || !
isDigit(*str))
return false;
101 const fl::u32 max_div_10 = 429496729U;
102 const fl::u32 max_mod_10 = 5U;
104 while (*str &&
isDigit(*str)) {
105 fl::u32 digit = *str -
'0';
108 if (
value > max_div_10 || (
value == max_div_10 && digit > max_mod_10)) {
117 if (*str !=
'\0')
return false;
147 if (c ==
'\n')
break;
148 if (c ==
'\r')
continue;
201 return !token.
empty();
235 if (parse_i32(token.
c_str(), temp) && temp >= -128 && temp <= 127) {
236 n =
static_cast<fl::i8>(temp);
250 if (parse_u32(token.
c_str(), temp) && temp <= 255) {
251 n =
static_cast<fl::u8>(temp);
265 if (parse_i32(token.
c_str(), temp) && temp >= -32768 && temp <= 32767) {
266 n =
static_cast<fl::i16
>(temp);
281 if (!parse_i32(token.
c_str(), n)) {
293 if (!parse_u32(token.
c_str(), n)) {
310 if (
fl::almost_equal(f, 0.0f) && token !=
"0" && token !=
"0.0" && token !=
"0." && token.
find(
"0") != 0) {
324 d =
static_cast<double>(f);
326 if (
fl::almost_equal(f, 0.0f) && token !=
"0" && token !=
"0.0" && token !=
"0." && token.
find(
"0") != 0) {
358 if (c ==
'\n')
break;
359 if (c ==
'\r')
continue;
361 char ch[2] = {
static_cast<char>(c),
'\0'};
377 return static_cast<int>(
static_cast<unsigned char>(
mBuffer[
mPos++]));
410 return static_cast<int>(
static_cast<unsigned char>(
mBuffer[
mPos]));
float toFloat() const FL_NOEXCEPT
bool empty() const FL_NOEXCEPT
void clear(bool freeMemory=false) FL_NOEXCEPT
fl::size find(const char &value) const FL_NOEXCEPT
const char * c_str() const FL_NOEXCEPT
istream_real & putback(char c)
char mBuffer[BUFFER_SIZE]
istream_real() FL_NOEXCEPT=default
static const fl::size BUFFER_SIZE
istream_real & operator>>(string &str)
bool readToken(string &token)
istream_real & getline(string &str)
string & append(const bitset_fixed< N > &bs) FL_NOEXCEPT
bool parse_u32(const char *str, fl::u32 &result)
bool parse_i32(const char *str, fl::i32 &result)
constexpr int type_rank< T >::value
FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS istream cin
constexpr bool almost_equal(T a, T b, U tolerance) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
istream_real & cin_real()
Base definition for an LED controller.
#define FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS