template<typename _CharT, typename _InIter>
- void
+ _InIter
num_get<_CharT, _InIter>::
_M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
ios_base::iostate& __err, string& __xtrc) const
__xtrc += char();
if (__beg == __end)
__err |= ios_base::eofbit;
+ return __beg;
}
template<typename _CharT, typename _InIter>
- void
+ _InIter
num_get<_CharT, _InIter>::
_M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
ios_base::iostate& __err, char* __xtrc, int __max,
__xtrc[__pos] = char();
if (__beg == __end)
__err |= ios_base::eofbit;
+ return __beg;
}
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// that can be represented without change" so we have to add 1 to it
// in order to obtain the max number of digits. The same for the
// other do_get for integral types below.
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<bool>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<bool>::digits10 + 1, __base);
// Stage 2: convert and store results.
char* __sanity;
// integral types.
char __xtrc[32];
int __base;
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<long>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<long>::digits10 + 1, __base);
// Stage 2: convert and store results.
char* __sanity;
// integral types.
char __xtrc[32];
int __base;
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<unsigned short>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<unsigned short>::digits10 + 1,
+ __base);
// Stage 2: convert and store results.
char* __sanity;
// integral types.
char __xtrc[32];
int __base;
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<unsigned int>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<unsigned int>::digits10 + 1,
+ __base);
// Stage 2: convert and store results.
char* __sanity;
// integral types.
char __xtrc[32];
int __base;
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<unsigned long>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<unsigned long>::digits10 + 1,
+ __base);
// Stage 2: convert and store results.
char* __sanity;
// integral types.
char __xtrc[32];
int __base;
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<long long>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<long long>::digits10 + 1, __base);
// Stage 2: convert and store results.
char* __sanity;
// integral types.
char __xtrc[32];
int __base;
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<unsigned long long>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<unsigned long long>::digits10 + 1,
+ __base);
// Stage 2: convert and store results.
char* __sanity;
// Stage 1: extract and determine the conversion specifier.
string __xtrc;
__xtrc.reserve(32);
- _M_extract_float(__beg, __end, __io, __err, __xtrc);
+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
// Stage 2: convert and store results.
char* __sanity;
// Stage 1: extract and determine the conversion specifier.
string __xtrc;
__xtrc.reserve(32);
- _M_extract_float(__beg, __end, __io, __err, __xtrc);
+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
// Stage 2: convert and store results.
char* __sanity;
// Stage 1: extract and determine the conversion specifier.
string __xtrc;
__xtrc.reserve(32);
- _M_extract_float(__beg, __end, __io, __err, __xtrc);
+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
#if defined(_GLIBCPP_USE_C99) && !defined(__hpux)
// Stage 2: convert and store results.
// integral types.
char __xtrc[32];
int __base;
- _M_extract_int(__beg, __end, __io, __err, __xtrc,
- numeric_limits<unsigned long>::digits10 + 1, __base);
+ __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc,
+ numeric_limits<unsigned long>::digits10 + 1,
+ __base);
// Stage 2: convert and store results.
char* __sanity;
// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001-2002 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
#endif
}
+// 2002-01-10 David Seymour <seymour_dj@yahoo.com>
+void test02()
+{
+ using namespace std;
+ bool test = true;
+
+ // Num_get works with other iterators besides streambuf output iterators
+ typedef string::const_iterator iter_type;
+ typedef num_get<char, iter_type> num_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ ios_base::iostate err = ios_base::goodbit;
+ const locale loc_c = locale::classic();
+
+ long i = 0;
+ const string str = "20000106 Elizabeth Durack";
+ istringstream iss; // need an ios, add my num_get facet
+ iss.imbue(locale(loc_c, new num_get_type));
+
+ // Iterator advanced, state, output.
+ const num_get_type& ng = use_facet<num_get_type>(iss.getloc());
+ iter_type end = ng.get(str.begin(), str.end(), iss, err, i);
+ string rem(end, str.end());
+
+ VERIFY( err == goodbit );
+ VERIFY( i == 20000106);
+ VERIFY( rem == " Elizabeth Durack" );
+}
int main()
{
test01();
+ test02();
return 0;
}