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); }
bool __get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite, const ctype<_CharT>& _c_type, _CharT __point, int __frac_digits, _CharT __sep, const string& __grouping, bool &__syntax_ok) { if (__first == __last || !_c_type.is(ctype_base::digit, *__first)) return false; char __group_sizes[128]; char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes; char __current_group_size = 0; while (__first != __last) { if (_c_type.is(ctype_base::digit, *__first)) { ++__current_group_size; *__out_ite++ = *__first++; } else if (__group_sizes_end) { if (*__first == __sep) { *__group_sizes_end++ = __current_group_size; __current_group_size = 0; ++__first; } else break; } else break; } if (__grouping.empty()) __syntax_ok = true; else { if (__group_sizes_end != __group_sizes) *__group_sizes_end++ = __current_group_size; __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data()+ __grouping.size()); if (__first == __last || *__first != __point) { for (int __digits = 0; __digits != __frac_digits; ++__digits) *__out_ite++ = _CharT('0'); return true; // OK not to have decimal point } } ++__first; int __digits = 0; while (__first != __last && _c_type.is(ctype_base::digit, *__first)) { *__out_ite++ = *__first++; ++__digits; } __syntax_ok = __syntax_ok && (__digits == __frac_digits); return true; }
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); }
const char_type* operator()(const char_type* __first, const char_type* __last) const { return _M_ctype->scan_is(ctype_base::space, __first, __last); }
bool operator()(argument_type __c) const { return _Traits::eq(__c, argument_type()) || _M_ctype->is(ctype_base::space, __c); }
bool operator()(argument_type __c) const { return !_M_ctype->is(ctype_base::space, __c); }
const char_type* operator()(const char_type* __first, const char_type* __last) const { __last = find_if(__first, __last, _Eq_char_bound<_Traits>(char_type())); return _M_ctype->scan_is(ctype_base::space, __first, __last); }