18#ifndef _STLP_ISTREAM_C
19#define _STLP_ISTREAM_C
21#ifndef _STLP_INTERNAL_ISTREAM
25#ifndef _STLP_INTERNAL_LIMITS
29#ifndef _STLP_INTERNAL_NUM_GET_H
33#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
35# define __BIS_int_type__ int
36# define __BIS_pos_type__ streampos
37# define __BIS_off_type__ streamoff
39# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type
40# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type
41# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type
51template <
class _Traits>
63template <
class _Traits>
77template <
class _Traits>
93template <
class _Traits>
111template <
class _Traits>
127template <
class _Traits>
144template <
class _Traits>
166template <
class _CharT,
class _Traits>
171 const typename _Traits::int_type __eof = _Traits::eof();
184template <
class _CharT,
class _Traits,
class _Number>
189 _Sentry __sentry( __that );
196 0, __that, __err,
__val);
208template <
class _CharT,
class _Traits>
212 if ( this->fail() ) {
216 unsigned short __uval =
__STATIC_CAST(
unsigned short, __lval);
219 if ((__tmp != __lval) && ((
long)__uval != __lval))
220 this->setstate(ios_base::failbit);
226template <
class _CharT,
class _Traits>
230 if ( this->fail() ) {
234 unsigned int __uval = __lval;
237 if ((__tmp != __lval) && ((
long)__uval != __lval))
238 this->setstate(ios_base::failbit);
244template <
class _CharT,
class _Traits>
250template <
class _CharT,
class _Traits>
256template <
class _CharT,
class _Traits>
262template <
class _CharT,
class _Traits>
268#if defined (_STLP_LONG_LONG)
269template <
class _CharT,
class _Traits>
275template <
class _CharT,
class _Traits>
281template <
class _CharT,
class _Traits>
286template <
class _CharT,
class _Traits>
291#if !defined (_STLP_NO_LONG_DOUBLE)
292template <
class _CharT,
class _Traits>
298#if !defined (_STLP_NO_BOOL)
299template <
class _CharT,
class _Traits>
306template <
class _CharT,
class _Traits>
314template <
class _CharT,
class _Traits>
317 typename _Traits::int_type __tmp = _Traits::eof();
324 __tmp = this->rdbuf()->sgetc();
327 this->_M_handle_exception(ios_base::badbit);
329 if (this->_S_eof(__tmp))
330 this->setstate(ios_base::eofbit);
337template <
class _CharT,
class _Traits>
340 typename _Traits::int_type __tmp = _Traits::eof();
346 __tmp = this->rdbuf()->sbumpc();
349 this->_M_handle_exception(ios_base::badbit);
352 if (!this->_S_eof(__tmp))
357 this->setstate(ios_base::eofbit | ios_base::failbit);
362template <
class _CharT,
class _Traits>
369 typename _Traits::int_type __tmp = _Traits::eof();
371 __tmp = this->rdbuf()->sbumpc();
374 this->_M_handle_exception(ios_base::badbit);
377 if (!this->_S_eof(__tmp)) {
379 __c = _Traits::to_char_type(__tmp);
383 if (this->_M_gcount == 0)
384 this->setstate(ios_base::eofbit | ios_base::failbit);
394template <
class _CharT,
class _Traits>
402 __c = this->rdbuf()->sbumpc();
405 this->_M_handle_exception(ios_base::badbit);
409 if (!this->_S_eof(
__c))
412 this->setstate(ios_base::eofbit);
420template <
class _CharT,
class _Traits>
427 typename _Traits::int_type __tmp = _Traits::eof();
435 this->_M_handle_exception(ios_base::badbit);
438 if (this->_S_eof(__tmp))
439 this->setstate(ios_base::badbit);
442 this->setstate(ios_base::failbit);
447template <
class _CharT,
class _Traits>
458 if (this->_S_eof(__buf->
sungetc()))
459 this->setstate(ios_base::badbit);
462 this->_M_handle_exception(ios_base::badbit);
465 this->setstate(ios_base::badbit);
468 this->setstate(ios_base::failbit);
475template <
class _CharT,
class _Traits>
482 this->setstate(ios_base::badbit);
492template <
class _CharT,
class _Traits>
498 return (__buf && !this->fail()) ? __buf->
pubseekoff(0, ios_base::cur, ios_base::in)
502template <
class _CharT,
class _Traits>
508 if (!this->fail() && __buf) {
510 this->setstate(ios_base::failbit);
516template <
class _CharT,
class _Traits>
522 if (!this->fail() && __buf)
523 __buf->
pubseekoff(__off, __dir, ios_base::in);
529template <
class _CharT,
class _Traits>
536 typename _Traits::int_type __tmp;
539 __tmp = this->rdbuf()->sbumpc();
542 this->_M_handle_exception(ios_base::badbit);
546 if (!this->_S_eof(__tmp))
547 __c = _Traits::to_char_type(__tmp);
549 this->setstate(ios_base::eofbit | ios_base::failbit);
577template <
class _CharT,
class _Traits,
class _Is_Delim>
581 _Is_Delim __is_delim,
582 bool __extract_delim,
bool __append_null,
594 __status |= ios_base::failbit;
600 if (
__n < _Num || __is_getline)
601 __status |= ios_base::eofbit;
603 }
else if (__is_delim(_Traits::to_char_type(
__c))) {
604 if (__extract_delim) {
606 }
else if ( !
__pushback(__buf, _Traits::to_char_type(
__c)) ) {
607 __status |= ios_base::failbit;
612 *__s++ = _Traits::to_char_type(
__c);
633template <
class _CharT,
class _Traits,
class _Is_Delim,
class _Scan_Delim>
637 _Is_Delim __is_delim, _Scan_Delim __scan_delim,
638 bool __extract_delim,
bool __append_null,
646 const _CharT* __first = __buf->
_M_gptr();
654 const _CharT* __p = __scan_delim(__first,
__last);
656 _Traits::copy(__s, __first, __chunk);
662 if (__p !=
__last && __p - __first <= __request) {
663 if (__extract_delim) {
671 else if (
__n == _Num) {
675 if (__chunk ==
__last - __first) {
677 __status |= ios_base::eofbit;
680 __status |= ios_base::failbit;
689 __status |= ios_base::eofbit;
714 __extract_delim,__append_null,__is_getline);
719template <
class _CharT,
class _Traits>
744 if (this->_M_gcount == 0)
745 this->setstate(ios_base::failbit);
752template <
class _CharT,
class _Traits>
762 this->_M_gcount = __buf->
egptr() != __buf->
gptr()
773 if (this->_M_gcount == 0)
774 this->setstate(ios_base::failbit);
781template <
class _CharT,
class _Traits>
787 if (__sentry && !this->
eof()) {
794 false,
false,
false);
799 false,
false,
false);
802 this->setstate(ios_base::failbit);
805 this->setstate(ios_base::eofbit | ios_base::failbit);
813template <
class _CharT,
class _Traits>
819 if (__sentry && !this->
eof() && __nmax >= 0) {
826 this->_M_setstate_nothrow(ios_base::eofbit);
828 else if (__avail != 0) {
835 false,
false,
false);
840 false,
false,
false);
846 this->setstate(ios_base::eofbit | ios_base::failbit);
848 this->setstate(ios_base::failbit);
857template <
class _CharT,
class _Traits>
876 this->setstate(ios_base::failbit);
886template <
class _CharT,
class _Traits,
class _Is_Delim>
890 _Is_Delim __is_delim,
891 bool __extract_delim,
bool __set_failbit) {
902 __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
906 else if (__is_delim(_Traits::to_char_type(
__c))) {
908 if (!__extract_delim)
910 __status |= ios_base::failbit;
926template <
class _CharT,
class _Traits,
class _Is_Delim,
class _Scan_Delim>
930 _Is_Delim __is_delim, _Scan_Delim __scan_delim,
931 bool __extract_delim,
bool __set_failbit) {
932 bool __at_eof =
false;
933 bool __found_delim =
false;
936 while (__buf->
_M_egptr() != __buf->
_M_gptr() && !__at_eof && !__found_delim) {
943 __found_delim =
true;
956 __that->
setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
981template <
class _CharT,
class _Traits,
class _Max_Chars,
class _Is_Delim>
986 _Is_Delim __is_delim,
987 bool __extract_delim,
bool __set_failbit) {
993 while (__max_chars(_Num,
__n) > 0) {
997 __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
1002 else if (__is_delim(_Traits::to_char_type(
__c))) {
1003 if (__extract_delim)
1006 __status |= ios_base::failbit;
1023template <
class _CharT,
class _Traits,
class _Max_Chars,
class _Is_Delim,
class _Scan_Delim>
1028 _Max_Chars __max_chars,
1029 _Is_Delim __is_delim, _Scan_Delim __scan_delim,
1030 bool __extract_delim,
bool __set_failbit) {
1032 bool __at_eof =
false;
1033 bool __done =
false;
1040 if (__avail >= __m) {
1047 if (__extract_delim && __p !=
__last) {
1056 const _CharT* __p = __scan_delim(__buf->
_M_gptr(), __buf->
_M_egptr());
1062 if (__extract_delim) {
1084 __that->
setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
1085 : ios_base::eofbit);
1096 __is_delim, __extract_delim, __set_failbit);
1100template <
class _CharT,
class _Traits>
1104 this->_M_gcount = 0;
1115 __maxss, _Const_streamsize(__maxss),
1121 __maxss, _Const_streamsize(__maxss),
1122 _Const_bool(
false),
false,
false);
1133 _Const_bool(
false),
false,
false);
1140template <
class _CharT,
class _Traits>
1144 this->_M_gcount = 0;
1156 __maxss, _Const_streamsize(__maxss),
1162 __maxss, _Const_streamsize(__maxss),
1185template <
class _CharT,
class _Traits>
1189 this->setstate(ios_base::badbit);
1190 else if (__buf->
gptr() != __buf->
egptr())
1194 false, __set_failbit);
1198 false, __set_failbit);
1211template <
class _CharT,
class _Traits,
class _Is_Delim>
1215 _Is_Delim __is_delim,
1216 bool __extract_delim,
bool __rethrow) {
1229 __status |= ios_base::eofbit;
1233 else if (__is_delim(_Traits::to_char_type(
__c))) {
1234 if (!__extract_delim && !
__pushback(__src, _Traits::to_char_type(
__c)))
1235 __status |= ios_base::failbit;
1240 bool __failed =
false;
1253 if (__failed && !
__pushback(__src, _Traits::to_char_type(
__c)))
1254 __status |= ios_base::failbit;
1268 if (__rethrow && __extracted == 0)
1280template <
class _CharT,
class _Traits,
class _Is_Delim,
class _Scan_Delim>
1284 _Scan_Delim __scan_delim, _Is_Delim __is_delim,
1285 bool __extract_delim,
bool __rethrow) {
1291 _CharT* __first = __src->
_M_gptr();
1294 bool __do_handle_exceptions =
false;
1308 __do_handle_exceptions =
true;
1318 __avail = __src->
_M_egptr() - __first;
1323 __status |= ios_base::eofbit;
1328 __extract_delim, __rethrow);
1331 __do_handle_exceptions =
false;
1337 if (__rethrow && __do_handle_exceptions && __extracted == 0)
1348template <
class _CharT,
class _Traits>
1353 this->_M_gcount = 0;
1359 this->_M_gcount = __src->
egptr() != __src->
gptr()
1369 if (this->_M_gcount == 0)
1370 this->setstate(ios_base::failbit);
1376template <
class _CharT,
class _Traits>
1382 _Sentry __sentry(*
this);
1385 if (__src && __dest)
1397 this->setstate(ios_base::failbit);
1406template <
class _CharT,
class _Traits>
1415template <
class _CharT,
class _Traits>
1421#undef __BIS_int_type__
1422#undef __BIS_pos_type__
1423#undef __BIS_off_type__
_STLP_INLINE_LOOP _InputIter __last
_STLP_MOVE_TO_STD_NAMESPACE _InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred)
_STLP_INLINE_LOOP _InputIter const _Tp & __val
#define _STLP_DEFAULT_CONSTRUCTED(_TTp)
streamsize _STLP_CALL __read_buffered(basic_istream< _CharT, _Traits > *__that, basic_streambuf< _CharT, _Traits > *__buf, streamsize _Num, _CharT *__s, _Is_Delim __is_delim, _Scan_Delim __scan_delim, bool __extract_delim, bool __append_null, bool __is_getline)
streamsize _STLP_CALL __copy_buffered(basic_istream< _CharT, _Traits > *__that, basic_streambuf< _CharT, _Traits > *__src, basic_streambuf< _CharT, _Traits > *__dest, _Scan_Delim __scan_delim, _Is_Delim __is_delim, bool __extract_delim, bool __rethrow)
bool _STLP_CALL __pushback(basic_streambuf< _CharT, _Traits > *__buf, _CharT __c)
ios_base::iostate _STLP_CALL __get_num(basic_istream< _CharT, _Traits > &__that, _Number &__val)
_STLP_MOVE_TO_PRIV_NAMESPACE streamsize _STLP_CALL __read_unbuffered(basic_istream< _CharT, _Traits > *__that, basic_streambuf< _CharT, _Traits > *__buf, streamsize _Num, _CharT *__s, _Is_Delim __is_delim, bool __extract_delim, bool __append_null, bool __is_getline)
void _STLP_CALL _M_ignore_unbuffered(basic_istream< _CharT, _Traits > *__that, basic_streambuf< _CharT, _Traits > *__buf, _Is_Delim __is_delim, bool __extract_delim, bool __set_failbit)
_STLP_MOVE_TO_PRIV_NAMESPACE streamsize _STLP_CALL __copy_unbuffered(basic_istream< _CharT, _Traits > *__that, basic_streambuf< _CharT, _Traits > *__src, basic_streambuf< _CharT, _Traits > *__dest, _Is_Delim __is_delim, bool __extract_delim, bool __rethrow)
void _STLP_CALL _M_ignore_buffered(basic_istream< _CharT, _Traits > *__that, basic_streambuf< _CharT, _Traits > *__buf, _Is_Delim __is_delim, _Scan_Delim __scan_delim, bool __extract_delim, bool __set_failbit)
void get(int argc, const char *argv[])
basic_streambuf< _CharT, _Traits > * rdbuf() const
static bool _STLP_CALL _S_eof(int_type __c)
void setstate(iostate __state)
void _M_handle_exception(ios_base::iostate __flag)
virtual ~basic_iostream()
_Self & operator>>(__istream_fn __f)
_Traits::pos_type pos_type
_Self & putback(char_type __c)
streamsize readsome(char_type *__s, streamsize __n)
_Traits::int_type int_type
_Traits::off_type off_type
_Self & seekg(pos_type __pos)
_Self & read(char_type *__s, streamsize __n)
_Self & getline(char_type *__s, streamsize __n, char_type delim)
void _M_formatted_get(_CharT &__c)
void _M_skip_whitespace(bool __set_failbit)
char_type * _M_egptr() const
int_type sputbackc(char_type __c)
pos_type pubseekoff(off_type __offset, ios_base::seekdir __way, ios_base::openmode __mod=ios_base::in|ios_base::out)
char_type * egptr() const
char_type * _M_gptr() const
pos_type pubseekpos(pos_type __sp, ios_base::openmode __mod=ios_base::in|ios_base::out)
streamsize sputn(const char_type *__s, streamsize __n)
int_type sputc(char_type __c)
__kernel_ptrdiff_t ptrdiff_t
#define _STLP_STATIC_ASSERT(expr)
#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
GLint GLint GLsizei width
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
_Traits::char_type argument_type
const ctype< argument_type > * _M_ctype
_Is_not_wspace(const ctype< argument_type > *__c_type)
bool operator()(argument_type __c) const
const ctype< argument_type > * _M_ctype
_Is_wspace_null(const ctype< argument_type > *__c_type)
bool operator()(argument_type __c) const
_Traits::char_type argument_type
_Scan_for_char_val(char_type __val)
_Traits::char_type char_type
char_type * first_argument_type
const char_type * operator()(const char_type *__first, const char_type *__last) const
char_type * second_argument_type
char_type * second_argument_type
_Scan_for_int_val(int_type __val)
_Traits::int_type int_type
_Traits::char_type char_type
char_type * first_argument_type
const char_type * operator()(const char_type *__first, const char_type *__last) const
_Traits::char_type char_type
_Scan_for_not_wspace(const ctype< char_type > *__c_type)
char_type * first_argument_type
char_type * second_argument_type
const ctype< char_type > * _M_ctype
const char_type * operator()(const char_type *__first, const char_type *__last) const
const char_type * operator()(const char_type *__first, const char_type *__last) const
_Scan_for_wspace(const ctype< char_type > *__ctype)
_Traits::char_type char_type
char_type * first_argument_type
char_type * second_argument_type
const ctype< char_type > * _M_ctype
char_type * second_argument_type
const char_type * operator()(const char_type *__first, const char_type *__last) const
_Scan_wspace_null(const ctype< char_type > *__c_type)
_Traits::char_type char_type
char_type * first_argument_type
const ctype< char_type > * _M_ctype