STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Macros | Functions
istream File Reference
#include <ostream>

Classes

class  basic_istream< _Elem, _Traits >
 
class  basic_istream< _Elem, _Traits >::_Sentry_base
 
class  basic_istream< _Elem, _Traits >::sentry
 
class  basic_iostream< _Elem, _Traits >
 

Macros

#define _ISTREAM_
 

Functions

template<class _Elem , class _Traits >
basic_istream< _Elem, _Traits > & operator>> (basic_istream< _Elem, _Traits > &_Istr, _Elem &_Ch)
 
template<class _Elem , class _Traits >
basic_istream< _Elem, _Traits > & operator>> (basic_istream< _Elem, _Traits > &_Istr, _Elem *_Str)
 
template<class _Traits >
basic_istream< char, _Traits > & operator>> (basic_istream< char, _Traits > &_Istr, signed char *_Str)
 
template<class _Traits >
basic_istream< char, _Traits > & operator>> (basic_istream< char, _Traits > &_Istr, signed char &_Ch)
 
template<class _Traits >
basic_istream< char, _Traits > & operator>> (basic_istream< char, _Traits > &_Istr, unsigned char *_Str)
 
template<class _Traits >
basic_istream< char, _Traits > & operator>> (basic_istream< char, _Traits > &_Istr, unsigned char &_Ch)
 
template<class _Elem , class _Traits , class _Ty >
basic_istream< _Elem, _Traits > & operator>> (basic_istream< _Elem, _Traits > &&_Istr, _Ty &&_Val)
 
template<class _Elem , class _Traits >
basic_istream< _Elem, _Traits > &__CLRCALL_OR_CDECL ws (basic_istream< _Elem, _Traits > &_Istr)
 

Macro Definition Documentation

#define _ISTREAM_

Function Documentation

template<class _Elem , class _Traits >
basic_istream< _Elem, _Traits > & operator>> ( basic_istream< _Elem, _Traits > &  _Istr,
_Elem &  _Ch 
)
inline
1038  { // extract a character
1039  typedef basic_istream<_Elem, _Traits> _Myis;
1040 
1041  typename _Myis::int_type _Meta;
1042  ios_base::iostate _State = ios_base::goodbit;
1043  const typename _Myis::sentry _Ok(_Istr);
1044 
1045  if (_Ok)
1046  { // state okay, extract characters
1048  _Meta = _Istr.rdbuf()->sbumpc();
1049  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1050  _State |= ios_base::eofbit | ios_base::failbit; // end of file
1051  else
1052  _Ch = _Traits::to_char_type(_Meta); // got a character
1053  _CATCH_IO_(_Istr)
1054  }
1055 
1056  _Istr.setstate(_State);
1057  return (_Istr);
1058  }
static constexpr _Iostate failbit
Definition: xiosbase:88
#define _CATCH_IO_(x)
Definition: ostream:31
#define _TRY_IO_BEGIN
Definition: ostream:29
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:89
int_type __CLR_OR_THIS_CALL sbumpc()
Definition: streambuf:147
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _Inout_ mbstate_t * _State
Definition: wchar.h:78
static constexpr _Iostate goodbit
Definition: xiosbase:86
Definition: iosfwd:574
static constexpr _Iostate eofbit
Definition: xiosbase:87
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:55
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& operator>> ( basic_istream< _Elem, _Traits > &  _Istr,
_Elem *  _Str 
)
inline
997  { // extract NTBS
998  typedef basic_istream<_Elem, _Traits> _Myis;
999  typedef ctype<_Elem> _Ctype;
1000  ios_base::iostate _State = ios_base::goodbit;
1001  _Elem *_Str0 = _Str;
1002  const typename _Myis::sentry _Ok(_Istr);
1003 
1004  if (_Ok)
1005  { // state okay, extract characters
1006  const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
1007 
1009  streamsize _Count = 0 < _Istr.width() ? _Istr.width()
1011  typename _Myis::int_type _Meta = _Istr.rdbuf()->sgetc();
1012  _Elem _Ch;
1013  for (; 0 < --_Count; _Meta = _Istr.rdbuf()->snextc())
1014  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1015  { // end of file, quit
1016  _State |= ios_base::eofbit;
1017  break;
1018  }
1019  else if (_Ctype_fac.is(_Ctype::space,
1020  _Ch = _Traits::to_char_type(_Meta))
1021  || _Ch == _Elem())
1022  break; // whitespace or nul, quit
1023  else
1024  *_Str++ = _Traits::to_char_type(_Meta); // add it to string
1025  _CATCH_IO_(_Istr)
1026  }
1027 
1028  *_Str = _Elem(); // add terminating null character
1029  _Istr.width(0);
1030  _Istr.setstate(_Str == _Str0 ? _State | ios_base::failbit : _State);
1031  return (_Istr);
1032  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:153
static constexpr _Iostate failbit
Definition: xiosbase:88
#define _CATCH_IO_(x)
Definition: ostream:31
long long streamsize
Definition: iosfwd:23
#define _USE(loc, fac)
Definition: xlocale:499
#define _TRY_IO_BEGIN
Definition: ostream:29
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:432
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:89
Definition: xlocale:2077
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _Inout_ mbstate_t * _State
Definition: wchar.h:78
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:165
streamsize __CLR_OR_THIS_CALL width() const
Definition: xiosbase:420
static constexpr _Iostate goodbit
Definition: xiosbase:86
_Diff _Count
Definition: algorithm:1941
space_info space(const path &)
Definition: filesystem:3117
Definition: iosfwd:574
static constexpr _Iostate eofbit
Definition: xiosbase:87
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:55
Definition: limits:102
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
signed char _Str 
)
inline
1063  { // extract a signed char NTBS
1064  return (_Istr >> (char *)_Str);
1065  }
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
signed char _Ch 
)
inline
1070  { // extract a signed char
1071  return (_Istr >> (char&)_Ch);
1072  }
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
unsigned char _Str 
)
inline
1077  { // extract an unsigned char NTBS
1078  return (_Istr >> (char *)_Str);
1079  }
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
unsigned char _Ch 
)
inline
1084  { // extract an unsigned char
1085  return (_Istr >> (char&)_Ch);
1086  }
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
template<class _Elem , class _Traits , class _Ty >
basic_istream<_Elem, _Traits>& operator>> ( basic_istream< _Elem, _Traits > &&  _Istr,
_Ty &&  _Val 
)
inline
1093  { // extract from rvalue stream
1094  _Istr >> _STD forward<_Ty>(_Val);
1095  return (_Istr);
1096  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& __CLRCALL_OR_CDECL ws ( basic_istream< _Elem, _Traits > &  _Istr)
inline
1103  { // consume whitespace
1104  typedef basic_istream<_Elem, _Traits> _Myis;
1105  typedef ctype<_Elem> _Ctype;
1106 
1107  if (!_Istr.eof())
1108  { // not at eof, okay to construct sentry and skip
1109  ios_base::iostate _State = ios_base::goodbit;
1110  const typename _Myis::sentry _Ok(_Istr, true);
1111 
1112  if (_Ok)
1113  { // state okay, extract characters
1114  const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
1115 
1117  for (typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
1118  _Meta = _Istr.rdbuf()->snextc())
1119  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1120  { // end of file, quit
1121  _State |= ios_base::eofbit;
1122  break;
1123  }
1124  else if (!_Ctype_fac.is(_Ctype::space,
1125  _Traits::to_char_type(_Meta)))
1126  break; // not whitespace, quit
1127  _CATCH_IO_(_Istr)
1128  }
1129 
1130  _Istr.setstate(_State);
1131  }
1132  return (_Istr);
1133  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:153
#define _CATCH_IO_(x)
Definition: ostream:31
bool __CLR_OR_THIS_CALL eof() const
Definition: xiosbase:341
#define _USE(loc, fac)
Definition: xlocale:499
#define _TRY_IO_BEGIN
Definition: ostream:29
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:432
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:89
Definition: xlocale:2077
_In_ size_t _Deref_pre_opt_z_ char const _In_ size_t _Inout_ mbstate_t * _State
Definition: wchar.h:78
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:165
static constexpr _Iostate goodbit
Definition: xiosbase:86
space_info space(const path &)
Definition: filesystem:3117
Definition: iosfwd:574
static constexpr _Iostate eofbit
Definition: xiosbase:87
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:55