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)
 
_CRTIMP2_PURE basic_istream< char, char_traits< char > > &__CLRCALL_OR_CDECL ws (basic_istream< char, char_traits< char > > &_Istr)
 
_CRTIMP2_PURE basic_istream< wchar_t, char_traits< wchar_t > > &__CLRCALL_OR_CDECL ws (basic_istream< wchar_t, char_traits< wchar_t > > &_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
1049  { // extract a character
1050  typedef basic_istream<_Elem, _Traits> _Myis;
1051 
1052  typename _Myis::int_type _Meta;
1053  ios_base::iostate _State = ios_base::goodbit;
1054  const typename _Myis::sentry _Ok(_Istr);
1055 
1056  if (_Ok)
1057  { // state okay, extract characters
1059  _Meta = _Istr.rdbuf()->sbumpc();
1060  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1061  _State |= ios_base::eofbit | ios_base::failbit; // end of file
1062  else
1063  _Ch = _Traits::to_char_type(_Meta); // got a character
1064  _CATCH_IO_(_Istr)
1065  }
1066 
1067  _Istr.setstate(_State);
1068  return (_Istr);
1069  }
static const _Iostate failbit
Definition: xiosbase:89
#define _CATCH_IO_(x)
Definition: ostream:32
#define _TRY_IO_BEGIN
Definition: ostream:30
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:86
int_type __CLR_OR_THIS_CALL sbumpc()
Definition: streambuf:144
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
static const _Iostate goodbit
Definition: xiosbase:87
Definition: iosfwd:627
static const _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:54
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& operator>> ( basic_istream< _Elem, _Traits > &  _Istr,
_Elem *  _Str 
)
inline
1008  { // extract NTBS
1009  _DEBUG_POINTER(_Str);
1010  typedef basic_istream<_Elem, _Traits> _Myis;
1011  typedef ctype<_Elem> _Ctype;
1012  ios_base::iostate _State = ios_base::goodbit;
1013  _Elem *_Str0 = _Str;
1014  const typename _Myis::sentry _Ok(_Istr);
1015 
1016  if (_Ok)
1017  { // state okay, extract characters
1018  const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
1019 
1021  streamsize _Count = 0 < _Istr.width() ? _Istr.width() : INT_MAX;
1022  typename _Myis::int_type _Meta = _Istr.rdbuf()->sgetc();
1023  _Elem _Ch;
1024  for (; 0 < --_Count; _Meta = _Istr.rdbuf()->snextc())
1025  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1026  { // end of file, quit
1027  _State |= ios_base::eofbit;
1028  break;
1029  }
1030  else if (_Ctype_fac.is(_Ctype::space,
1031  _Ch = _Traits::to_char_type(_Meta))
1032  || _Ch == _Elem())
1033  break; // whitespace or nul, quit
1034  else
1035  *_Str++ = _Traits::to_char_type(_Meta); // add it to string
1036  _CATCH_IO_(_Istr)
1037  }
1038 
1039  *_Str = _Elem(); // add terminating null character
1040  _Istr.width(0);
1041  _Istr.setstate(_Str == _Str0 ? _State | ios_base::failbit : _State);
1042  return (_Istr);
1043  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:150
_Longlong streamsize
Definition: iosfwd:22
static const _Iostate failbit
Definition: xiosbase:89
#define _CATCH_IO_(x)
Definition: ostream:32
#define _USE(loc, fac)
Definition: xlocale:555
#define _TRY_IO_BEGIN
Definition: ostream:30
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:422
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:86
Definition: xlocale:2113
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:162
streamsize __CLR_OR_THIS_CALL width() const
Definition: xiosbase:410
#define _DEBUG_POINTER(first)
Definition: xutility:465
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
space_info space(const _Path &_Pval)
Definition: filesystem:1778
static const _Iostate goodbit
Definition: xiosbase:87
_Diff _Count
Definition: algorithm:1941
Definition: iosfwd:627
#define INT_MAX
Definition: limits.h:40
static const _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:54
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
signed char *  _Str 
)
inline
1074  { // extract a signed char NTBS
1075  return (_Istr >> (char *)_Str);
1076  }
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
signed char &  _Ch 
)
inline
1081  { // extract a signed char
1082  return (_Istr >> (char&)_Ch);
1083  }
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
unsigned char *  _Str 
)
inline
1088  { // extract an unsigned char NTBS
1089  return (_Istr >> (char *)_Str);
1090  }
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
unsigned char &  _Ch 
)
inline
1095  { // extract an unsigned char
1096  return (_Istr >> (char&)_Ch);
1097  }
_In_ size_t _In_ unsigned int _Ch
Definition: mbstring.h:161
template<class _Elem , class _Traits , class _Ty >
basic_istream<_Elem, _Traits>& operator>> ( basic_istream< _Elem, _Traits > &&  _Istr,
_Ty &  _Val 
)
inline
1104  { // extract from rvalue stream
1105  return (_Istr >> _Val);
1106  }
_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
1113  { // consume whitespace
1114  typedef basic_istream<_Elem, _Traits> _Myis;
1115  typedef ctype<_Elem> _Ctype;
1116 
1117  if (!_Istr.eof())
1118  { // not at eof, okay to construct sentry and skip
1119  ios_base::iostate _State = ios_base::goodbit;
1120  const typename _Myis::sentry _Ok(_Istr, true);
1121 
1122  if (_Ok)
1123  { // state okay, extract characters
1124  const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
1125 
1127  for (typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
1128  _Meta = _Istr.rdbuf()->snextc())
1129  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1130  { // end of file, quit
1131  _State |= ios_base::eofbit;
1132  break;
1133  }
1134  else if (!_Ctype_fac.is(_Ctype::space,
1135  _Traits::to_char_type(_Meta)))
1136  break; // not whitespace, quit
1137  _CATCH_IO_(_Istr)
1138  }
1139 
1140  _Istr.setstate(_State);
1141  }
1142  return (_Istr);
1143  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:150
#define _CATCH_IO_(x)
Definition: ostream:32
bool __CLR_OR_THIS_CALL eof() const
Definition: xiosbase:333
#define _USE(loc, fac)
Definition: xlocale:555
#define _TRY_IO_BEGIN
Definition: ostream:30
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:422
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:86
Definition: xlocale:2113
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:162
space_info space(const _Path &_Pval)
Definition: filesystem:1778
static const _Iostate goodbit
Definition: xiosbase:87
Definition: iosfwd:627
static const _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:54
_CRTIMP2_PURE basic_istream<char, char_traits<char> >& __CLRCALL_OR_CDECL ws ( basic_istream< char, char_traits< char > > &  _Istr)
inline
1147  { // consume whitespace
1148  typedef char _Elem;
1149  typedef char_traits<_Elem> _Traits;
1150 
1151  if (!_Istr.eof())
1152  { // not at eof, okay to construct sentry and skip
1153  ios_base::iostate _State = ios_base::goodbit;
1154  const basic_istream<_Elem, _Traits>::sentry _Ok(_Istr, true);
1155 
1156  if (_Ok)
1157  { // state okay, use facet to extract
1158  const ctype<_Elem>& _Ctype_fac =
1159  _USE(_Istr.getloc(), ctype<_Elem>);
1160 
1162  for (_Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
1163  _Meta = _Istr.rdbuf()->snextc())
1164  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1165  { // end of file, quit
1166  _State |= ios_base::eofbit;
1167  break;
1168  }
1169  else if (!_Ctype_fac.is(ctype<_Elem>::space,
1170  _Traits::to_char_type(_Meta)))
1171  break; // not whitespace, quit
1172  _CATCH_IO_(_Istr)
1173  }
1174 
1175  _Istr.setstate(_State);
1176  }
1177  return (_Istr);
1178  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:150
#define _CATCH_IO_(x)
Definition: ostream:32
Definition: istream:111
bool __CLR_OR_THIS_CALL eof() const
Definition: xiosbase:333
bool __CLR_OR_THIS_CALL is(mask _Maskval, _Elem _Ch) const
Definition: xlocale:2119
#define _USE(loc, fac)
Definition: xlocale:555
#define _TRY_IO_BEGIN
Definition: ostream:30
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:422
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:86
Definition: xlocale:2113
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:162
Definition: iosfwd:260
static const _Iostate goodbit
Definition: xiosbase:87
static const _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:54
1182  { // consume whitespace
1183  typedef wchar_t _Elem;
1184  typedef char_traits<_Elem> _Traits;
1185 
1186  if (!_Istr.eof())
1187  { // not at eof, okay to construct sentry and skip
1188  ios_base::iostate _State = ios_base::goodbit;
1189  const basic_istream<_Elem, _Traits>::sentry _Ok(_Istr, true);
1190 
1191  if (_Ok)
1192  { // state okay, use facet to extract
1193  const ctype<_Elem>& _Ctype_fac =
1194  _USE(_Istr.getloc(), ctype<_Elem>);
1195 
1197  for (_Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
1198  _Meta = _Istr.rdbuf()->snextc())
1199  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1200  { // end of file, quit
1201  _State |= ios_base::eofbit;
1202  break;
1203  }
1204  else if (!_Ctype_fac.is(ctype<_Elem>::space,
1205  _Traits::to_char_type(_Meta)))
1206  break; // not whitespace, quit
1207  _CATCH_IO_(_Istr)
1208  }
1209 
1210  _Istr.setstate(_State);
1211  }
1212  return (_Istr);
1213  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:150
#define _CATCH_IO_(x)
Definition: ostream:32
Definition: istream:111
bool __CLR_OR_THIS_CALL eof() const
Definition: xiosbase:333
bool __CLR_OR_THIS_CALL is(mask _Maskval, _Elem _Ch) const
Definition: xlocale:2119
#define _USE(loc, fac)
Definition: xlocale:555
#define _TRY_IO_BEGIN
Definition: ostream:30
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:422
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:86
Definition: xlocale:2113
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:162
Definition: iosfwd:260
static const _Iostate goodbit
Definition: xiosbase:87
static const _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:54