18#ifndef _STLP_NUM_GET_C
19#define _STLP_NUM_GET_C
21#ifndef _STLP_INTERNAL_NUM_GET_H
25#ifndef _STLP_INTERNAL_LIMITS
39{
return __c >=
'0' &&
__c <=
'9'; }
54template <
class _InputIter,
class _CharT>
61 bool __negative =
false;
62 _CharT
__c = *__in_ite;
64 if (
__c == __atoms[1] ) {
68 else if (
__c == __atoms[0] )
76 switch (__basefield) {
85 if (__in_ite != __end && *__in_ite == __atoms[2] ) {
87 if (__in_ite != __end &&
88 (*__in_ite == __atoms[3] || *__in_ite == __atoms[4] ))
95 if (__in_ite != __end && *__in_ite == __atoms[2] ) {
97 if (__in_ite != __end &&
98 (*__in_ite == __atoms[3] || *__in_ite == __atoms[4] )) {
112 return (__base << 2) | ((
int)__negative << 1) | __valid_zero;
116template <
class _InputIter,
class _Integer,
class _CharT>
119 int __base, _Integer&
__val,
120 int __got,
bool __is_negative, _CharT __separator,
const string& __grouping,
const __true_type& ) {
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;
130 for ( ; __first !=
__last ; ++__first) {
132 const _CharT
__c = *__first;
134 if (__is_group &&
__c == __separator) {
135 *__group_sizes_end++ = __current_group_size;
136 __current_group_size = 0;
146 ++__current_group_size;
148 if (__result < __over_base)
153 __ovflow = __ovflow || __next >= __result;
158 if (__is_group && __group_sizes_end != __group_sizes) {
159 *__group_sizes_end++ = __current_group_size;
166 : __is_negative ? __result
170 return ((__got > 0) && !__ovflow) &&
173 __grouping.
data(), __grouping.
data()+ __grouping.
size()));
176template <
class _InputIter,
class _Integer,
class _CharT>
179 int __base, _Integer&
__val,
180 int __got,
bool __is_negative, _CharT __separator,
const string& __grouping,
const __false_type& ) {
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;
190 for ( ; __first !=
__last ; ++__first) {
192 const _CharT
__c = *__first;
194 if (__is_group &&
__c == __separator) {
195 *__group_sizes_end++ = __current_group_size;
196 __current_group_size = 0;
206 ++__current_group_size;
208 if (__result > __over_base)
213 __ovflow = __ovflow || __next <= __result;
218 if (__is_group && __group_sizes_end != __group_sizes) {
219 *__group_sizes_end++ = __current_group_size;
230 return ((__got > 0) && !__ovflow) &&
233 __grouping.
data(), __grouping.
data()+ __grouping.
size()));
237template <
class _InputIter,
class _Integer,
class _CharT>
245template <
class _InputIter,
class _Integer,
class _CharT>
250 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
252#if defined (__HP_aCC) && (__HP_aCC == 1)
253 bool _IsSigned = !((_Integer)(-1) > 0);
259 int __got = __base_or_zero & 1;
263 if (__in_ite == __end) {
274 const bool __negative = (__base_or_zero & 2) != 0;
275 const int __base = __base_or_zero >> 2;
277#if defined (__HP_aCC) && (__HP_aCC == 1)
283 __result =
__get_integer(__in_ite, __end, __base,
__val, __got, __negative, __np.thousands_sep(), __np.grouping(), _IsSigned());
289 if (__in_ite == __end)
290 __err |= ios_base::eofbit;
295template <
class _InputIter,
class _CharT>
298 _CharT __xplus, _CharT __xminus) {
300 _CharT
__c = *__first;
303 else if (
__c == __xminus) {
312template <
class _InputIter,
class _CharT>
318 for ( ; __first !=
__last; ++__first) {
319 _CharT
__c = *__first;
330template <
class _InputIter,
class _CharT>
334 _CharT __sep,
const string& __grouping,
335 bool& __grouping_ok) {
337 char __group_sizes[64];
338 char*__group_sizes_end = __group_sizes;
339 char __current_group_size = 0;
341 for ( ; __first !=
__last; ++__first) {
342 _CharT
__c = *__first;
346 *__group_sizes_end++ = __current_group_size;
347 __current_group_size = 0;
352 ++__current_group_size;
359 if (__group_sizes_end != __group_sizes)
360 *__group_sizes_end++ = __current_group_size;
366template <
class _InputIter,
class _CharT>
373 string __grouping = __numpunct.grouping();
374 bool __digits_before_dot ;
375 bool __digits_after_dot =
false;
378 bool __grouping_ok =
true;
380 _CharT __dot = __numpunct.decimal_point();
381 _CharT __sep = __numpunct.thousands_sep();
393 __in_ite =
__copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
396 if (!__grouping.
empty())
398 __sep, __grouping, __grouping_ok);
400 __digits_before_dot =
__copy_digits(__in_ite, __end, __buf, __digits);
403 if (__in_ite != __end && *__in_ite == __dot) {
406 __digits_after_dot =
__copy_digits(__in_ite, __end, __buf, __digits);
410 __ok = __digits_before_dot || __digits_after_dot;
413 if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
416 __in_ite =
__copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
425template <
class _InputIter,
class _Float,
class _CharT>
430 const ctype<_CharT> &__ctype = use_facet<ctype<_CharT> >(__loc);
434 bool __ok =
__read_float(__buf, __in_ite, __end, __ctype, __numpunct);
437 __err = ios_base::goodbit;
440 __err = ios_base::failbit;
442 if (__in_ite == __end)
443 __err |= ios_base::eofbit;
447template <
class _InputIter,
class _CharT>
454 bool __true_ok =
true;
455 bool __false_ok =
true;
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]);
464 if ((!__true_ok && !__false_ok) ||
465 (__true_ok &&
__n >= __truename.size()) ||
466 (__false_ok &&
__n >= __falsename.
size())) {
471 if (__true_ok &&
__n < __truename.size()) __true_ok =
false;
472 if (__false_ok &&
__n < __falsename.
size()) __false_ok =
false;
474 if (__true_ok || __false_ok) {
475 __err = ios_base::goodbit;
479 __err = ios_base::failbit;
481 if (__in_ite == __end)
482 __err |= ios_base::eofbit;
493template <
class _CharT,
class _InputIterator>
496#if !defined (_STLP_NO_BOOL)
497template <
class _CharT,
class _InputIter>
501 if (__s.
flags() & ios_base::boolalpha) {
507 if (!(__err & ios_base::failbit)) {
513 __err |= ios_base::failbit;
520#if defined (_STLP_FIX_LIBRARY_ISSUES)
521template <
class _CharT,
class _InputIter>
527template <
class _CharT,
class _InputIter>
535template <
class _CharT,
class _InputIter>
541template <
class _CharT,
class _InputIter>
545 unsigned short&
__val)
const
548template <
class _CharT,
class _InputIter>
552 unsigned int&
__val)
const
555template <
class _CharT,
class _InputIter>
559 unsigned long&
__val)
const
562template <
class _CharT,
class _InputIter>
569template <
class _CharT,
class _InputIter>
576#if !defined (_STLP_NO_LONG_DOUBLE)
577template <
class _CharT,
class _InputIter>
581 long double&
__val)
const
585template <
class _CharT,
class _InputIter>
590#if defined (_STLP_LONG_LONG) && !defined (__MRC__)
596 if (!(__err & ios_base::failbit))
601#if defined (_STLP_LONG_LONG)
602template <
class _CharT,
class _InputIter>
609template <
class _CharT,
class _InputIter>
_STLP_INLINE_LOOP _InputIter __last
_STLP_INLINE_LOOP _InputIter const _Tp & __val
bool _STLP_CALL __copy_digits(_InputIter &__first, _InputIter __last, __iostring &__v, const _CharT *__digits)
_InputIter _STLP_CALL __do_get_integer(_InputIter &__in_ite, _InputIter &__end, ios_base &__str, ios_base::iostate &__err, _Integer &__val, _CharT *)
_InputIter _STLP_CALL __copy_sign(_InputIter __first, _InputIter __last, __iostring &__v, _CharT __xplus, _CharT __xminus)
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 &)
int _STLP_CALL __get_digit_from_table(unsigned __index)
_InputIter _STLP_CALL __do_get_float(_InputIter &__in_ite, _InputIter &__end, ios_base &__str, ios_base::iostate &__err, _Float &__val, _CharT *)
int __get_base_or_zero(_InputIter &__in_ite, _InputIter &__end, ios_base::fmtflags __flags, const ctype< _CharT > &__c_type)
bool _STLP_CALL __get_decimal_integer(_InputIter &__first, _InputIter &__last, _Integer &__val, _CharT *)
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE _STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned)
_InputIter _STLP_CALL __do_get_alphabool(_InputIter &__in_ite, _InputIter &__end, ios_base &__str, ios_base::iostate &__err, bool &__x, _CharT *)
bool _STLP_CALL __get_fdigit_or_sep(char &__c, char __sep, const char *__digits)
bool _STLP_CALL __get_fdigit(char __c, const char *)
_STLP_DECLSPEC const char *_STLP_CALL __narrow_atoms()
bool _STLP_CALL __read_float(__iostring &__buf, _InputIter &__in_ite, _InputIter &__end, const ctype< _CharT > &__ct, const numpunct< _CharT > &__numpunct)
bool _STLP_CALL __copy_grouped_digits(_InputIter &__first, _InputIter __last, __iostring &__v, const _CharT *__digits, _CharT __sep, const string &__grouping, bool &__grouping_ok)
const _CharT * data() const
void push_back(_CharT __c)
virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base &__str, ios_base::iostate &__err, bool &__val) const
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
#define __REINTERPRET_CAST(__x, __y)
#define _STLP_MOVE_TO_STD_NAMESPACE
#define __STATIC_CAST(__x, __y)
#define _STLP_BEGIN_NAMESPACE
#define _STLP_END_NAMESPACE
#define _STLP_MOVE_TO_PRIV_NAMESPACE
_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)
_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)
void _STLP_CALL __string_to_float(const __iostring &v, float &val)