bool _STLP_CALL _M_read_float(string& __buf, _InputIter& __in, _InputIter& __end, ios_base& __s, _CharT*) { // Create a string, copying characters of the form // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)? bool __digits_before_dot /* = false */; bool __digits_after_dot = false; bool __ok; bool __grouping_ok = true; const ctype<_CharT>& __ct = *(const ctype<_CharT>*)__s._M_ctype_facet(); const numpunct<_CharT>& __numpunct = *(const numpunct<_CharT>*)__s._M_numpunct_facet(); const string& __grouping = __s._M_grouping(); // cached copy _CharT __dot = __numpunct.decimal_point(); _CharT __sep = __numpunct.thousands_sep(); _CharT __digits[10]; _CharT __xplus; _CharT __xminus; _CharT __pow_e; _CharT __pow_E; _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits); // Get an optional sign __in = __copy_sign(__in, __end, __buf, __xplus, __xminus); // Get an optional string of digits. if (__grouping.size() != 0) __digits_before_dot = __copy_grouped_digits(__in, __end, __buf, __digits, __sep, __grouping, __grouping_ok); else __digits_before_dot = __copy_digits(__in, __end, __buf, __digits); // Get an optional decimal point, and an optional string of digits. if (__in != __end && *__in == __dot) { __buf.push_back('.'); ++__in; __digits_after_dot = __copy_digits(__in, __end, __buf, __digits); } // There have to be some digits, somewhere. __ok = __digits_before_dot || __digits_after_dot; // Get an optional exponent. if (__ok && __in != __end && (*__in == __pow_e || *__in == __pow_E)) { __buf.push_back('e'); ++__in; __in = __copy_sign(__in, __end, __buf, __xplus, __xminus); __ok = __copy_digits(__in, __end, __buf, __digits); // If we have an exponent then the sign // is optional but the digits aren't. } return __ok; }
_OutputIter _STLP_CALL _M_do_put_float(_OutputIter __s, ios_base& __f, _CharT __fill, _Float __x) { __iostring __buf; size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x); const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet()); return __put_float(__buf, __s, __f, __fill, __np.decimal_point(), __np.thousands_sep(), __group_pos, __f._M_grouping()); }
_InputIter _STLP_CALL _M_do_get_integer(_InputIter& __in, _InputIter& __end, ios_base& __str, ios_base::iostate& __err, _Integer& __val, _CharT* __pc) { #if defined(__HP_aCC) && (__HP_aCC == 1) bool _IsSigned = !((_Integer)(-1) > 0); #else typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned; #endif const numpunct<_CharT>& __numpunct = *(const numpunct<_CharT>*)__str._M_numpunct_facet(); const string& __grouping = __str._M_grouping(); // cached copy const int __base_or_zero = _M_get_base_or_zero(__in, __end, __str, __pc); int __got = __base_or_zero & 1; bool __result; if (__in == __end) { // We may have already read a 0. If so, if (__got > 0) { // the result is 0 even if we're at eof. __val = 0; __result = true; } else __result = false; } else { const bool __negative = __base_or_zero & 2; const int __base = __base_or_zero >> 2; #if defined(__HP_aCC) && (__HP_aCC == 1) if (_IsSigned) __result = __get_integer(__in, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __true_type() ); else __result = __get_integer(__in, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __false_type() ); #else __result = __get_integer(__in, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, _IsSigned()); # endif } __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit); if (__in == __end) __err |= ios_base::eofbit; return __in; }