in Include/cpprestinclude/cpprest/streams.h [1358:1456]
static bool _accept_char(std::shared_ptr<_double_state<FloatingPoint>> state, int_type ch)
{
if ( state->minus == 0 )
{
if ( !::isdigit(ch) && ch != int_type('.') && ch != int_type('+') && ch != int_type('-') )
{
if (!state->complete)
state->p_exception_string = create_exception_message<FloatingPoint, int_type>(ch, false);
return false;
}
}
else
{
if (!state->exponent && !::isdigit(ch) && ch != int_type('.') && ch != int_type('E') && ch != int_type('e'))
{
if (!state->complete)
state->p_exception_string = create_exception_message<FloatingPoint, int_type>(ch, false);
return false;
}
if (state->exponent && !::isdigit(ch) && ch != int_type('+') && ch != int_type('-'))
{
if (!state->complete)
state->p_exception_string = create_exception_message<FloatingPoint, int_type>(ch, true);
return false;
}
}
switch (ch)
{
case int_type('+') :
state->complete = false;
if (state->exponent)
{
if (state->exponent_minus != 0)
{
state->p_exception_string = "The exponent sign already set";
return false;
}
state->exponent_minus = 1;
}
else
{
state->minus = 1;
}
break;
case int_type('-') :
state->complete = false;
if (state->exponent)
{
if (state->exponent_minus != 0)
{
state->p_exception_string = "The exponent sign already set";
return false;
}
state->exponent_minus = 2;
}
else
{
state->minus = 2;
}
break;
case int_type('.') :
state->complete = false;
if (state->after_comma > 0)
return false;
state->after_comma = 1;
break;
case int_type('E') : case int_type('e') :
state->complete = false;
if (state->exponent)
return false;
state->exponent_number = 0;
state->exponent = true;
break;
default:
state->complete = true;
if (!state->exponent)
{
if (state->minus == 0)
state->minus = 1;
state->result *= 10;
state->result += int64_t(ch-int_type('0'));
if (state->after_comma > 0)
state->after_comma++;
}
else
{
if (state->exponent_minus == 0) state->exponent_minus = 1;
state->exponent_number *= 10;
state->exponent_number += int64_t(ch-int_type('0'));
}
}
return true;
}