ReactOS 0.4.16-dev-340-g0540c21
basic_istream< _CharT, _Traits > Class Template Reference

#include <_istream.h>

Inheritance diagram for basic_istream< _CharT, _Traits >:
Collaboration diagram for basic_istream< _CharT, _Traits >:

Classes

class  sentry
 

Public Types

typedef _CharT char_type
 
typedef _Traits::int_type int_type
 
typedef _Traits::pos_type pos_type
 
typedef _Traits::off_type off_type
 
typedef _Traits traits_type
 
typedef basic_ios< _CharT, _Traits > _Basic_ios
 
typedef basic_ios< _CharT, _Traits > &(_STLP_CALL__ios_fn) (basic_ios< _CharT, _Traits > &)
 
typedef ios_base &(_STLP_CALL__ios_base_fn) (ios_base &)
 
typedef _Self &(_STLP_CALL__istream_fn) (_Self &)
 
- Public Types inherited from basic_ios< _CharT, _Traits >
typedef _CharT char_type
 
typedef _Traits::int_type int_type
 
typedef _Traits::pos_type pos_type
 
typedef _Traits::off_type off_type
 
typedef _Traits traits_type
 
- Public Types inherited from ios_base
enum  event { erase_event , imbue_event , copyfmt_event }
 
typedef int fmtflags
 
typedef int iostate
 
typedef int openmode
 
typedef int seekdir
 
typedef fmtflags fmt_flags
 
typedef void(* event_callback) (event, ios_base &, int __index)
 
typedef iostate io_state
 
typedef openmode open_mode
 
typedef seekdir seek_dir
 
typedef _STLP_STD::streamoff streamoff
 
typedef _STLP_STD::streampos streampos
 

Public Member Functions

 basic_istream (basic_streambuf< _CharT, _Traits > *__buf)
 
 ~basic_istream ()
 
_Selfoperator>> (__istream_fn __f)
 
_Selfoperator>> (__ios_fn __f)
 
_Selfoperator>> (__ios_base_fn __f)
 
_Selfoperator>> (short &__val)
 
_Selfoperator>> (int &__val)
 
_Selfoperator>> (unsigned short &__val)
 
_Selfoperator>> (unsigned int &__val)
 
_Selfoperator>> (long &__val)
 
_Selfoperator>> (unsigned long &__val)
 
_Selfoperator>> (float &__val)
 
_Selfoperator>> (double &__val)
 
_Selfoperator>> (long double &__val)
 
_Selfoperator>> (bool &__val)
 
_Selfoperator>> (void *&__val)
 
_Selfoperator>> (basic_streambuf< _CharT, _Traits > *)
 
streamsize gcount () const
 
int_type peek ()
 
int_type get ()
 
_Selfget (char_type &__c)
 
_Selfget (char_type *__s, streamsize __n, char_type __delim)
 
_Selfget (char_type *__s, streamsize __n)
 
_Selfget (basic_streambuf< _CharT, _Traits > &__buf, char_type __delim)
 
_Selfget (basic_streambuf< _CharT, _Traits > &__buf)
 
_Selfgetline (char_type *__s, streamsize __n, char_type delim)
 
_Selfgetline (char_type *__s, streamsize __n)
 
_Selfignore ()
 
_Selfignore (streamsize __n)
 
_Selfignore (streamsize __n, int_type __delim)
 
_Selfread (char_type *__s, streamsize __n)
 
streamsize readsome (char_type *__s, streamsize __n)
 
_Selfputback (char_type __c)
 
_Selfunget ()
 
int sync ()
 
pos_type tellg ()
 
_Selfseekg (pos_type __pos)
 
_Selfseekg (off_type, ios_base::seekdir)
 
void _M_formatted_get (_CharT &__c)
 
void _M_formatted_get (_CharT *__s)
 
void _M_skip_whitespace (bool __set_failbit)
 
- Public Member Functions inherited from basic_ios< _CharT, _Traits >
 basic_ios (basic_streambuf< _CharT, _Traits > *__streambuf)
 
virtual ~basic_ios ()
 
basic_ostream< _CharT, _Traits > * tie () const
 
basic_ostream< _CharT, _Traits > * tie (basic_ostream< char_type, traits_type > *__new_tied_ostream)
 
basic_streambuf< _CharT, _Traits > * rdbuf () const
 
basic_streambuf< _CharT, _Traits > * rdbuf (basic_streambuf< char_type, traits_type > *)
 
basic_ios< _CharT, _Traits > & copyfmt (const basic_ios< _CharT, _Traits > &__x)
 
char_type fill () const
 
char_type fill (char_type __fill)
 
void clear (iostate __state=goodbit)
 
void setstate (iostate __state)
 
iostate exceptions () const
 
void exceptions (iostate __mask)
 
locale imbue (const locale &)
 
char narrow (_CharT, char) const
 
_CharT widen (char) const
 
const ctype< char_type > * _M_ctype_facet () const
 
void _M_handle_exception (ios_base::iostate __flag)
 
- Public Member Functions inherited from ios_base
 _STLP_STATIC_CONSTANT (int, left=0x0001)
 
 _STLP_STATIC_CONSTANT (int, right=0x0002)
 
 _STLP_STATIC_CONSTANT (int, internal=0x0004)
 
 _STLP_STATIC_CONSTANT (int, dec=0x0008)
 
 _STLP_STATIC_CONSTANT (int, hex=0x0010)
 
 _STLP_STATIC_CONSTANT (int, oct=0x0020)
 
 _STLP_STATIC_CONSTANT (int, fixed=0x0040)
 
 _STLP_STATIC_CONSTANT (int, scientific=0x0080)
 
 _STLP_STATIC_CONSTANT (int, boolalpha=0x0100)
 
 _STLP_STATIC_CONSTANT (int, showbase=0x0200)
 
 _STLP_STATIC_CONSTANT (int, showpoint=0x0400)
 
 _STLP_STATIC_CONSTANT (int, showpos=0x0800)
 
 _STLP_STATIC_CONSTANT (int, skipws=0x1000)
 
 _STLP_STATIC_CONSTANT (int, unitbuf=0x2000)
 
 _STLP_STATIC_CONSTANT (int, uppercase=0x4000)
 
 _STLP_STATIC_CONSTANT (int, adjustfield=left|right|internal)
 
 _STLP_STATIC_CONSTANT (int, basefield=dec|hex|oct)
 
 _STLP_STATIC_CONSTANT (int, floatfield=scientific|fixed)
 
 _STLP_STATIC_CONSTANT (int, goodbit=0x00)
 
 _STLP_STATIC_CONSTANT (int, badbit=0x01)
 
 _STLP_STATIC_CONSTANT (int, eofbit=0x02)
 
 _STLP_STATIC_CONSTANT (int, failbit=0x04)
 
 _STLP_STATIC_CONSTANT (int, __default_mode=0x0)
 
 _STLP_STATIC_CONSTANT (int, app=0x01)
 
 _STLP_STATIC_CONSTANT (int, ate=0x02)
 
 _STLP_STATIC_CONSTANT (int, binary=0x04)
 
 _STLP_STATIC_CONSTANT (int, in=0x08)
 
 _STLP_STATIC_CONSTANT (int, out=0x10)
 
 _STLP_STATIC_CONSTANT (int, trunc=0x20)
 
 _STLP_STATIC_CONSTANT (int, beg=0x01)
 
 _STLP_STATIC_CONSTANT (int, cur=0x02)
 
 _STLP_STATIC_CONSTANT (int, end=0x04)
 
fmtflags flags () const
 
fmtflags flags (fmtflags __flags)
 
fmtflags setf (fmtflags __flag)
 
fmtflags setf (fmtflags __flag, fmtflags __mask)
 
void unsetf (fmtflags __mask)
 
streamsize precision () const
 
streamsize precision (streamsize __newprecision)
 
streamsize width () const
 
streamsize width (streamsize __newwidth)
 
locale imbue (const locale &)
 
locale getloc () const
 
longiword (int __index)
 
void *& pword (int __index)
 
virtual ~ios_base ()
 
void register_callback (event_callback __fn, int __index)
 
 operator void * () const
 
bool operator! () const
 
iostate rdstate () const
 
bool good () const
 
bool eof () const
 
bool fail () const
 
bool bad () const
 

Private Types

typedef basic_istream< _CharT, _Traits > _Self
 

Private Attributes

streamsize _M_gcount
 

Additional Inherited Members

- Static Public Member Functions inherited from basic_ios< _CharT, _Traits >
static bool _STLP_CALL _S_eof (int_type __c)
 
- Static Public Member Functions inherited from ios_base
static int _STLP_CALL xalloc ()
 
static bool _STLP_CALL sync_with_stdio (bool __sync=true)
 
- Protected Member Functions inherited from basic_ios< _CharT, _Traits >
 basic_ios ()
 
void init (basic_streambuf< _CharT, _Traits > *__streambuf)
 
- Protected Member Functions inherited from ios_base
void _M_copy_state (const ios_base &__x)
 
void _M_setstate_nothrow (iostate __state)
 
void _M_clear_nothrow (iostate __state)
 
iostate _M_get_exception_mask () const
 
void _M_set_exception_mask (iostate __mask)
 
void _M_check_exception_mask ()
 
void _M_invoke_callbacks (event)
 
void _STLP_FUNCTION_THROWS _M_throw_failure ()
 
 ios_base ()
 
- Static Protected Member Functions inherited from ios_base
static void _STLP_CALL _S_initialize ()
 
static void _STLP_CALL _S_uninitialize ()
 
- Protected Attributes inherited from basic_ios< _CharT, _Traits >
const ctype< char_type > * _M_cached_ctype
 
- Static Protected Attributes inherited from ios_base
static bool _S_is_synced = true
 

Detailed Description

template<class _CharT, class _Traits>
class basic_istream< _CharT, _Traits >

Definition at line 63 of file _istream.h.

Member Typedef Documentation

◆ __ios_base_fn

template<class _CharT , class _Traits >
typedef ios_base &(_STLP_CALL * basic_istream< _CharT, _Traits >::__ios_base_fn) (ios_base &)

Definition at line 82 of file _istream.h.

◆ __ios_fn

template<class _CharT , class _Traits >
typedef basic_ios< _CharT, _Traits > &(_STLP_CALL * basic_istream< _CharT, _Traits >::__ios_fn) (basic_ios< _CharT, _Traits > &)

Definition at line 81 of file _istream.h.

◆ __istream_fn

template<class _CharT , class _Traits >
typedef _Self &(_STLP_CALL * basic_istream< _CharT, _Traits >::__istream_fn) (_Self &)

Definition at line 83 of file _istream.h.

◆ _Basic_ios

template<class _CharT , class _Traits >
typedef basic_ios<_CharT, _Traits> basic_istream< _CharT, _Traits >::_Basic_ios

Definition at line 79 of file _istream.h.

◆ _Self

template<class _CharT , class _Traits >
typedef basic_istream<_CharT, _Traits> basic_istream< _CharT, _Traits >::_Self
private

Definition at line 64 of file _istream.h.

◆ char_type

template<class _CharT , class _Traits >
typedef _CharT basic_istream< _CharT, _Traits >::char_type

Definition at line 74 of file _istream.h.

◆ int_type

template<class _CharT , class _Traits >
typedef _Traits::int_type basic_istream< _CharT, _Traits >::int_type

Definition at line 75 of file _istream.h.

◆ off_type

template<class _CharT , class _Traits >
typedef _Traits::off_type basic_istream< _CharT, _Traits >::off_type

Definition at line 77 of file _istream.h.

◆ pos_type

template<class _CharT , class _Traits >
typedef _Traits::pos_type basic_istream< _CharT, _Traits >::pos_type

Definition at line 76 of file _istream.h.

◆ traits_type

template<class _CharT , class _Traits >
typedef _Traits basic_istream< _CharT, _Traits >::traits_type

Definition at line 78 of file _istream.h.

Constructor & Destructor Documentation

◆ basic_istream()

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits >::basic_istream ( basic_streambuf< _CharT, _Traits > *  __buf)
inlineexplicit

Definition at line 86 of file _istream.h.

86 :
88 this->init(__buf);
89 }
Definition: _ios.h:48
streamsize _M_gcount
Definition: _istream.h:173
static int init
Definition: wintirpc.c:33

◆ ~basic_istream()

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits >::~basic_istream ( )
inline

Definition at line 90 of file _istream.h.

90{};

Member Function Documentation

◆ _M_formatted_get() [1/2]

template<class _CharT , class _Traits >
void basic_istream< _CharT, _Traits >::_M_formatted_get ( _CharT &  __c)

Definition at line 530 of file _istream.c.

530 {
531// typename _Traits::int_type __tmp = _Traits::eof();
532
533 sentry __sentry(*this); // Skip whitespace.
534
535 if (__sentry) {
536 typename _Traits::int_type __tmp;// = _Traits::eof();
537
538 _STLP_TRY {
539 __tmp = this->rdbuf()->sbumpc();
540 }
542 this->_M_handle_exception(ios_base::badbit);
543 return;
544 }
545
546 if (!this->_S_eof(__tmp))
547 __c = _Traits::to_char_type(__tmp);
548 else
549 this->setstate(ios_base::eofbit | ios_base::failbit);
550 }
551}
basic_streambuf< _CharT, _Traits > * rdbuf() const
Definition: _ios.h:72
static bool _STLP_CALL _S_eof(int_type __c)
Definition: _ios.h:110
void setstate(iostate __state)
Definition: _ios.h:95
void _M_handle_exception(ios_base::iostate __flag)
Definition: _ios.c:114
#define _STLP_TRY
Definition: features.h:817
#define _STLP_CATCH_ALL
Definition: features.h:818
#define __c
Definition: schilyio.h:209

Referenced by operator>>().

◆ _M_formatted_get() [2/2]

template<class _CharT , class _Traits >
void basic_istream< _CharT, _Traits >::_M_formatted_get ( _CharT *  __s)

Definition at line 858 of file _istream.c.

858 {
859 sentry __sentry(*this); // Skip whitespace.
860
861 if (__sentry) {
863 streamsize __nmax = this->width() > 0
864 ? this->width() - 1
865 : ((numeric_limits<streamsize>::max)() / sizeof(_CharT)) - 1;
866
867 streamsize __n = __buf->gptr() != __buf->egptr()
868 ? _STLP_PRIV __read_buffered(this, __buf, __nmax, __s,
871 false, true, false)
872 : _STLP_PRIV __read_unbuffered(this, __buf, __nmax, __s,
873 _STLP_PRIV _Is_wspace_null<_Traits>(this->_M_ctype_facet()),
874 false, true, false);
875 if (__n == 0)
876 this->setstate(ios_base::failbit);
877 }
878 this->width(0);
879}
return __n
Definition: _algo.h:75
#define _STLP_PRIV
Definition: _dm.h:70
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)
Definition: _istream.c:635
_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)
Definition: _istream.c:579
ptrdiff_t streamsize
Definition: char_traits.h:81
const ctype< char_type > * _M_ctype_facet() const
Definition: _ios.h:121
char_type * egptr() const
Definition: _streambuf.h:89
char_type * gptr() const
Definition: _streambuf.h:88
streamsize width() const
Definition: _ios_base.h:134
#define true
Definition: stdbool.h:36
#define false
Definition: stdbool.h:37

◆ _M_skip_whitespace()

template<class _CharT , class _Traits >
void basic_istream< _CharT, _Traits >::_M_skip_whitespace ( bool  __set_failbit)

Definition at line 1186 of file _istream.c.

1186 {
1187 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
1188 if (!__buf)
1189 this->setstate(ios_base::badbit);
1190 else if (__buf->gptr() != __buf->egptr())
1191 _M_ignore_buffered(this, __buf,
1194 false, __set_failbit);
1195 else
1196 _M_ignore_unbuffered(this, __buf,
1198 false, __set_failbit);
1199}
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)
Definition: _istream.c:888
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)
Definition: _istream.c:928

Referenced by _M_init_skip(), and ws().

◆ gcount()

template<class _CharT , class _Traits >
streamsize basic_istream< _CharT, _Traits >::gcount ( ) const
inline

Definition at line 125 of file _istream.h.

125{ return _M_gcount; }

Referenced by utf_converter::getBOM(), and utf_converter::getByte().

◆ get() [1/6]

template<class _CharT , class _Traits >
__BIS_int_type__ basic_istream< _CharT, _Traits >::get

Definition at line 339 of file _istream.c.

339 {
340 typename _Traits::int_type __tmp = _Traits::eof();
341 sentry __sentry(*this, _No_Skip_WS());
342 this->_M_gcount = 0;
343
344 if (__sentry) {
345 _STLP_TRY {
346 __tmp = this->rdbuf()->sbumpc();
347 }
349 this->_M_handle_exception(ios_base::badbit);
350 }
351
352 if (!this->_S_eof(__tmp))
353 this->_M_gcount = 1;
354 }
355
356 if (_M_gcount == 0)
357 this->setstate(ios_base::eofbit | ios_base::failbit);
358
359 return __tmp;
360}

Referenced by basic_istream< _CharT, _Traits >::get(), getline_no_comments(), and CodecvtTest::imbue_while_reading().

◆ get() [2/6]

template<class _CharT , class _Traits >
_Self & basic_istream< _CharT, _Traits >::get ( basic_streambuf< _CharT, _Traits > &  __buf)
inline

Definition at line 140 of file _istream.h.

141 { return get(__buf, this->widen('\n')); }
_CharT widen(char) const
Definition: _ios.h:150
int_type get()
Definition: _istream.c:339

◆ get() [3/6]

template<class _CharT , class _Traits >
_STLP_MOVE_TO_STD_NAMESPACE basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::get ( basic_streambuf< _CharT, _Traits > &  __buf,
char_type  __delim 
)

Definition at line 1351 of file _istream.c.

1351 {
1352 sentry __sentry(*this, _No_Skip_WS());
1353 this->_M_gcount = 0;
1354
1355 if (__sentry) {
1356 basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
1357
1358 if (__src)
1359 this->_M_gcount = __src->egptr() != __src->gptr()
1360 ? _STLP_PRIV __copy_buffered(this, __src, &__dest,
1363 false, false)
1364 : _STLP_PRIV __copy_unbuffered(this, __src, &__dest,
1365 _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
1366 false, false);
1367 }
1368
1369 if (this->_M_gcount == 0)
1370 this->setstate(ios_base::failbit);
1371
1372 return *this;
1373}
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)
Definition: _istream.c:1282
_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)
Definition: _istream.c:1213

◆ get() [4/6]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::get ( char_type __c)

Definition at line 364 of file _istream.c.

364 {
365 sentry __sentry(*this, _No_Skip_WS());
366 this->_M_gcount = 0;
367
368 if (__sentry) {
369 typename _Traits::int_type __tmp = _Traits::eof();
370 _STLP_TRY {
371 __tmp = this->rdbuf()->sbumpc();
372 }
374 this->_M_handle_exception(ios_base::badbit);
375 }
376
377 if (!this->_S_eof(__tmp)) {
378 this->_M_gcount = 1;
379 __c = _Traits::to_char_type(__tmp);
380 }
381 }
382
383 if (this->_M_gcount == 0)
384 this->setstate(ios_base::eofbit | ios_base::failbit);
385
386 return *this;
387}

◆ get() [5/6]

template<class _CharT , class _Traits >
_Self & basic_istream< _CharT, _Traits >::get ( char_type __s,
streamsize  __n 
)
inline

Definition at line 134 of file _istream.h.

135 { return get(__s, __n, this->widen('\n')); }

◆ get() [6/6]

template<class _CharT , class _Traits >
_STLP_MOVE_TO_STD_NAMESPACE basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::get ( char_type __s,
streamsize  __n,
char_type  __delim 
)

Definition at line 721 of file _istream.c.

722 {
723 sentry __sentry(*this, _No_Skip_WS());
724 this->_M_gcount = 0;
725
726 if (__sentry) {
727 if (__n > 0) {
729
730 if (__buf->egptr() != __buf->gptr())
731 this->_M_gcount =
732 _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
735 false, true, false);
736 else
737 this->_M_gcount =
738 _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
740 false, true, false);
741 }
742 }
743
744 if (this->_M_gcount == 0)
745 this->setstate(ios_base::failbit);
746
747 return *this;
748}

◆ getline() [1/2]

template<class _CharT , class _Traits >
_Self & basic_istream< _CharT, _Traits >::getline ( char_type __s,
streamsize  __n 
)
inline

Definition at line 145 of file _istream.h.

146 { return getline(__s, __n, this->widen('\n')); }
#define getline
Definition: schily.h:567

◆ getline() [2/2]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::getline ( char_type __s,
streamsize  __n,
char_type  delim 
)

Definition at line 754 of file _istream.c.

755 {
756 sentry __sentry(*this, _No_Skip_WS());
757 this->_M_gcount = 0;
758
759 if (__sentry) {
760 if (__n > 0) {
762 this->_M_gcount = __buf->egptr() != __buf->gptr()
763 ? _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
766 true, true, true)
767 : _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
768 _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
769 true, true, true);
770 }
771 }
772
773 if (this->_M_gcount == 0)
774 this->setstate(ios_base::failbit);
775
776 return *this;
777}

◆ ignore() [1/3]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::ignore

Definition at line 395 of file _istream.c.

395 {
396 sentry __sentry(*this, _No_Skip_WS());
397 this->_M_gcount = 0;
398
399 if (__sentry) {
401 _STLP_TRY {
402 __c = this->rdbuf()->sbumpc();
403 }
405 this->_M_handle_exception(ios_base::badbit);
406 return *this;
407 }
408
409 if (!this->_S_eof(__c))
410 this->_M_gcount = 1;
411 else
412 this->setstate(ios_base::eofbit);
413 }
414
415 return *this;
416}
_Traits::int_type int_type
Definition: _istream.h:75

Referenced by CodecvtTest::imbue_while_reading().

◆ ignore() [2/3]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::ignore ( streamsize  __n)

Definition at line 1102 of file _istream.c.

1102 {
1103 sentry __sentry(*this, _No_Skip_WS());
1104 this->_M_gcount = 0;
1105
1106 if (__sentry) {
1107 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
1110 const streamsize __maxss = (numeric_limits<streamsize>::max)();
1111
1112 if (__n == (numeric_limits<int>::max)()) {
1113 if (__buf->gptr() != __buf->egptr())
1114 _M_gcount = _M_ignore_buffered(this, __buf,
1115 __maxss, _Const_streamsize(__maxss),
1116 _Const_bool(false),
1118 false, false);
1119 else
1120 _M_gcount = _M_ignore_unbuffered(this, __buf,
1121 __maxss, _Const_streamsize(__maxss),
1122 _Const_bool(false), false, false);
1123 }
1124 else {
1125 if (__buf->gptr() != __buf->egptr())
1126 _M_gcount = _M_ignore_buffered(this, __buf,
1128 _Const_bool(false),
1130 false, false);
1131 else
1133 _Const_bool(false), false, false);
1134 }
1135 }
1136
1137 return *this;
1138}

◆ ignore() [3/3]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::ignore ( streamsize  __n,
int_type  __delim 
)

Definition at line 1142 of file _istream.c.

1142 {
1143 sentry __sentry(*this, _No_Skip_WS());
1144 this->_M_gcount = 0;
1145
1146 if (__sentry) {
1147 basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
1150 _Const_streamsize;
1151 const streamsize __maxss = (numeric_limits<streamsize>::max)();
1152
1153 if (__n == (numeric_limits<int>::max)()) {
1154 if (__buf->gptr() != __buf->egptr())
1155 _M_gcount = _M_ignore_buffered(this, __buf,
1156 __maxss, _Const_streamsize(__maxss),
1159 true, false);
1160 else
1161 _M_gcount = _M_ignore_unbuffered(this, __buf,
1162 __maxss, _Const_streamsize(__maxss),
1164 true, false);
1165 }
1166 else {
1167 if (__buf->gptr() != __buf->egptr())
1168 _M_gcount = _M_ignore_buffered(this, __buf,
1172 true, false);
1173 else
1176 true, false);
1177 }
1178 }
1179
1180 return *this;
1181}

◆ operator>>() [1/15]

template<class _CharT , class _Traits >
_Self & basic_istream< _CharT, _Traits >::operator>> ( __ios_base_fn  __f)
inline

Definition at line 98 of file _istream.h.

98{ __f(*this); return *this; }

◆ operator>>() [2/15]

template<class _CharT , class _Traits >
_Self & basic_istream< _CharT, _Traits >::operator>> ( __ios_fn  __f)
inline

Definition at line 97 of file _istream.h.

97{ __f(*this); return *this; }

◆ operator>>() [3/15]

template<class _CharT , class _Traits >
_Self & basic_istream< _CharT, _Traits >::operator>> ( __istream_fn  __f)
inline

Definition at line 96 of file _istream.h.

96{ return __f(*this); }

◆ operator>>() [4/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( basic_streambuf< _CharT, _Traits > *  __dest)

Definition at line 1379 of file _istream.c.

1379 {
1380 streamsize __n = 0;
1381 typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
1382 _Sentry __sentry(*this);
1383 if (__sentry) {
1384 basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
1385 if (__src && __dest)
1386 __n = __src->egptr() != __src->gptr()
1387 ? _STLP_PRIV __copy_buffered(this, __src, __dest,
1390 false, true)
1391 : _STLP_PRIV __copy_unbuffered(this, __src, __dest,
1393 false, true);
1394 }
1395
1396 if (__n == 0)
1397 this->setstate(ios_base::failbit);
1398
1399 return *this;
1400}
#define bool
Definition: nsiface.idl:72

◆ operator>>() [5/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( bool __val)

Definition at line 300 of file _istream.c.

300 {
301 _STLP_PRIV __get_num(*this, __val);
302 return *this;
303}
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
ios_base::iostate _STLP_CALL __get_num(basic_istream< _CharT, _Traits > &__that, _Number &__val)
Definition: _istream.c:186

◆ operator>>() [6/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( double __val)

Definition at line 287 of file _istream.c.

287 {
288 _STLP_PRIV __get_num(*this, __val);
289 return *this;
290}

◆ operator>>() [7/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( float __val)

Definition at line 282 of file _istream.c.

282 {
283 _STLP_PRIV __get_num(*this, __val);
284 return *this;
285}

◆ operator>>() [8/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( int __val)

Definition at line 227 of file _istream.c.

227 {
228 long __lval;
229 _STLP_PRIV __get_num(*this, __lval);
230 if ( this->fail() ) {
231 return *this;
232 }
233 int __tmp = __lval;
234 unsigned int __uval = __lval;
235 // check if we lose digits
236 // if ((__val != __lval) && ((unsigned int)__val != __lval))
237 if ((__tmp != __lval) && ((long)__uval != __lval))
238 this->setstate(ios_base::failbit);
239 else
240 __val = __tmp;
241 return *this;
242}
bool fail() const
Definition: _ios_base.h:174

◆ operator>>() [9/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( long __val)

Definition at line 257 of file _istream.c.

257 {
258 _STLP_PRIV __get_num(*this, __val);
259 return *this;
260}

◆ operator>>() [10/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( long double __val)

Definition at line 293 of file _istream.c.

293 {
294 _STLP_PRIV __get_num(*this, __val);
295 return *this;
296}

◆ operator>>() [11/15]

template<class _CharT , class _Traits >
_STLP_MOVE_TO_STD_NAMESPACE basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( short __val)

Definition at line 209 of file _istream.c.

209 {
210 long __lval;
211 _STLP_PRIV __get_num(*this, __lval);
212 if ( this->fail() ) {
213 return *this;
214 }
215 short __tmp = __STATIC_CAST(short, __lval);
216 unsigned short __uval = __STATIC_CAST(unsigned short, __lval);
217 // check if we lose digits
218 // if ((__val != __lval) && ((unsigned short)__val != __lval))
219 if ((__tmp != __lval) && ((long)__uval != __lval))
220 this->setstate(ios_base::failbit);
221 else
222 __val = __tmp;
223 return *this;
224}
#define __STATIC_CAST(__x, __y)
Definition: features.h:585

◆ operator>>() [12/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( unsigned int __val)

Definition at line 251 of file _istream.c.

251 {
252 _STLP_PRIV __get_num(*this, __val);
253 return *this;
254}

◆ operator>>() [13/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( unsigned long __val)

Definition at line 263 of file _istream.c.

263 {
264 _STLP_PRIV __get_num(*this, __val);
265 return *this;
266}

◆ operator>>() [14/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( unsigned short __val)

Definition at line 245 of file _istream.c.

245 {
246 _STLP_PRIV __get_num(*this, __val);
247 return *this;
248}

◆ operator>>() [15/15]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::operator>> ( void *&  __val)

Definition at line 307 of file _istream.c.

307 {
308 _STLP_PRIV __get_num(*this, __val);
309 return *this;
310}

◆ peek()

template<class _CharT , class _Traits >
__BIS_int_type__ basic_istream< _CharT, _Traits >::peek

Definition at line 316 of file _istream.c.

316 {
317 typename _Traits::int_type __tmp = _Traits::eof();
318
319 this->_M_gcount = 0;
320 sentry __sentry(*this, _No_Skip_WS());
321
322 if (__sentry) {
323 _STLP_TRY {
324 __tmp = this->rdbuf()->sgetc();
325 }
327 this->_M_handle_exception(ios_base::badbit);
328 }
329 if (this->_S_eof(__tmp))
330 this->setstate(ios_base::eofbit);
331 }
332
333 return __tmp;
334}

◆ putback()

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::putback ( char_type  __c)

Definition at line 422 of file _istream.c.

422 {
423 this->_M_gcount = 0;
424 sentry __sentry(*this, _No_Skip_WS());
425
426 if (__sentry) {
427 typename _Traits::int_type __tmp = _Traits::eof();
429// if (!__buf || this->_S_eof(__buf->sputbackc(__c)))
430 if (__buf) {
431 _STLP_TRY {
432 __tmp = __buf->sputbackc(__c);
433 }
435 this->_M_handle_exception(ios_base::badbit);
436 }
437 }
438 if (this->_S_eof(__tmp))
439 this->setstate(ios_base::badbit);
440 }
441 else
442 this->setstate(ios_base::failbit);
443
444 return *this;
445}
int_type sputbackc(char_type __c)
Definition: _streambuf.h:241

Referenced by operator>>().

◆ read()

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::read ( char_type __s,
streamsize  __n 
)

Definition at line 783 of file _istream.c.

783 {
784 sentry __sentry(*this, _No_Skip_WS());
785 this->_M_gcount = 0;
786
787 if (__sentry && !this->eof()) {
789 if (__buf->gptr() != __buf->egptr())
791 = _STLP_PRIV __read_buffered(this, __buf, __n, __s,
794 false, false, false);
795 else
797 = _STLP_PRIV __read_unbuffered(this, __buf, __n, __s,
799 false, false, false);
800 }
801 else
802 this->setstate(ios_base::failbit);
803
804 if (this->eof())
805 this->setstate(ios_base::eofbit | ios_base::failbit);
806
807 return *this;
808}
bool eof() const
Definition: _ios_base.h:173

Referenced by utf_converter::getBOM(), and utf_converter::getByte().

◆ readsome()

template<class _CharT , class _Traits >
streamsize basic_istream< _CharT, _Traits >::readsome ( char_type __s,
streamsize  __n 
)

Definition at line 815 of file _istream.c.

815 {
816 sentry __sentry(*this, _No_Skip_WS());
817 this->_M_gcount = 0;
818
819 if (__sentry && !this->eof() && __nmax >= 0) {
820
822 streamsize __avail = __buf->in_avail();
823
824 // fbp : isn't full-blown setstate required here ?
825 if (__avail == -1)
826 this->_M_setstate_nothrow(ios_base::eofbit);
827
828 else if (__avail != 0) {
829
830 if (__buf->gptr() != __buf->egptr())
832 = _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s,
835 false, false, false);
836 else
838 = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
840 false, false, false);
841 }
842 }
843 else {
844 // fbp : changed so that failbit is set only there, to pass Dietmar's test
845 if (this->eof())
846 this->setstate(ios_base::eofbit | ios_base::failbit);
847 else
848 this->setstate(ios_base::failbit);
849 }
850
851 // if (this->eof())
852 // this->setstate(ios_base::eofbit | ios_base::failbit);
853
854 return _M_gcount;
855}
streamsize in_avail()
Definition: _streambuf.h:215
void _M_setstate_nothrow(iostate __state)
Definition: _ios_base.h:185
#define min(a, b)
Definition: monoChain.cc:55

◆ seekg() [1/2]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::seekg ( off_type  __off,
ios_base::seekdir  __dir 
)

Definition at line 518 of file _istream.c.

518 {
519 sentry __sentry(*this, _No_Skip_WS());
520
522 if (!this->fail() && __buf)
523 __buf->pubseekoff(__off, __dir, ios_base::in);
524 return *this;
525}
pos_type pubseekoff(off_type __offset, ios_base::seekdir __way, ios_base::openmode __mod=ios_base::in|ios_base::out)
Definition: _streambuf.h:145

◆ seekg() [2/2]

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::seekg ( pos_type  __pos)

Definition at line 504 of file _istream.c.

504 {
505 sentry __sentry(*this, _No_Skip_WS());
506
508 if (!this->fail() && __buf) {
509 if (__buf->pubseekpos(__pos, ios_base::in) == pos_type(-1)) {
510 this->setstate(ios_base::failbit);
511 }
512 }
513 return *this;
514}
_Traits::pos_type pos_type
Definition: _istream.h:76
pos_type pubseekpos(pos_type __sp, ios_base::openmode __mod=ios_base::in|ios_base::out)
Definition: _streambuf.h:149

Referenced by CodecvtTest::imbue_while_reading(), and SstreamTest::seek().

◆ sync()

template<class _CharT , class _Traits >
int basic_istream< _CharT, _Traits >::sync

Definition at line 476 of file _istream.c.

476 {
477 sentry __sentry(*this, _No_Skip_WS());
478
480 if (__buf) {
481 if (__buf->pubsync() == -1) {
482 this->setstate(ios_base::badbit);
483 return -1;
484 }
485 else
486 return 0;
487 }
488 else
489 return -1;
490}

◆ tellg()

template<class _CharT , class _Traits >
__BIS_pos_type__ basic_istream< _CharT, _Traits >::tellg

Definition at line 494 of file _istream.c.

494 {
495 sentry __sentry(*this, _No_Skip_WS());
496
498 return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in)
499 : pos_type(-1);
500}

Referenced by _tiffStreamOpen(), and SstreamTest::seek().

◆ unget()

template<class _CharT , class _Traits >
basic_istream< _CharT, _Traits > & basic_istream< _CharT, _Traits >::unget

Definition at line 448 of file _istream.c.

448 {
449 this->_M_gcount = 0;
450
451 sentry __sentry(*this, _No_Skip_WS());
452
453 if (__sentry) {
455 // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof()))
456 if (__buf) {
457 _STLP_TRY {
458 if (this->_S_eof(__buf->sungetc()))
459 this->setstate(ios_base::badbit);
460 }
462 this->_M_handle_exception(ios_base::badbit);
463 }
464 } else
465 this->setstate(ios_base::badbit);
466 }
467 else
468 this->setstate(ios_base::failbit);
469
470 return *this;
471}
int_type sungetc()
Definition: _streambuf.h:247

Member Data Documentation

◆ _M_gcount

template<class _CharT , class _Traits >
streamsize basic_istream< _CharT, _Traits >::_M_gcount
private

Definition at line 173 of file _istream.h.

Referenced by basic_istream< _CharT, _Traits >::gcount().


The documentation for this class was generated from the following files: