ReactOS  0.4.13-dev-259-g5ca9c9c
_num_get.c File Reference
#include <stl/_num_get.h>
#include <stl/_limits.h>
Include dependency graph for _num_get.c:

Go to the source code of this file.

Macros

#define _STLP_NUM_GET_C
 

Functions

_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table (unsigned)
 
_STLP_DECLSPEC const char *_STLP_CALL __narrow_atoms ()
 
bool _STLP_CALL __get_fdigit (char __c, const char *)
 
bool _STLP_CALL __get_fdigit_or_sep (char &__c, char __sep, const char *__digits)
 
int _STLP_CALL __get_digit_from_table (unsigned __index)
 
template<class _InputIter , class _CharT >
int __get_base_or_zero (_InputIter &__in_ite, _InputIter &__end, ios_base::fmtflags __flags, const ctype< _CharT > &__c_type)
 
template<class _InputIter , class _Integer , class _CharT >
bool _STLP_CALL __get_integer (_InputIter &__first, _InputIter &__last, int __base, _Integer &__val, int __got, bool __is_negative, _CharT __separator, const string &__grouping, const __true_type &)
 
template<class _InputIter , class _Integer , class _CharT >
bool _STLP_CALL __get_integer (_InputIter &__first, _InputIter &__last, int __base, _Integer &__val, int __got, bool __is_negative, _CharT __separator, const string &__grouping, const __false_type &)
 
template<class _InputIter , class _Integer , class _CharT >
bool _STLP_CALL __get_decimal_integer (_InputIter &__first, _InputIter &__last, _Integer &__val, _CharT *)
 
template<class _InputIter , class _Integer , class _CharT >
_InputIter _STLP_CALL __do_get_integer (_InputIter &__in_ite, _InputIter &__end, ios_base &__str, ios_base::iostate &__err, _Integer &__val, _CharT *)
 
template<class _InputIter , class _CharT >
_InputIter _STLP_CALL __copy_sign (_InputIter __first, _InputIter __last, __iostring &__v, _CharT __xplus, _CharT __xminus)
 
template<class _InputIter , class _CharT >
bool _STLP_CALL __copy_digits (_InputIter &__first, _InputIter __last, __iostring &__v, const _CharT *__digits)
 
template<class _InputIter , class _CharT >
bool _STLP_CALL __copy_grouped_digits (_InputIter &__first, _InputIter __last, __iostring &__v, const _CharT *__digits, _CharT __sep, const string &__grouping, bool &__grouping_ok)
 
template<class _InputIter , class _CharT >
bool _STLP_CALL __read_float (__iostring &__buf, _InputIter &__in_ite, _InputIter &__end, const ctype< _CharT > &__ct, const numpunct< _CharT > &__numpunct)
 
template<class _InputIter , class _Float , class _CharT >
_InputIter _STLP_CALL __do_get_float (_InputIter &__in_ite, _InputIter &__end, ios_base &__str, ios_base::iostate &__err, _Float &__val, _CharT *)
 
template<class _InputIter , class _CharT >
_InputIter _STLP_CALL __do_get_alphabool (_InputIter &__in_ite, _InputIter &__end, ios_base &__str, ios_base::iostate &__err, bool &__x, _CharT *)
 

Macro Definition Documentation

◆ _STLP_NUM_GET_C

#define _STLP_NUM_GET_C

Definition at line 19 of file _num_get.c.

Function Documentation

◆ __copy_digits()

template<class _InputIter , class _CharT >
bool _STLP_CALL __copy_digits ( _InputIter &  __first,
_InputIter  __last,
__iostring __v,
const _CharT *  __digits 
)

Definition at line 314 of file _num_get.c.

315  {
316  bool __ok = false;
317 
318  for ( ; __first != __last; ++__first) {
319  _CharT __c = *__first;
320  if (__get_fdigit(__c, __digits)) {
321  __v.push_back((char)__c);
322  __ok = true;
323  }
324  else
325  break;
326  }
327  return __ok;
328 }
#define __c
Definition: schilyio.h:209
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
void push_back(_CharT __c)
Definition: _string.h:534
bool _STLP_CALL __get_fdigit(char __c, const char *)
Definition: _num_get.c:38

Referenced by __read_float().

◆ __copy_grouped_digits()

template<class _InputIter , class _CharT >
bool _STLP_CALL __copy_grouped_digits ( _InputIter &  __first,
_InputIter  __last,
__iostring __v,
const _CharT *  __digits,
_CharT  __sep,
const string __grouping,
bool __grouping_ok 
)

Definition at line 332 of file _num_get.c.

335  {
336  bool __ok = false;
337  char __group_sizes[64];
338  char*__group_sizes_end = __group_sizes;
339  char __current_group_size = 0;
340 
341  for ( ; __first != __last; ++__first) {
342  _CharT __c = *__first;
343  bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
344  if (__tmp) {
345  if (__c == ',') {
346  *__group_sizes_end++ = __current_group_size;
347  __current_group_size = 0;
348  }
349  else {
350  __ok = true;
351  __v.push_back((char)__c);
352  ++__current_group_size;
353  }
354  }
355  else
356  break;
357  }
358 
359  if (__group_sizes_end != __group_sizes)
360  *__group_sizes_end++ = __current_group_size;
361  __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
362  return __ok;
363 }
bool _STLP_CALL __get_fdigit_or_sep(char &__c, char __sep, const char *__digits)
Definition: _num_get.c:41
const WCHAR * data
Definition: wql.tab.c:118
#define __c
Definition: schilyio.h:209
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
void push_back(_CharT __c)
Definition: _string.h:534
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE bool _STLP_CALL __valid_grouping(const char *first1, const char *last1, const char *first2, const char *last2)
Definition: num_get.cpp:38

Referenced by __read_float().

◆ __copy_sign()

template<class _InputIter , class _CharT >
_InputIter _STLP_CALL __copy_sign ( _InputIter  __first,
_InputIter  __last,
__iostring __v,
_CharT  __xplus,
_CharT  __xminus 
)

Definition at line 297 of file _num_get.c.

298  {
299  if (__first != __last) {
300  _CharT __c = *__first;
301  if (__c == __xplus)
302  ++__first;
303  else if (__c == __xminus) {
304  __v.push_back('-');
305  ++__first;
306  }
307  }
308  return __first;
309 }
#define __c
Definition: schilyio.h:209
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
void push_back(_CharT __c)
Definition: _string.h:534

Referenced by __read_float().

◆ __digit_val_table()

Definition at line 54 of file num_get.cpp.

54  {
55  static const unsigned char __val_table[128] = {
56  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
57  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
58  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
59  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
60  0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
61  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
62  0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
63  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
64  };
65 
66  return __val_table[__index];
67 }

Referenced by __get_digit_from_table().

◆ __do_get_alphabool()

template<class _InputIter , class _CharT >
_InputIter _STLP_CALL __do_get_alphabool ( _InputIter &  __in_ite,
_InputIter &  __end,
ios_base __str,
ios_base::iostate __err,
bool __x,
_CharT *   
)

Definition at line 449 of file _num_get.c.

450  {
451  const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__str.getloc());
452  const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __truename = __np.truename();
453  const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __falsename = __np.falsename();
454  bool __true_ok = true;
455  bool __false_ok = true;
456 
457  size_t __n = 0;
458  for ( ; __in_ite != __end; ++__in_ite) {
459  _CharT __c = *__in_ite;
460  __true_ok = __true_ok && (__c == __truename[__n]);
461  __false_ok = __false_ok && (__c == __falsename[__n]);
462  ++__n;
463 
464  if ((!__true_ok && !__false_ok) ||
465  (__true_ok && __n >= __truename.size()) ||
466  (__false_ok && __n >= __falsename.size())) {
467  ++__in_ite;
468  break;
469  }
470  }
471  if (__true_ok && __n < __truename.size()) __true_ok = false;
472  if (__false_ok && __n < __falsename.size()) __false_ok = false;
473 
474  if (__true_ok || __false_ok) {
475  __err = ios_base::goodbit;
476  __x = __true_ok;
477  }
478  else
479  __err = ios_base::failbit;
480 
481  if (__in_ite == __end)
482  __err |= ios_base::eofbit;
483 
484  return __in_ite;
485 }
return __n
Definition: _algo.h:75
locale getloc() const
Definition: _ios_base.h:143
#define __c
Definition: schilyio.h:209
size_type size() const
Definition: _string.h:400

Referenced by num_get< _CharT, _InputIter >::do_get().

◆ __do_get_float()

template<class _InputIter , class _Float , class _CharT >
_InputIter _STLP_CALL __do_get_float ( _InputIter &  __in_ite,
_InputIter &  __end,
ios_base __str,
ios_base::iostate __err,
_Float &  __val,
_CharT *   
)

Definition at line 427 of file _num_get.c.

428  {
429  locale __loc = __str.getloc();
430  const ctype<_CharT> &__ctype = use_facet<ctype<_CharT> >(__loc);
431  const numpunct<_CharT> &__numpunct = use_facet<numpunct<_CharT> >(__loc);
432 
433  __iostring __buf ;
434  bool __ok = __read_float(__buf, __in_ite, __end, __ctype, __numpunct);
435  if (__ok) {
436  __string_to_float(__buf, __val);
437  __err = ios_base::goodbit;
438  }
439  else {
440  __err = ios_base::failbit;
441  }
442  if (__in_ite == __end)
443  __err |= ios_base::eofbit;
444  return __in_ite;
445 }
locale getloc() const
Definition: _ios_base.h:143
Definition: _locale.h:75
Definition: _ctype.h:58
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
void _STLP_CALL __string_to_float(const __iostring &v, float &val)
bool _STLP_CALL __read_float(__iostring &__buf, _InputIter &__in_ite, _InputIter &__end, const ctype< _CharT > &__ct, const numpunct< _CharT > &__numpunct)
Definition: _num_get.c:368

Referenced by num_get< _CharT, _InputIter >::do_get().

◆ __do_get_integer()

template<class _InputIter , class _Integer , class _CharT >
_InputIter _STLP_CALL __do_get_integer ( _InputIter &  __in_ite,
_InputIter &  __end,
ios_base __str,
ios_base::iostate __err,
_Integer &  __val,
_CharT *   
)

Definition at line 247 of file _num_get.c.

248  {
249  locale __loc = __str.getloc();
250  const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
251 
252 #if defined (__HP_aCC) && (__HP_aCC == 1)
253  bool _IsSigned = !((_Integer)(-1) > 0);
254 #else
255  typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
256 #endif
257 
258  const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str.flags(), __ctype);
259  int __got = __base_or_zero & 1;
260 
261  bool __result;
262 
263  if (__in_ite == __end) { // We may have already read a 0. If so,
264 
265  if (__got > 0) { // the result is 0 even if we're at eof.
266  __val = 0;
267  __result = true;
268  }
269  else
270  __result = false;
271  }
272  else {
273  const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
274  const bool __negative = (__base_or_zero & 2) != 0;
275  const int __base = __base_or_zero >> 2;
276 
277 #if defined (__HP_aCC) && (__HP_aCC == 1)
278  if (_IsSigned)
279  __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __true_type() );
280  else
281  __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __false_type() );
282 #else
283  __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), _IsSigned());
284 # endif
285  }
286 
287  __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
288 
289  if (__in_ite == __end)
290  __err |= ios_base::eofbit;
291  return __in_ite;
292 }
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
int __get_base_or_zero(_InputIter &__in_ite, _InputIter &__end, ios_base::fmtflags __flags, const ctype< _CharT > &__c_type)
Definition: _num_get.c:56
locale getloc() const
Definition: _ios_base.h:143
bool _STLP_CALL __get_integer(_InputIter &__first, _InputIter &__last, int __base, _Integer &__val, int __got, bool __is_negative, _CharT __separator, const string &__grouping, const __true_type &)
Definition: _num_get.c:118
Definition: _locale.h:75
fmtflags flags() const
Definition: _ios_base.h:107
Definition: _ctype.h:58
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
int iostate
Definition: _ios_base.h:58

Referenced by num_get< _CharT, _InputIter >::do_get().

◆ __get_base_or_zero()

template<class _InputIter , class _CharT >
int __get_base_or_zero ( _InputIter &  __in_ite,
_InputIter &  __end,
ios_base::fmtflags  __flags,
const ctype< _CharT > &  __c_type 
)

Definition at line 56 of file _num_get.c.

57  {
58  _CharT __atoms[5];
59  __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
60 
61  bool __negative = false;
62  _CharT __c = *__in_ite;
63 
64  if (__c == __atoms[1] /* __xminus_char */ ) {
65  __negative = true;
66  ++__in_ite;
67  }
68  else if (__c == __atoms[0] /* __xplus_char */ )
69  ++__in_ite;
70 
71  int __base;
72  int __valid_zero = 0;
73 
74  ios_base::fmtflags __basefield = __flags & ios_base::basefield;
75 
76  switch (__basefield) {
77  case ios_base::oct:
78  __base = 8;
79  break;
80  case ios_base::dec:
81  __base = 10;
82  break;
83  case ios_base::hex:
84  __base = 16;
85  if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
86  ++__in_ite;
87  if (__in_ite != __end &&
88  (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
89  ++__in_ite;
90  else
91  __valid_zero = 1; // That zero is valid by itself.
92  }
93  break;
94  default:
95  if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
96  ++__in_ite;
97  if (__in_ite != __end &&
98  (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
99  ++__in_ite;
100  __base = 16;
101  }
102  else
103  {
104  __base = 8;
105  __valid_zero = 1; // That zero is still valid by itself.
106  }
107  }
108  else
109  __base = 10;
110  break;
111  }
112  return (__base << 2) | ((int)__negative << 1) | __valid_zero;
113 }
ios_base &_STLP_CALL dec(ios_base &__s)
Definition: _ios_base.h:321
static const char hex[16]
Definition: profile.c:123
#define __c
Definition: schilyio.h:209
_STLP_DECLSPEC const char *_STLP_CALL __narrow_atoms()
Definition: num_get.cpp:69
int fmtflags
Definition: _ios_base.h:57
ios_base &_STLP_CALL oct(ios_base &__s)
Definition: _ios_base.h:327
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by __do_get_integer().

◆ __get_decimal_integer()

template<class _InputIter , class _Integer , class _CharT >
bool _STLP_CALL __get_decimal_integer ( _InputIter &  __first,
_InputIter &  __last,
_Integer &  __val,
_CharT *   
)

Definition at line 239 of file _num_get.c.

239  {
240  string __grp;
241  //Here there is no grouping so separator is not important, we just pass the default character.
242  return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type());
243 }
bool _STLP_CALL __get_integer(_InputIter &__first, _InputIter &__last, int __base, _Integer &__val, int __got, bool __is_negative, _CharT __separator, const string &__grouping, const __true_type &)
Definition: _num_get.c:118
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656

Referenced by _STLP_WEAK(), money_get< _CharT, _InputIter >::do_get(), and time_get< _Ch, _InIt >::do_get_year().

◆ __get_digit_from_table()

int _STLP_CALL __get_digit_from_table ( unsigned  __index)
inline

Definition at line 51 of file _num_get.c.

52 { return (__index > 127 ? 0xFF : __digit_val_table(__index)); }
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned)
Definition: num_get.cpp:54

Referenced by __get_integer().

◆ __get_fdigit()

bool _STLP_CALL __get_fdigit ( char  __c,
const char  
)
inline

Definition at line 38 of file _num_get.c.

39 { return __c >= '0' && __c <= '9'; }
#define __c
Definition: schilyio.h:209

Referenced by __copy_digits(), and __get_fdigit_or_sep().

◆ __get_fdigit_or_sep()

bool _STLP_CALL __get_fdigit_or_sep ( char __c,
char  __sep,
const char __digits 
)
inline

Definition at line 41 of file _num_get.c.

41  {
42  if (__c == __sep) {
43  __c = ',' ;
44  return true ;
45  }
46  else
47  return __get_fdigit(__c, __digits);
48 }
#define __c
Definition: schilyio.h:209
bool _STLP_CALL __get_fdigit(char __c, const char *)
Definition: _num_get.c:38
#define true
Definition: stdbool.h:37

Referenced by __copy_grouped_digits().

◆ __get_integer() [1/2]

template<class _InputIter , class _Integer , class _CharT >
bool _STLP_CALL __get_integer ( _InputIter &  __first,
_InputIter &  __last,
int  __base,
_Integer &  __val,
int  __got,
bool  __is_negative,
_CharT  __separator,
const string __grouping,
const __true_type  
)

Definition at line 118 of file _num_get.c.

120  {
121  bool __ovflow = false;
122  _Integer __result = 0;
123  bool __is_group = !__grouping.empty();
124  char __group_sizes[64];
125  char __current_group_size = 0;
126  char* __group_sizes_end = __group_sizes;
127 
128  _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
129 
130  for ( ; __first != __last ; ++__first) {
131 
132  const _CharT __c = *__first;
133 
134  if (__is_group && __c == __separator) {
135  *__group_sizes_end++ = __current_group_size;
136  __current_group_size = 0;
137  continue;
138  }
139 
141 
142  if (__n >= __base)
143  break;
144 
145  ++__got;
146  ++__current_group_size;
147 
148  if (__result < __over_base)
149  __ovflow = true; // don't need to keep accumulating
150  else {
151  _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
152  if (__result != 0)
153  __ovflow = __ovflow || __next >= __result;
154  __result = __next;
155  }
156  }
157 
158  if (__is_group && __group_sizes_end != __group_sizes) {
159  *__group_sizes_end++ = __current_group_size;
160  }
161 
162  // fbp : added to not modify value if nothing was read
163  if (__got > 0) {
164  __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)()
165  : (numeric_limits<_Integer>::max)()
166  : __is_negative ? __result
167  : __STATIC_CAST(_Integer, -__result);
168  }
169  // overflow is being treated as failure
170  return ((__got > 0) && !__ovflow) &&
171  (__is_group == 0 ||
172  __valid_grouping(__group_sizes, __group_sizes_end,
173  __grouping.data(), __grouping.data()+ __grouping.size()));
174 }
#define max(a, b)
Definition: svc.c:63
return __n
Definition: _algo.h:75
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
int _STLP_CALL __get_digit_from_table(unsigned __index)
Definition: _num_get.c:51
const WCHAR * data
Definition: wql.tab.c:118
#define __c
Definition: schilyio.h:209
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE bool _STLP_CALL __valid_grouping(const char *first1, const char *last1, const char *first2, const char *last2)
Definition: num_get.cpp:38

Referenced by __do_get_integer(), and __get_decimal_integer().

◆ __get_integer() [2/2]

template<class _InputIter , class _Integer , class _CharT >
bool _STLP_CALL __get_integer ( _InputIter &  __first,
_InputIter &  __last,
int  __base,
_Integer &  __val,
int  __got,
bool  __is_negative,
_CharT  __separator,
const string __grouping,
const __false_type  
)

Definition at line 178 of file _num_get.c.

180  {
181  bool __ovflow = false;
182  _Integer __result = 0;
183  bool __is_group = !__grouping.empty();
184  char __group_sizes[64];
185  char __current_group_size = 0;
186  char* __group_sizes_end = __group_sizes;
187 
188  _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
189 
190  for ( ; __first != __last ; ++__first) {
191 
192  const _CharT __c = *__first;
193 
194  if (__is_group && __c == __separator) {
195  *__group_sizes_end++ = __current_group_size;
196  __current_group_size = 0;
197  continue;
198  }
199 
201 
202  if (__n >= __base)
203  break;
204 
205  ++__got;
206  ++__current_group_size;
207 
208  if (__result > __over_base)
209  __ovflow = true; //don't need to keep accumulating
210  else {
211  _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
212  if (__result != 0)
213  __ovflow = __ovflow || __next <= __result;
214  __result = __next;
215  }
216  }
217 
218  if (__is_group && __group_sizes_end != __group_sizes) {
219  *__group_sizes_end++ = __current_group_size;
220  }
221 
222  // fbp : added to not modify value if nothing was read
223  if (__got > 0) {
224  __val = __ovflow ? (numeric_limits<_Integer>::max)()
225  : (__is_negative ? __STATIC_CAST(_Integer, -__result)
226  : __result);
227  }
228 
229  // overflow is being treated as failure
230  return ((__got > 0) && !__ovflow) &&
231  (__is_group == 0 ||
232  __valid_grouping(__group_sizes, __group_sizes_end,
233  __grouping.data(), __grouping.data()+ __grouping.size()));
234 }
return __n
Definition: _algo.h:75
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
int _STLP_CALL __get_digit_from_table(unsigned __index)
Definition: _num_get.c:51
const WCHAR * data
Definition: wql.tab.c:118
#define __c
Definition: schilyio.h:209
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE bool _STLP_CALL __valid_grouping(const char *first1, const char *last1, const char *first2, const char *last2)
Definition: num_get.cpp:38

◆ __narrow_atoms()

_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms ( )

Definition at line 69 of file num_get.cpp.

70 { return "+-0xX"; }

Referenced by __get_base_or_zero().

◆ __read_float()

template<class _InputIter , class _CharT >
bool _STLP_CALL __read_float ( __iostring __buf,
_InputIter &  __in_ite,
_InputIter &  __end,
const ctype< _CharT > &  __ct,
const numpunct< _CharT > &  __numpunct 
)

Definition at line 368 of file _num_get.c.

369  {
370  // Create a string, copying characters of the form
371  // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
372 
373  string __grouping = __numpunct.grouping();
374  bool __digits_before_dot /* = false */;
375  bool __digits_after_dot = false;
376  bool __ok;
377 
378  bool __grouping_ok = true;
379 
380  _CharT __dot = __numpunct.decimal_point();
381  _CharT __sep = __numpunct.thousands_sep();
382 
383  _CharT __digits[10];
384  _CharT __xplus;
385  _CharT __xminus;
386 
387  _CharT __pow_e;
388  _CharT __pow_E;
389 
390  _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
391 
392  // Get an optional sign
393  __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
394 
395  // Get an optional string of digits.
396  if (!__grouping.empty())
397  __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits,
398  __sep, __grouping, __grouping_ok);
399  else
400  __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits);
401 
402  // Get an optional decimal point, and an optional string of digits.
403  if (__in_ite != __end && *__in_ite == __dot) {
404  __buf.push_back('.');
405  ++__in_ite;
406  __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits);
407  }
408 
409  // There have to be some digits, somewhere.
410  __ok = __digits_before_dot || __digits_after_dot;
411 
412  // Get an optional exponent.
413  if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
414  __buf.push_back('e');
415  ++__in_ite;
416  __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
417  __ok = __copy_digits(__in_ite, __end, __buf, __digits);
418  // If we have an exponent then the sign
419  // is optional but the digits aren't.
420  }
421 
422  return __ok;
423 }
bool _STLP_CALL __copy_digits(_InputIter &__first, _InputIter __last, __iostring &__v, const _CharT *__digits)
Definition: _num_get.c:314
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE void _STLP_CALL _Initialize_get_float(const ctype< wchar_t > &ct, wchar_t &Plus, wchar_t &Minus, wchar_t &pow_e, wchar_t &pow_E, wchar_t *digits)
_InputIter _STLP_CALL __copy_sign(_InputIter __first, _InputIter __last, __iostring &__v, _CharT __xplus, _CharT __xminus)
Definition: _num_get.c:297
bool _STLP_CALL __copy_grouped_digits(_InputIter &__first, _InputIter __last, __iostring &__v, const _CharT *__digits, _CharT __sep, const string &__grouping, bool &__grouping_ok)
Definition: _num_get.c:332
void push_back(_CharT __c)
Definition: _string.h:534

Referenced by __do_get_float().