void _STLP_CALL _Initialize_get_digit(wchar_t* digits, wchar_t* xdigits, const ctype<wchar_t>& ct) { ct.widen(narrow_digits + 0, narrow_digits + 10, digits); ct.widen(narrow_xdigits + 0, narrow_xdigits + 10, xdigits); }
wchar_t* _STLP_CALL __convert_float_buffer(const char* first, const char* last, wchar_t* out, const ctype<wchar_t>& ct, wchar_t dot) { ct.widen(first, last, out); replace(out, out + (last - first), ct.widen('.'), dot); return out + (last - first); }
void _STLP_CALL __convert_float_buffer(__iostring const& str, __iowstring &out, const ctype<wchar_t>& ct, wchar_t dot, bool __check_dot) { wchar_t __static_buf[128]; wchar_t *__beg = __static_buf; wchar_t *__end = __static_buf + (sizeof(__static_buf) / sizeof(wchar_t)); string::const_iterator str_ite(str.begin()), str_end(str.end()); wchar_t *__cur = __beg; //First loop, check the dot char if (__check_dot) { while (str_ite != str_end) { if (*str_ite != '.') { *__cur = ct.widen(*str_ite); } else { *__cur = dot; break; } ++__cur; if (__cur == __end) { out.append(__beg, __cur); __cur = __beg; } ++str_ite; } } else { if (str_ite != str_end) { *__cur = ct.widen(*str_ite); } } if (str_ite != str_end) { ++__cur; ++str_ite; if (__cur == __end) { out.append(__beg, __cur); __cur = __beg; } //Second loop, dot has been found, no check anymore while (str_ite != str_end) { *__cur = ct.widen(*str_ite); ++__cur; if (__cur == __end) { out.append(__beg, __cur); __cur = __beg; } ++str_ite; } } out.append(__beg, __cur); }
int __get_base_or_zero(_InputIter& __in_ite, _InputIter& __end, ios_base::fmtflags __flags, const ctype<_CharT>& __c_type) { _CharT __atoms[5]; __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms); bool __negative = false; _CharT __c = *__in_ite; if (__c == __atoms[1] /* __xminus_char */ ) { __negative = true; ++__in_ite; } else if (__c == __atoms[0] /* __xplus_char */ ) ++__in_ite; int __base; int __valid_zero = 0; ios_base::fmtflags __basefield = __flags & ios_base::basefield; switch (__basefield) { case ios_base::oct: __base = 8; break; case ios_base::dec: __base = 10; break; case ios_base::hex: __base = 16; if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) { ++__in_ite; if (__in_ite != __end && (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) ++__in_ite; else __valid_zero = 1; // That zero is valid by itself. } break; default: if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) { ++__in_ite; if (__in_ite != __end && (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) { ++__in_ite; __base = 16; } else { __base = 8; __valid_zero = 1; // That zero is still valid by itself. } } else __base = 10; break; } return (__base << 2) | ((int)__negative << 1) | __valid_zero; }
__STL_BEGIN_NAMESPACE //---------------------------------------------------------------------- // num_get // Helper functions for _M_do_get_integer. void __STL_CALL __initialize_get_digit(wchar_t* digits, wchar_t* xdigits, const ctype<wchar_t>& ct) { char narrow_digits[11] = "0123456789"; char narrow_xdigits[13] = "aAbBcCdDeEfF"; ct.widen(narrow_digits + 0, narrow_digits + 10, digits); ct.widen(narrow_xdigits + 0, narrow_xdigits + 10, xdigits); }