39 __rw_get_num (
void*,
const char*,
int,
int,
40 const char*, _RWSTD_SIZE_T,
const char*, _RWSTD_SIZE_T);
59template <
class _CharT,
class _InputIter>
60_RW::__rw_facet_id num_get<_CharT, _InputIter>::id;
64#ifndef _RWSTD_NO_EXT_NUM_GET
66template <
class _CharT,
class _InputIter>
67typename num_get<_CharT, _InputIter>::iter_type
68num_get<_CharT, _InputIter>::
69get (iter_type __begin, iter_type __end, ios_base &__flags,
78 __begin = do_get (__begin, __end, __flags, __err, __tmp);
79 __val = __rw_check_overflow_short (__tmp, __flags.flags (), __err);
85template <
class _CharT,
class _InputIter>
86typename num_get<_CharT, _InputIter>::iter_type
87num_get<_CharT, _InputIter>::
88get (iter_type __begin, iter_type __end, ios_base &__flags,
95 long __tmp = long (__val);
97 __begin = do_get (__begin, __end, __flags, __err, __tmp);
98 __val = __rw_check_overflow_int (__tmp, __flags.flags (), __err);
106#ifndef _RWSTD_NO_NATIVE_BOOL
108template <
class _CharT,
class _InputIter >
109typename num_get<_CharT, _InputIter>::iter_type
110num_get<_CharT, _InputIter>::
111do_get (iter_type __begin, iter_type __end, ios_base &__flags,
119 typedef num_get<_CharT, _InputIter> _This;
120 __begin = _This::do_get (__begin, __end, __flags, __err, __lval);
127 __val = 0
L != __lval;
129 __err |= _RW::__rw_failbit;
134 __err = _RW::__rw_goodbit;
136 const numpunct<char_type> &__pun =
140 typedef basic_string<char_type> string_type;
142 const string_type __tnm = __pun.truename ();
143 const string_type __fnm = __pun.falsename ();
145 const char_type*
const __names[] = {
146 __fnm.c_str (), __tnm.c_str ()
149 const _RWSTD_SIZE_T __sizes[] = {
150 __fnm.size (), __tnm.size ()
153 _RWSTD_SIZE_T __inx = 0;
157 __begin = _RW::__rw_match_name (__begin, __end, __names, __sizes,
158 sizeof __names /
sizeof *__names,
161 if (_RWSTD_SIZE_MAX == __inx)
162 __err |= _RW::__rw_failbit;
174template <
class _CharT,
class _InputIter >
175typename num_get<_CharT, _InputIter>::iter_type
176num_get<_CharT, _InputIter>::
177_C_get (iter_type __begin, iter_type __end, ios_base &__flags,
180 __err = _RW::__rw_goodbit;
182 const int __fl = __flags.flags ();
187 const locale &__loc = __flags.getloc ();
189 const numpunct<char_type> &__pun =
194 char __buf [128 + 2];
195 char *__pbuf = __buf;
196 char *__pcur = __buf;
197 _RWSTD_SIZE_T __bufsize =
sizeof __buf;
203 const _CharT __decimal_point = __pun.decimal_point ();
204 const _CharT __thousands_sep = __pun.thousands_sep ();
213 char __grpbuf [
sizeof __buf];
214 char *__pgrp = __grpbuf;
216 const char *__grpbeg = 0;
217 const char *__grpend = 0;
222 if (_RW::__rw_facet::_C_pvoid == __type)
227 int __subtype = __type;
229 typedef unsigned char _UChar;
235 static const _UChar _HexX = _RW::__rw_digit_map [_UChar (
'X')];
236 static const _UChar _Sign = _RW::__rw_digit_map [_UChar (
'+')];
241 _UChar __hex_x = _HexX;
245 _UChar __ld_sgn = _Sign;
247 for ( ; ; ++__begin) {
249 if (__begin == __end) {
251 __err |= _RW::__rw_eofbit;
255 if (__pcur == __buf +
sizeof __buf - 1) {
257 __err |= _RW::__rw_failbit;
261 const _CharT __wc = *__begin;
262 const char __dp = __decimal_point == __wc ?
'.' :
'\0';
264 if ( __thousands_sep == __wc
265 && _RW::__rw_digit_map [_UChar (__pcur [-1])] < 36
268 && (__grpsz =
int((__grouping = __pun.grouping ()).size ())))) {
274 if (__pcur == __pbuf + 1) {
277 __err |= _RW::__rw_failbit;
289 const _RWSTD_PTRDIFF_T __len = __grpbeg ?
290 __pcur - __grpbeg : __pcur - __pbuf - 1 - (_HexX != __hex_x);
295 __err |= _RW::__rw_failbit;
299 *__pgrp++ = char (__len < _UChar (_RWSTD_UCHAR_MAX) ? __len : -1);
304 const char __ch = __ctp.narrow (__wc,
'\0');
310 const _UChar __digit = _RW::__rw_digit_map [_UChar (__ch)];
318 if (__subtype & _C_floating) {
322 else if (__pcur == __pbuf + 1) {
325 if (__ld_sgn == __digit) {
337 14 == _RW::__rw_digit_map [_UChar (__ch)]) {
338 const _RWSTD_PTRDIFF_T __diff = __pcur - __pbuf;
340 if (2 == __diff &&
'.' == __pcur [-1])
349 __ctp.narrow (__thousands_sep,
'\0');
351 _Sign == _RW::__rw_digit_map [_UChar (__ts)])
355 else if (
'e' == __pcur [-1]
357 _Sign == _RW::__rw_digit_map [_UChar (__ch)]) {
373 if (__pcur == __pbuf + 1 && __digit == __ld_sgn) {
377 else if (16 == __base) {
380 else if ( __digit == __hex_x
381 && __pcur == __pbuf + 2
382 && __pcur [-1] ==
'0') {
390 else if (__base > 1) {
391 if (__digit < __base)
396 else if (0 == __base) {
401 if ( __digit && __digit < 8
402 && *(__pcur - 1) ==
'0' && __pcur == __pbuf + 2)
406 else if ( __digit == __hex_x
407 && __pcur == __pbuf + 2
408 && __pcur [-1] ==
'0') {
417 if (_RW::__rw_roman_inxs [_UChar (__ch)] <= 7)
419 else if (__pcur == __pbuf + 1 && __digit < 10) {
432 else if (__subtype & _C_floating) {
447 _RWSTD_PTRDIFF_T __len;
451#if defined (_RWSTD_NO_STRTOLD) && defined (_RWSTD_NO_STRTOLD_IN_LIBC)
456 if (
'e' == __pcur [-1]
457 ||
'-' == __pcur [-1] ||
'+' == __pcur [-1]) {
458 __err |= _RW::__rw_failbit;
469 __grpend - __grpbeg : __grpend - __pbuf - 1 - (_HexX != __hex_x);
471 if (__grpbeg && 0 == __len) {
476 __err |= _RW::__rw_failbit;
480 *__pgrp++ = char (__len < _UChar (_RWSTD_UCHAR_MAX) ? __len : -1);
491 const unsigned __fl2 =
492 __fl & ~_RWSTD_IOS_BASEFIELD
499 _RW::__rw_get_num (__pval, __pbuf, __type, __fl2,
500 __grpbuf, __pgrp - __grpbuf,
501 __grouping.data (), __grouping.size ());
#define _RWSTD_IOS_BOOLALPHA
#define _RWSTD_IOS_BASEFIELD
#define _RWSTD_USE_FACET(type, arg)
#define _RWSTD_UNUSED(arg)
#define _RWSTD_STATIC_CAST(T, x)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_ASSERT(ignore)
#define _RWSTD_IOS_BASEOFF
#define _RWSTD_ASSERT_RANGE(ign1, ign2)
#define _RWSTD_IOS_BASEMASK