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
1050  { // extract a character
1051  typedef basic_istream<_Elem, _Traits> _Myis;
1052 
1053  typename _Myis::int_type _Meta;
1054  ios_base::iostate _State = ios_base::goodbit;
1055  const typename _Myis::sentry _Ok(_Istr);
1056 
1057  if (_Ok)
1058  { // state okay, extract characters
1060  _Meta = _Istr.rdbuf()->sbumpc();
1061  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1062  _State |= ios_base::eofbit | ios_base::failbit; // end of file
1063  else
1064  _Ch = _Traits::to_char_type(_Meta); // got a character
1065  _CATCH_IO_(_Istr)
1066  }
1067 
1068  _Istr.setstate(_State);
1069  return (_Istr);
1070  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _CATCH_IO_(x)
Definition: ostream:32
#define _TRY_IO_BEGIN
Definition: ostream:30
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:90
int_type __CLR_OR_THIS_CALL sbumpc()
Definition: streambuf:148
static constexpr _Iostate goodbit
Definition: xiosbase:87
Definition: iosfwd:628
static constexpr _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:56
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()
1023  typename _Myis::int_type _Meta = _Istr.rdbuf()->sgetc();
1024  _Elem _Ch;
1025  for (; 0 < --_Count; _Meta = _Istr.rdbuf()->snextc())
1026  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1027  { // end of file, quit
1028  _State |= ios_base::eofbit;
1029  break;
1030  }
1031  else if (_Ctype_fac.is(_Ctype::space,
1032  _Ch = _Traits::to_char_type(_Meta))
1033  || _Ch == _Elem())
1034  break; // whitespace or nul, quit
1035  else
1036  *_Str++ = _Traits::to_char_type(_Meta); // add it to string
1037  _CATCH_IO_(_Istr)
1038  }
1039 
1040  *_Str = _Elem(); // add terminating null character
1041  _Istr.width(0);
1042  _Istr.setstate(_Str == _Str0 ? _State | ios_base::failbit : _State);
1043  return (_Istr);
1044  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:154
_Longlong streamsize
Definition: iosfwd:22
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _CATCH_IO_(x)
Definition: ostream:32
unsigned int _Count
Definition: xcomplex:668
#define _USE(loc, fac)
Definition: xlocale:547
#define _TRY_IO_BEGIN
Definition: ostream:30
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:90
Definition: xlocale:2115
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:166
streamsize __CLR_OR_THIS_CALL width() const
Definition: xiosbase:421
#define _DEBUG_POINTER(first)
Definition: xutility:819
static constexpr _Iostate goodbit
Definition: xiosbase:87
space_info space(const path &)
Definition: filesystem:3125
Definition: iosfwd:628
static constexpr _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:56
Definition: limits:101
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
signed char *  _Str 
)
inline
1075  { // extract a signed char NTBS
1076  return (_Istr >> (char *)_Str);
1077  }
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
signed char &  _Ch 
)
inline
1082  { // extract a signed char
1083  return (_Istr >> (char&)_Ch);
1084  }
_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
1089  { // extract an unsigned char NTBS
1090  return (_Istr >> (char *)_Str);
1091  }
template<class _Traits >
basic_istream<char, _Traits>& operator>> ( basic_istream< char, _Traits > &  _Istr,
unsigned char &  _Ch 
)
inline
1096  { // extract an unsigned char
1097  return (_Istr >> (char&)_Ch);
1098  }
_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
1105  { // extract from rvalue stream
1106  return (_Istr >> _Val);
1107  }
_In_ int _Val
Definition: vcruntime_string.h:62
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& __CLRCALL_OR_CDECL ws ( basic_istream< _Elem, _Traits > &  _Istr)
inline
1114  { // consume whitespace
1115  typedef basic_istream<_Elem, _Traits> _Myis;
1116  typedef ctype<_Elem> _Ctype;
1117 
1118  if (!_Istr.eof())
1119  { // not at eof, okay to construct sentry and skip
1120  ios_base::iostate _State = ios_base::goodbit;
1121  const typename _Myis::sentry _Ok(_Istr, true);
1122 
1123  if (_Ok)
1124  { // state okay, extract characters
1125  const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
1126 
1128  for (typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
1129  _Meta = _Istr.rdbuf()->snextc())
1130  if (_Traits::eq_int_type(_Traits::eof(), _Meta))
1131  { // end of file, quit
1132  _State |= ios_base::eofbit;
1133  break;
1134  }
1135  else if (!_Ctype_fac.is(_Ctype::space,
1136  _Traits::to_char_type(_Meta)))
1137  break; // not whitespace, quit
1138  _CATCH_IO_(_Istr)
1139  }
1140 
1141  _Istr.setstate(_State);
1142  }
1143  return (_Istr);
1144  }
int_type __CLR_OR_THIS_CALL sgetc()
Definition: streambuf:154
#define _CATCH_IO_(x)
Definition: ostream:32
bool __CLR_OR_THIS_CALL eof() const
Definition: xiosbase:342
#define _USE(loc, fac)
Definition: xlocale:547
#define _TRY_IO_BEGIN
Definition: ostream:30
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
_Mysb *__CLR_OR_THIS_CALL rdbuf() const
Definition: ios:90
Definition: xlocale:2115
int_type __CLR_OR_THIS_CALL snextc()
Definition: streambuf:166
static constexpr _Iostate goodbit
Definition: xiosbase:87
space_info space(const path &)
Definition: filesystem:3125
Definition: iosfwd:628
static constexpr _Iostate eofbit
Definition: xiosbase:88
void __CLR_OR_THIS_CALL setstate(iostate _State, bool _Reraise=false)
Definition: ios:56