LCOV - code coverage report
Current view: directory - cygdrive/c/program files/microsoft visual studio 9.0/vc/include - istream (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 9 9 100.0 %
Date: 2014-09-25 Functions: 0 0 -

       1                 : // istream standard header

       2                 : #pragma once
       3                 : #ifndef _ISTREAM_
       4                 : #define _ISTREAM_
       5                 : #ifndef RC_INVOKED
       6                 : #include <ostream>
       7                 : 
       8                 : #ifdef _MSC_VER
       9                 :  #pragma pack(push,_CRT_PACKING)
      10                 :  #pragma warning(push,3)
      11                 : #endif  /* _MSC_VER */
      12                 : 
      13                 : _STD_BEGIN
      14                 : 
      15                 :                 // TEMPLATE CLASS basic_istream
      16                 : template<class _Elem,
      17                 :         class _Traits>
      18                 :         class basic_istream
      19                 :                 : virtual public basic_ios<_Elem, _Traits>
      20                 :         {       // control extractions from a stream buffer
      21                 : public:
      22                 :         typedef basic_istream<_Elem, _Traits> _Myt;
      23                 :         typedef basic_ios<_Elem, _Traits> _Myios;
      24                 :         typedef basic_streambuf<_Elem, _Traits> _Mysb;
      25                 :         typedef istreambuf_iterator<_Elem, _Traits> _Iter;
      26                 :         typedef ctype<_Elem> _Ctype;
      27                 :         typedef num_get<_Elem, _Iter> _Nget;
      28                 : 
      29                 : 
      30                 :         explicit __CLR_OR_THIS_CALL basic_istream(_Mysb *_Strbuf, bool _Isstd = false)
      31                 :                 : _Chcount(0)
      32              10 :                 {       // construct from stream buffer pointer

      33              10 :                 _Myios::init(_Strbuf, _Isstd);

      34              10 :                 }

      35                 : 
      36                 :         __CLR_OR_THIS_CALL basic_istream(_Uninitialized)
      37                 :                 {       // construct uninitialized
      38                 :                 ios_base::_Addstd(this);
      39                 :                 }
      40                 : 
      41                 :         virtual __CLR_OR_THIS_CALL ~basic_istream()
      42              10 :                 {       // destroy the object

      43              10 :                 }

      44                 : 
      45                 :         typedef typename _Traits::int_type int_type;
      46                 :         typedef typename _Traits::pos_type pos_type;
      47                 :         typedef typename _Traits::off_type off_type;
      48                 : 
      49                 :                 // TEMPLATE CLASS sentry
      50                 :         class _Sentry_base
      51                 :                 {       // stores thread lock and reference to input stream
      52                 :         public:
      53                 :                 __CLR_OR_THIS_CALL _Sentry_base(_Myt& _Istr)
      54                 :                         : _Myistr(_Istr)
      55                 :                         {       // lock the stream buffer, if there
      56                 :                         if (_Myistr.rdbuf() != 0)
      57                 :                                 _Myistr.rdbuf()->_Lock();
      58                 :                         }
      59                 : 
      60                 :                 __CLR_OR_THIS_CALL ~_Sentry_base()
      61                 :                         {       // destroy after unlocking
      62                 :                         if (_Myistr.rdbuf() != 0)
      63                 :                                 _Myistr.rdbuf()->_Unlock();
      64                 :                         }
      65                 : 
      66                 :                 _Myt& _Myistr;      // the input stream, for _Unlock call at destruction
      67                 :                 };
      68                 : 
      69                 :         class sentry
      70                 :                 : public _Sentry_base
      71                 :                 {       // stores thread lock and result of _Ipfx call
      72                 :         public:
      73                 :                 explicit __CLR_OR_THIS_CALL sentry(_Myt& _Istr, bool _Noskip = false)
      74                 :                         : _Sentry_base(_Istr)
      75                 :                         {       // construct locking and calling _Ipfx
      76                 :                         _Ok = this->_Myistr._Ipfx(_Noskip);
      77                 :                         }
      78                 : 
      79                 :                 __CLR_OR_THIS_CALL operator bool() const
      80                 :                         {       // test if _Ipfx succeeded
      81                 :                         return (_Ok);
      82                 :                         }
      83                 : 
      84                 :         private:
      85                 :                 __CLR_OR_THIS_CALL sentry(const sentry&);   // not defined
      86                 :                 sentry& __CLR_OR_THIS_CALL operator=(const sentry&);    // not defined
      87                 : 
      88                 :                 bool _Ok;       // true if _Ipfx succeeded at construction
      89                 :                 };
      90                 : 
      91                 :         bool __CLR_OR_THIS_CALL _Ipfx(bool _Noskip = false)
      92                 :                 {       // test stream state and skip whitespace as needed
      93                 :                 if (ios_base::good())
      94                 :                         {       // state okay, flush tied stream and skip whitespace
      95                 :                         if (_Myios::tie() != 0)
      96                 :                                 _Myios::tie()->flush();
      97                 : 
      98                 :                         if (!_Noskip && ios_base::flags() & ios_base::skipws)
      99                 :                                 {       // skip whitespace
     100                 :                                 const _Ctype& _Ctype_fac = _USE(ios_base::getloc(), _Ctype);
     101                 : 
     102                 :                                 _TRY_IO_BEGIN
     103                 :                                 int_type _Meta = _Myios::rdbuf()->sgetc();
     104                 : 
     105                 :                                 for (; ; _Meta = _Myios::rdbuf()->snextc())
     106                 :                                         if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     107                 :                                                 {       // end of file, quit
     108                 :                                                 _Myios::setstate(ios_base::eofbit);
     109                 :                                                 break;
     110                 :                                                 }
     111                 :                                         else if (!_Ctype_fac.is(_Ctype::space,
     112                 :                                                 _Traits::to_char_type(_Meta)))
     113                 :                                                 break;  // not whitespace, quit
     114                 :                                 _CATCH_IO_END
     115                 :                                 }
     116                 : 
     117                 :                         if (ios_base::good())
     118                 :                                 return (true);
     119                 :                         }
     120                 :                 _Myios::setstate(ios_base::failbit);
     121                 :                 return (false);
     122                 :                 }
     123                 : 
     124                 :         bool __CLR_OR_THIS_CALL ipfx(bool _Noskip = false)
     125                 :                 {       // test stream state and skip whitespace as needed (retained)
     126                 :                 return _Ipfx(_Noskip);
     127                 :                 }
     128                 : 
     129                 :         void __CLR_OR_THIS_CALL isfx()
     130                 :                 {       // perform any wrapup (retained)
     131                 :                 }
     132                 : 
     133                 : #ifdef _M_CEE_PURE
     134                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_Myt& (__clrcall *_Pfn)(_Myt&))
     135                 :                 {       // call basic_istream manipulator
     136                 :                 _DEBUG_POINTER(_Pfn);
     137                 :                 return ((*_Pfn)(*this));
     138                 :                 }
     139                 : 
     140                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_Myios& (__clrcall *_Pfn)(_Myios&))
     141                 :                 {       // call basic_ios manipulator
     142                 :                 _DEBUG_POINTER(_Pfn);
     143                 :                 (*_Pfn)(*(_Myios *)this);
     144                 :                 return (*this);
     145                 :                 }
     146                 : 
     147                 :         _Myt& __CLR_OR_THIS_CALL operator>>(ios_base& (__clrcall *_Pfn)(ios_base&))
     148                 :                 {       // call ios_base manipulator
     149                 :                 _DEBUG_POINTER(_Pfn);
     150                 :                 (*_Pfn)(*(ios_base *)this);
     151                 :                 return (*this);
     152                 :                 }
     153                 : #endif
     154                 : 
     155                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_Myt& (__cdecl *_Pfn)(_Myt&))
     156                 :                 {       // call basic_istream manipulator
     157                 :                 _DEBUG_POINTER(_Pfn);
     158                 :                 return ((*_Pfn)(*this));
     159                 :                 }
     160                 : 
     161                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_Myios& (__cdecl *_Pfn)(_Myios&))
     162                 :                 {       // call basic_ios manipulator
     163                 :                 _DEBUG_POINTER(_Pfn);
     164                 :                 (*_Pfn)(*(_Myios *)this);
     165                 :                 return (*this);
     166                 :                 }
     167                 : 
     168                 :         _Myt& __CLR_OR_THIS_CALL operator>>(ios_base& (__cdecl *_Pfn)(ios_base&))
     169                 :                 {       // call ios_base manipulator
     170                 :                 _DEBUG_POINTER(_Pfn);
     171                 :                 (*_Pfn)(*(ios_base *)this);
     172                 :                 return (*this);
     173                 :                 }
     174                 : 
     175                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_Bool& _Val)
     176                 :                 {       // extract a boolean
     177                 :                 ios_base::iostate _State = ios_base::goodbit;
     178                 :                 const sentry _Ok(*this);
     179                 : 
     180                 :                 if (_Ok)
     181                 :                         {       // state okay, use facet to extract
     182                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     183                 : 
     184                 :                         _TRY_IO_BEGIN
     185                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     186                 :                                 *this, _State, _Val);
     187                 :                         _CATCH_IO_END
     188                 :                         }
     189                 : 
     190                 :                 _Myios::setstate(_State);
     191                 :                 return (*this);
     192                 :                 }
     193                 : 
     194                 :         _Myt& __CLR_OR_THIS_CALL operator>>(short& _Val)
     195                 :                 {       // extract a short
     196                 :                 ios_base::iostate _State = ios_base::goodbit;
     197                 :                 const sentry _Ok(*this);
     198                 : 
     199                 :                 if (_Ok)
     200                 :                         {       // state okay, use facet to extract
     201                 :                         long _Tmp = 0;
     202                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     203                 : 
     204                 :                         _TRY_IO_BEGIN
     205                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     206                 :                                 *this, _State, _Tmp);
     207                 :                         _CATCH_IO_END
     208                 : 
     209                 :                         if (_State & ios_base::failbit
     210                 :                                 || _Tmp < SHRT_MIN || SHRT_MAX < _Tmp)
     211                 :                                 _State |= ios_base::failbit;
     212                 :                         else
     213                 :                                 _Val = (short)_Tmp;
     214                 :                         }
     215                 : 
     216                 :                 _Myios::setstate(_State);
     217                 :                 return (*this);
     218                 :                 }
     219                 : 
     220                 :         /*  Note that if your stream is wchar_t, and you are not using native wchar_t
     221                 :             Then this operation will be unavailable as there is an explicit 
     222                 :             specialisation further down this file that is designed to treat an 
     223                 :             unsigned short as a character.
     224                 : 
     225                 :             If you wish to read or write unsigned shorts to wchar_t streams, you should 
     226                 :             consider making wchar_t a native type by turning on /Zc:wchar_t
     227                 :         */
     228                 :         _Myt& __CLR_OR_THIS_CALL operator>>(unsigned short& _Val)
     229                 :                 {       // extract an unsigned short
     230                 :                 ios_base::iostate _State = ios_base::goodbit;
     231                 :                 const sentry _Ok(*this);
     232                 : 
     233                 :                 if (_Ok)
     234                 :                         {       // state okay, use facet to extract
     235                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     236                 : 
     237                 :                         _TRY_IO_BEGIN
     238                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     239                 :                                 *this, _State, _Val);
     240                 :                         _CATCH_IO_END
     241                 :                         }
     242                 : 
     243                 :                 _Myios::setstate(_State);
     244                 :                 return (*this);
     245                 :                 }
     246                 : 
     247                 :         _Myt& __CLR_OR_THIS_CALL operator>>(int& _Val)
     248                 :                 {       // extract an int
     249                 :                 ios_base::iostate _State = ios_base::goodbit;
     250                 :                 const sentry _Ok(*this);
     251                 : 
     252                 :                 if (_Ok)
     253                 :                         {       // state okay, use facet to extract
     254                 :                         long _Tmp = 0;
     255                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     256                 : 
     257                 :                         _TRY_IO_BEGIN
     258                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     259                 :                                 *this, _State, _Tmp);
     260                 :                         _CATCH_IO_END
     261                 : 
     262                 :                         if (_State & ios_base::failbit
     263                 :                                 || _Tmp < INT_MIN || INT_MAX < _Tmp)
     264                 :                                 _State |= ios_base::failbit;
     265                 :                         else
     266                 :                                 _Val = _Tmp;
     267                 :                         }
     268                 : 
     269                 :                 _Myios::setstate(_State);
     270                 :                 return (*this);
     271                 :                 }
     272                 : 
     273                 :         _Myt& __CLR_OR_THIS_CALL operator>>(unsigned int& _Val)
     274                 :                 {       // extract an unsigned int
     275                 :                 ios_base::iostate _State = ios_base::goodbit;
     276                 :                 const sentry _Ok(*this);
     277                 :                 if (_Ok)
     278                 :                         {       // state okay, use facet to extract
     279                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     280                 : 
     281                 :                         _TRY_IO_BEGIN
     282                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     283                 :                                 *this, _State, _Val);
     284                 :                         _CATCH_IO_END
     285                 :                         }
     286                 : 
     287                 :                 _Myios::setstate(_State);
     288                 :                 return (*this);
     289                 :                 }
     290                 : 
     291                 :         _Myt& __CLR_OR_THIS_CALL operator>>(long& _Val)
     292                 :                 {       // extract a long
     293                 :                 ios_base::iostate _State = ios_base::goodbit;
     294                 :                 const sentry _Ok(*this);
     295                 : 
     296                 :                 if (_Ok)
     297                 :                         {       // state okay, use facet to extract
     298                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     299                 :                         _TRY_IO_BEGIN
     300                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     301                 :                                 *this, _State, _Val);
     302                 :                         _CATCH_IO_END
     303                 :                         }
     304                 : 
     305                 :                 _Myios::setstate(_State);
     306                 :                 return (*this);
     307                 :                 }
     308                 : 
     309                 :         _Myt& __CLR_OR_THIS_CALL operator>>(unsigned long __w64& _Val)
     310                 :                 {       // extract an unsigned long
     311                 :                 ios_base::iostate _State = ios_base::goodbit;
     312                 :                 const sentry _Ok(*this);
     313                 : 
     314                 :                 if (_Ok)
     315                 :                         {       // state okay, use facet to extract
     316                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     317                 : 
     318                 :                         _TRY_IO_BEGIN
     319                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     320                 :                                 *this, _State, _Val);
     321                 :                         _CATCH_IO_END
     322                 :                         }
     323                 : 
     324                 :                 _Myios::setstate(_State);
     325                 :                 return (*this);
     326                 :                 }
     327                 : 
     328                 :  #ifdef _LONGLONG
     329                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_LONGLONG& _Val)
     330                 :                 {       // extract a long long
     331                 :                 ios_base::iostate _State = ios_base::goodbit;
     332                 :                 const sentry _Ok(*this);
     333                 : 
     334                 :                 if (_Ok)
     335                 :                         {       // state okay, use facet to extract
     336                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     337                 : 
     338                 :                         _TRY_IO_BEGIN
     339                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     340                 :                                 *this, _State, _Val);
     341                 :                         _CATCH_IO_END
     342                 :                         }
     343                 : 
     344                 :                 _Myios::setstate(_State);
     345                 :                 return (*this);
     346                 :                 }
     347                 : 
     348                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_ULONGLONG& _Val)
     349                 :                 {       // extract an  unsigned long long
     350                 :                 ios_base::iostate _State = ios_base::goodbit;
     351                 :                 const sentry _Ok(*this);
     352                 :                 if (_Ok)
     353                 :                         {       // state okay, use facet to extract
     354                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     355                 : 
     356                 :                         _TRY_IO_BEGIN
     357                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     358                 :                                 *this, _State, _Val);
     359                 :                         _CATCH_IO_END
     360                 :                         }
     361                 : 
     362                 :                 _Myios::setstate(_State);
     363                 :                 return (*this);
     364                 :                 }
     365                 :  #endif /* _LONGLONG */
     366                 : 
     367                 :         _Myt& __CLR_OR_THIS_CALL operator>>(float& _Val)
     368                 :                 {       // extract a float
     369                 :                 ios_base::iostate _State = ios_base::goodbit;
     370                 :                 const sentry _Ok(*this);
     371                 : 
     372                 :                 if (_Ok)
     373                 :                         {       // state okay, use facet to extract
     374                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     375                 : 
     376                 :                         _TRY_IO_BEGIN
     377                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     378                 :                                 *this, _State, _Val);
     379                 :                         _CATCH_IO_END
     380                 :                         }
     381                 : 
     382                 :                 _Myios::setstate(_State);
     383                 :                 return (*this);
     384                 :                 }
     385                 : 
     386                 :         _Myt& __CLR_OR_THIS_CALL operator>>(double& _Val)
     387                 :                 {       // extract a double
     388                 :                 ios_base::iostate _State = ios_base::goodbit;
     389                 :                 const sentry _Ok(*this);
     390                 :                 if (_Ok)
     391                 :                         {       // state okay, use facet to extract
     392                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     393                 : 
     394                 :                         _TRY_IO_BEGIN
     395                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     396                 :                                 *this, _State, _Val);
     397                 :                         _CATCH_IO_END
     398                 :                         }
     399                 : 
     400                 :                 _Myios::setstate(_State);
     401                 :                 return (*this);
     402                 :                 }
     403                 : 
     404                 :         _Myt& __CLR_OR_THIS_CALL operator>>(long double& _Val)
     405                 :                 {       // extract a long double
     406                 :                 ios_base::iostate _State = ios_base::goodbit;
     407                 :                 const sentry _Ok(*this);
     408                 : 
     409                 :                 if (_Ok)
     410                 :                         {       // state okay, use facet to extract
     411                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     412                 :                         _TRY_IO_BEGIN
     413                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     414                 :                                 *this, _State, _Val);
     415                 :                         _CATCH_IO_END
     416                 :                         }
     417                 : 
     418                 :                 _Myios::setstate(_State);
     419                 :                 return (*this);
     420                 :                 }
     421                 : 
     422                 :         _Myt& __CLR_OR_THIS_CALL operator>>(void *& _Val)
     423                 :                 {       // extract a void pointer
     424                 :                 ios_base::iostate _State = ios_base::goodbit;
     425                 :                 const sentry _Ok(*this);
     426                 : 
     427                 :                 if (_Ok)
     428                 :                         {       // state okay, use facet to extract
     429                 :                         const _Nget& _Nget_fac = _USE(ios_base::getloc(), _Nget);
     430                 : 
     431                 :                         _TRY_IO_BEGIN
     432                 :                         _Nget_fac.get(_Iter(_Myios::rdbuf()), _Iter(0),
     433                 :                                 *this, _State, _Val);
     434                 :                         _CATCH_IO_END
     435                 :                         }
     436                 : 
     437                 :                 _Myios::setstate(_State);
     438                 :                 return (*this);
     439                 :                 }
     440                 : 
     441                 :         _Myt& __CLR_OR_THIS_CALL operator>>(_Mysb *_Strbuf)
     442                 :                 {       // extract until end-of-file into a stream buffer
     443                 :                 ios_base::iostate _State = ios_base::goodbit;
     444                 :                 bool _Copied = false;
     445                 :                 const sentry _Ok(*this);
     446                 : 
     447                 :                 if (_Ok && _Strbuf != 0)
     448                 :                         {       // state okay, extract characters
     449                 :                         _TRY_IO_BEGIN
     450                 :                         int_type _Meta = _Myios::rdbuf()->sgetc();
     451                 : 
     452                 :                         for (; ; _Meta = _Myios::rdbuf()->snextc())
     453                 :                                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     454                 :                                         {       // end of file, quit
     455                 :                                         _State |= ios_base::eofbit;
     456                 :                                         break;
     457                 :                                         }
     458                 :                                 else
     459                 :                                         {       // got a character, insert it into buffer
     460                 :                                         _TRY_BEGIN
     461                 :                                                 if (_Traits::eq_int_type(_Traits::eof(),
     462                 :                                                         _Strbuf->sputc(_Traits::to_char_type(_Meta))))
     463                 :                                                         break;
     464                 :                                         _CATCH_ALL
     465                 :                                                 break;
     466                 :                                         _CATCH_END
     467                 :                                         _Copied = true;
     468                 :                                         }
     469                 :                         _CATCH_IO_END
     470                 :                         }
     471                 : 
     472                 :                 _Myios::setstate(!_Copied ? _State | ios_base::failbit : _State);
     473                 :                 return (*this);
     474                 :                 }
     475                 : 
     476                 :         int_type __CLR_OR_THIS_CALL get()
     477                 :                 {       // extract a metacharacter
     478                 :                 int_type _Meta = 0;
     479                 :                 ios_base::iostate _State = ios_base::goodbit;
     480                 :                 _Chcount = 0;
     481                 :                 const sentry _Ok(*this, true);
     482                 : 
     483                 :                 if (!_Ok)
     484                 :                         _Meta = _Traits::eof(); // state not okay, return EOF
     485                 :                 else
     486                 :                         {       // state okay, extract a character
     487                 :                         _TRY_IO_BEGIN
     488                 :                         _Meta = _Myios::rdbuf()->sbumpc();
     489                 : 
     490                 :                         if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     491                 :                                 _State |= ios_base::eofbit | ios_base::failbit; // end of file
     492                 :                         else
     493                 :                                 ++_Chcount;     // got a character, count it
     494                 :                         _CATCH_IO_END
     495                 :                         }
     496                 : 
     497                 :                 _Myios::setstate(_State);
     498                 :                 return (_Meta);
     499                 :                 }
     500                 : 
     501                 :         _Myt& __CLR_OR_THIS_CALL get(_Elem *_Str, streamsize _Count)
     502                 :                 {       // get up to _Count characters into NTCS
     503                 :                 return (get(_Str, _Count, _Myios::widen('\n')));
     504                 :                 }
     505                 : 
     506                 :         _Myt& __CLR_OR_THIS_CALL get(_Elem *_Str,
     507                 :                 streamsize _Count, _Elem _Delim)
     508                 :                 {       // get up to _Count characters into NTCS, stop before _Delim
     509                 :                 _DEBUG_POINTER(_Str);
     510                 :                 ios_base::iostate _State = ios_base::goodbit;
     511                 :                 _Chcount = 0;
     512                 :                 const sentry _Ok(*this, true);
     513                 : 
     514                 :                 if (_Ok && 0 < _Count)
     515                 :                         {       // state okay, extract characters
     516                 :                         _TRY_IO_BEGIN
     517                 :                         int_type _Meta = _Myios::rdbuf()->sgetc();
     518                 : 
     519                 :                         for (; 0 < --_Count; _Meta = _Myios::rdbuf()->snextc())
     520                 :                                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     521                 :                                         {       // end of file, quit
     522                 :                                         _State |= ios_base::eofbit;
     523                 :                                         break;
     524                 :                                         }
     525                 :                                 else if (_Traits::to_char_type(_Meta) == _Delim)
     526                 :                                         break;  // got a delimiter, quit
     527                 :                                 else
     528                 :                                         {       // got a character, add it to string
     529                 :                                         *_Str++ = _Traits::to_char_type(_Meta);
     530                 :                                         ++_Chcount;
     531                 :                                         }
     532                 :                         _CATCH_IO_END
     533                 :                         }
     534                 : 
     535                 :                 _Myios::setstate(_Chcount == 0
     536                 :                         ? _State | ios_base::failbit : _State);
     537                 :                 *_Str = _Elem();        // add terminating null character
     538                 :                 return (*this);
     539                 :                 }
     540                 : 
     541                 :         _Myt& __CLR_OR_THIS_CALL get(_Elem& _Ch)
     542                 :                 {       // get a character
     543                 :                 int_type _Meta = get();
     544                 :                 if (!_Traits::eq_int_type(_Traits::eof(), _Meta))
     545                 :                         _Ch = _Traits::to_char_type(_Meta);
     546                 :                 return (*this);
     547                 :                 }
     548                 : 
     549                 :         _Myt& __CLR_OR_THIS_CALL get(_Mysb& _Strbuf)
     550                 :                 {       // extract up to newline and insert into stream buffer
     551                 :                 return (get(_Strbuf, _Myios::widen('\n')));
     552                 :                 }
     553                 : 
     554                 :         _Myt& __CLR_OR_THIS_CALL get(_Mysb& _Strbuf, _Elem _Delim)
     555                 :                 {       // extract up to delimiter and insert into stream buffer
     556                 :                 ios_base::iostate _State = ios_base::goodbit;
     557                 :                 _Chcount = 0;
     558                 :                 const sentry _Ok(*this, true);
     559                 : 
     560                 :                 if (_Ok)
     561                 :                         {       // state okay, use facet to extract
     562                 :                         _TRY_IO_BEGIN
     563                 :                         int_type _Meta = _Myios::rdbuf()->sgetc();
     564                 : 
     565                 :                         for (; ; _Meta = _Myios::rdbuf()->snextc())
     566                 :                                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     567                 :                                         {       // end of file, quit
     568                 :                                         _State |= ios_base::eofbit;
     569                 :                                         break;
     570                 :                                         }
     571                 :                                 else
     572                 :                                         {       // got a character, insert it into stream buffer
     573                 :                                         _TRY_BEGIN
     574                 :                                                 _Elem _Ch = _Traits::to_char_type(_Meta);
     575                 :                                                 if (_Ch == _Delim
     576                 :                                                         || _Traits::eq_int_type(_Traits::eof(),
     577                 :                                                                 _Strbuf.sputc(_Ch)))
     578                 :                                                         break;
     579                 :                                         _CATCH_ALL
     580                 :                                                 break;
     581                 :                                         _CATCH_END
     582                 :                                         ++_Chcount;
     583                 :                                         }
     584                 :                         _CATCH_IO_END
     585                 :                         }
     586                 : 
     587                 :                 if (_Chcount == 0)
     588                 :                         _State |= ios_base::failbit;
     589                 :                 _Myios::setstate(_State);
     590                 :                 return (*this);
     591                 :                 }
     592                 : 
     593                 :         _Myt& __CLR_OR_THIS_CALL getline(_Elem *_Str, streamsize _Count)
     594                 :                 {       // get up to _Count characters into NTCS, discard newline
     595                 :                 return (getline(_Str, _Count, _Myios::widen('\n')));
     596                 :                 }
     597                 : 
     598                 :         _Myt& __CLR_OR_THIS_CALL getline(_Elem *_Str,
     599                 :                 streamsize _Count, _Elem _Delim)
     600                 :                 {       // get up to _Count characters into NTCS, discard _Delim
     601                 :                 _DEBUG_POINTER(_Str);
     602                 :                 ios_base::iostate _State = ios_base::goodbit;
     603                 :                 _Chcount = 0;
     604                 :                 const sentry _Ok(*this, true);
     605                 : 
     606                 :                 if (_Ok && 0 < _Count)
     607                 :                         {       // state okay, use facet to extract
     608                 :                         int_type _Metadelim = _Traits::to_int_type(_Delim);
     609                 : 
     610                 :                         _TRY_IO_BEGIN
     611                 :                         int_type _Meta = _Myios::rdbuf()->sgetc();
     612                 : 
     613                 :                         for (; ; _Meta = _Myios::rdbuf()->snextc())
     614                 :                                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     615                 :                                         {       // end of file, quit
     616                 :                                         _State |= ios_base::eofbit;
     617                 :                                         break;
     618                 :                                         }
     619                 :                                 else if (_Meta == _Metadelim)
     620                 :                                         {       // got a delimiter, discard it and quit
     621                 :                                         ++_Chcount;
     622                 :                                         _Myios::rdbuf()->sbumpc();
     623                 :                                         break;
     624                 :                                         }
     625                 :                                 else if (--_Count <= 0)
     626                 :                                         {       // buffer full, quit
     627                 :                                         _State |= ios_base::failbit;
     628                 :                                         break;
     629                 :                                         }
     630                 :                                 else
     631                 :                                         {       // got a character, add it to string
     632                 :                                         ++_Chcount;
     633                 :                                         *_Str++ = _Traits::to_char_type(_Meta);
     634                 :                                         }
     635                 :                         _CATCH_IO_END
     636                 :                         }
     637                 : 
     638                 :                 *_Str = _Elem();        // add terminating null character
     639                 :                 _Myios::setstate(_Chcount == 0 ? _State | ios_base::failbit : _State);
     640                 :                 return (*this);
     641                 :                 }
     642                 : 
     643                 :         _Myt& __CLR_OR_THIS_CALL ignore(streamsize _Count = 1,
     644                 :                 int_type _Metadelim = _Traits::eof())
     645                 :                 {       // ignore up to _Count characters, discarding delimiter
     646                 :                 ios_base::iostate _State = ios_base::goodbit;
     647                 :                 _Chcount = 0;
     648                 :                 const sentry _Ok(*this, true);
     649                 : 
     650                 :                 if (_Ok && 0 < _Count)
     651                 :                         {       // state okay, use facet to extract
     652                 :                         _TRY_IO_BEGIN
     653                 :                         for (; ; )
     654                 :                                 {       // get a metacharacter if more room in buffer
     655                 :                                 int_type _Meta;
     656                 :                                 if (_Count != INT_MAX && --_Count < 0)
     657                 :                                         break;  // buffer full, quit
     658                 :                                 else if (_Traits::eq_int_type(_Traits::eof(),
     659                 :                                         _Meta = _Myios::rdbuf()->sbumpc()))
     660                 :                                         {       // end of file, quit
     661                 :                                         _State |= ios_base::eofbit;
     662                 :                                         break;
     663                 :                                         }
     664                 :                                 else
     665                 :                                         {       // got a character, count it
     666                 :                                         ++_Chcount;
     667                 :                                         if (_Meta == _Metadelim)
     668                 :                                                 break;  // got a delimiter, quit
     669                 :                                         }
     670                 :                                 }
     671                 :                         _CATCH_IO_END
     672                 :                         }
     673                 : 
     674                 :                 _Myios::setstate(_State);
     675                 :                 return (*this);
     676                 :                 }
     677                 : 
     678                 :         _Myt& __CLR_OR_THIS_CALL _Read_s(_Elem *_Str, size_t _Str_size, streamsize _Count)
     679                 :                 {       // read up to _Count characters into buffer
     680                 :                 _DEBUG_POINTER(_Str);
     681                 :                 ios_base::iostate _State = ios_base::goodbit;
     682                 :                 _Chcount = 0;
     683                 :                 const sentry _Ok(*this, true);
     684                 : 
     685                 :                 if (_Ok)
     686                 :                         {       // state okay, use facet to extract
     687                 :                         _TRY_IO_BEGIN
     688                 :                         const streamsize _Num = _Myios::rdbuf()->_Sgetn_s(_Str, _Str_size, _Count);
     689                 :                         _Chcount += _Num;
     690                 :                         if (_Num != _Count)
     691                 :                                 _State |= ios_base::eofbit | ios_base::failbit; // short read
     692                 :                         _CATCH_IO_END
     693                 :                         }
     694                 : 
     695                 :                 _Myios::setstate(_State);
     696                 :                 return (*this);
     697                 :                 }
     698                 : 
     699                 :         _Myt& __CLR_OR_THIS_CALL read(_Elem *_Str, streamsize _Count)
     700                 :                 {
     701                 :                 return _Read_s(_Str, (size_t)-1, _Count);
     702                 :                 }
     703                 : 
     704                 :         streamsize __CLR_OR_THIS_CALL _Readsome_s(_Elem *_Str, size_t _Str_size, streamsize _Count)
     705                 :                 {       // read up to _Count characters into buffer, without blocking
     706                 :                 _DEBUG_POINTER(_Str);
     707                 :                 ios_base::iostate _State = ios_base::goodbit;
     708                 :                 _Chcount = 0;
     709                 :                 const sentry _Ok(*this, true);
     710                 :                 streamsize _Num;
     711                 : 
     712                 :                 if (!_Ok)
     713                 :                         _State |= ios_base::failbit;    // no buffer, fail
     714                 :                 else if ((_Num = _Myios::rdbuf()->in_avail()) < 0)
     715                 :                         _State |= ios_base::eofbit;     // no characters available
     716                 :                 else if (0 < _Num)
     717                 :                         _Read_s(_Str, _Str_size, _Num < _Count ? _Num : _Count);     // read available
     718                 : 
     719                 :                 _Myios::setstate(_State);
     720                 :                 return (gcount());
     721                 :                 }
     722                 : 
     723                 :         _SCL_INSECURE_DEPRECATE
     724                 :         streamsize __CLR_OR_THIS_CALL readsome(_Elem *_Str, streamsize _Count)
     725                 :                 {
     726                 :                 return _Readsome_s(_Str, (size_t)-1, _Count);
     727                 :                 }
     728                 : 
     729                 :         int_type __CLR_OR_THIS_CALL peek()
     730                 :                 {       // return next character, unconsumed
     731                 :                 ios_base::iostate _State = ios_base::goodbit;
     732                 :                 _Chcount = 0;
     733                 :                 int_type _Meta = 0;
     734                 :                 const sentry _Ok(*this, true);
     735                 : 
     736                 :                 if (!_Ok)
     737                 :                         _Meta = _Traits::eof(); // state not okay, return EOF
     738                 :                 else
     739                 :                         {       // state okay, read a character
     740                 :                         _TRY_IO_BEGIN
     741                 :                         if (_Traits::eq_int_type(_Traits::eof(),
     742                 :                                 _Meta = _Myios::rdbuf()->sgetc()))
     743                 :                                 _State |= ios_base::eofbit;
     744                 :                         _CATCH_IO_END
     745                 :                         }
     746                 : 
     747                 :                 _Myios::setstate(_State);
     748                 :                 return (_Meta);
     749                 :                 }
     750                 : 
     751                 :         _Myt& __CLR_OR_THIS_CALL putback(_Elem _Ch)
     752                 :                 {       // put back a character
     753                 :                 ios_base::iostate _State = ios_base::goodbit;
     754                 :                 _Chcount = 0;
     755                 :                 const sentry _Ok(*this, true);
     756                 : 
     757                 :                 if (_Ok)
     758                 :                         {       // state okay, put character back
     759                 :                         _TRY_IO_BEGIN
     760                 :                         if (_Traits::eq_int_type(_Traits::eof(),
     761                 :                                 _Myios::rdbuf()->sputbackc(_Ch)))
     762                 :                                 _State |= ios_base::badbit;
     763                 :                         _CATCH_IO_END
     764                 :                         }
     765                 : 
     766                 :                 _Myios::setstate(_State);
     767                 :                 return (*this);
     768                 :                 }
     769                 : 
     770                 :         _Myt& __CLR_OR_THIS_CALL unget()
     771                 :                 {       // put back last read character
     772                 :                 ios_base::iostate _State = ios_base::goodbit;
     773                 :                 _Chcount = 0;
     774                 :                 const sentry _Ok(*this, true);
     775                 : 
     776                 :                 if (_Ok)
     777                 :                         {       // state okay, use facet to extract
     778                 :                         _TRY_IO_BEGIN
     779                 :                         if (_Traits::eq_int_type(_Traits::eof(),
     780                 :                                 _Myios::rdbuf()->sungetc()))
     781                 :                                 _State |= ios_base::badbit;
     782                 :                         _CATCH_IO_END
     783                 :                         }
     784                 : 
     785                 :                 _Myios::setstate(_State);
     786                 :                 return (*this);
     787                 :                 }
     788                 : 
     789                 :         streamsize __CLR_OR_THIS_CALL gcount() const
     790                 :                 {       // get count from last extraction
     791                 :                 return (_Chcount);
     792                 :                 }
     793                 : 
     794                 :         int __CLR_OR_THIS_CALL sync()
     795                 :                 {       // synchronize with input source
     796                 :                 ios_base::iostate _State = ios_base::goodbit;
     797                 :                 int _Ans;
     798                 : 
     799                 :                 if (_Myios::rdbuf() == 0)
     800                 :                         _Ans = -1;      // no buffer, fail
     801                 :                 else if (_Myios::rdbuf()->pubsync() == -1)
     802                 :                         {       // stream buffer sync failed, fail
     803                 :                         _State |= ios_base::badbit;
     804                 :                         _Ans = -1;
     805                 :                         }
     806                 :                 else
     807                 :                         _Ans = 0;       // success
     808                 : 
     809                 :                 _Myios::setstate(_State);
     810                 :                 return (_Ans);
     811                 :                 }
     812                 : 
     813                 :         _Myt& __CLR_OR_THIS_CALL seekg(pos_type _Pos)
     814                 :                 {       // set input stream position to _Pos
     815                 :                 if (!ios_base::fail()
     816                 :                         && (off_type)_Myios::rdbuf()->pubseekpos(_Pos,
     817                 :                                 ios_base::in) == _BADOFF)
     818                 :                         _Myios::setstate(ios_base::failbit);
     819                 :                 else
     820                 :                         _Myios::clear();        // clear eofbit if set
     821                 :                 return (*this);
     822                 :                 }
     823                 : 
     824                 :         _Myt& __CLR_OR_THIS_CALL seekg(off_type _Off, ios_base::seekdir _Way)
     825                 :                 {       // change input stream position by _Off, according to _Way
     826                 :                 if (!ios_base::fail()
     827                 :                         && (off_type)_Myios::rdbuf()->pubseekoff(_Off, _Way,
     828                 :                                 ios_base::in) == _BADOFF)
     829                 :                         _Myios::setstate(ios_base::failbit);
     830                 :                 else
     831                 :                         _Myios::clear();        // clear eofbit if set
     832                 :                 return (*this);
     833                 :                 }
     834                 : 
     835                 :         pos_type __CLR_OR_THIS_CALL tellg()
     836                 :                 {       // return input stream position
     837                 :                 if (!ios_base::fail())
     838                 :                         return (_Myios::rdbuf()->pubseekoff(0,
     839                 :                                 ios_base::cur, ios_base::in));
     840                 :                 else
     841                 :                         return (pos_type(_BADOFF));
     842                 :                 }
     843                 : 
     844                 : private:
     845                 :         streamsize _Chcount;    // the character count
     846                 :         };
     847                 : 
     848                 : #ifndef _NATIVE_WCHAR_T_DEFINED
     849                 : /*
     850                 : This explicit template specialisation reads a single unicode character from the stream.
     851                 : 
     852                 : By default, the compiler treats wchar_t as if it were a typedef for unsigned short. This means
     853                 : that we cannot distinguish between an unsigned short and a wchar_t in the library. To be most
     854                 : consistent with previous practice, we add this explicit specialisation to ensure that a single
     855                 : unsigned short is read and written as a character.
     856                 : 
     857                 : If you wish to read and write unsigned shorts as integers, we recommend you consider making
     858                 : wchar_t a native type by using the /Zc:wchar_t compiler switch.
     859                 : */
     860                 : template <> inline
     861                 :         basic_istream<unsigned short, char_traits<unsigned short> >&__CLR_OR_THIS_CALL  
     862                 :         basic_istream<unsigned short, char_traits<unsigned short> >::operator>>(
     863                 :                 unsigned short& _Ch)
     864                 :         {       // extract a character    
     865                 :         typedef basic_istream<unsigned short, char_traits<unsigned short> > _Myis;
     866                 :         typedef char_traits<unsigned short> _Traits;
     867                 :         _Myis::int_type _Meta;
     868                 :         _Myis &_Istr=*this;
     869                 :         ios_base::iostate _State = ios_base::goodbit;
     870                 :         const _Myis::sentry _Ok(_Istr);
     871                 : 
     872                 :         if (_Ok)
     873                 :                 {       // state okay, extract characters
     874                 :                 _TRY_IO_BEGIN
     875                 :                 _Meta = _Istr.rdbuf()->sbumpc();
     876                 :                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     877                 :                         _State |= ios_base::eofbit | ios_base::failbit; // end of file
     878                 :                 else
     879                 :                         _Ch = _Traits::to_char_type(_Meta);     // got a character
     880                 :                 _CATCH_IO_(_Istr)
     881                 :                 }
     882                 : 
     883                 :         _Istr.setstate(_State);
     884                 :         return (_Istr);
     885                 :         }
     886                 : #endif
     887                 : 
     888                 :  #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE)
     889                 : 
     890                 : template class _CRTIMP2_PURE basic_istream<char, char_traits<char> >;
     891                 : template class _CRTIMP2_PURE basic_istream<wchar_t, char_traits<wchar_t> >;
     892                 : 
     893                 : 
     894                 : 
     895                 :  #endif /* _DLL_CPPLIB */
     896                 : 
     897                 :                 // TEMPLATE CLASS basic_iostream
     898                 : template<class _Elem,
     899                 :         class _Traits>
     900                 :         class basic_iostream
     901                 :         : public basic_istream<_Elem, _Traits>,
     902                 :                 public basic_ostream<_Elem, _Traits>
     903                 :         {       // control insertions and extractions from a stream buffer
     904                 : public:
     905                 :         typedef _Elem char_type;
     906                 :         typedef _Traits traits_type;
     907                 :         typedef typename _Traits::int_type int_type;
     908                 :         typedef typename _Traits::pos_type pos_type;
     909                 :         typedef typename _Traits::off_type off_type;
     910                 : 
     911                 :         explicit __CLR_OR_THIS_CALL basic_iostream(basic_streambuf<_Elem, _Traits> *_Strbuf)
     912                 :                 : basic_istream<_Elem, _Traits>(_Strbuf, false),
     913                 :                         basic_ostream<_Elem, _Traits>(_Noinit, false)
     914              10 :                 {       // construct from stream buffer pointer

     915              10 :                 }

     916                 : 
     917                 :         virtual __CLR_OR_THIS_CALL ~basic_iostream()
     918              10 :                 {       // destroy the object

     919              10 :                 }

     920                 :         };
     921                 : 
     922                 :  #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE)
     923                 : 
     924                 : template class _CRTIMP2_PURE basic_iostream<char, char_traits<char> >;
     925                 : template class _CRTIMP2_PURE basic_iostream<wchar_t, char_traits<wchar_t> >;
     926                 : 
     927                 : 
     928                 : 
     929                 :  #endif /* _DLL_CPPLIB */
     930                 : 
     931                 :                 // EXTRACTORS
     932                 : template<class _Elem,
     933                 :         class _Traits> inline
     934                 :         basic_istream<_Elem, _Traits>& __CLRCALL_OR_CDECL operator>>(
     935                 :                 basic_istream<_Elem, _Traits>& _Istr, _Elem *_Str)
     936                 :         {       // extract NTBS
     937                 :         _DEBUG_POINTER(_Str);
     938                 :         typedef basic_istream<_Elem, _Traits> _Myis;
     939                 :         typedef ctype<_Elem> _Ctype;
     940                 :         ios_base::iostate _State = ios_base::goodbit;
     941                 :         _Elem *_Str0 = _Str;
     942                 :         const typename _Myis::sentry _Ok(_Istr);
     943                 : 
     944                 :         if (_Ok)
     945                 :                 {       // state okay, extract characters
     946                 :                 const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
     947                 : 
     948                 :                 _TRY_IO_BEGIN
     949                 :                 streamsize _Count = 0 < _Istr.width() ? _Istr.width() : INT_MAX;
     950                 :                 typename _Myis::int_type _Meta = _Istr.rdbuf()->sgetc();
     951                 :                 _Elem _Ch;
     952                 :                 for (; 0 < --_Count; _Meta = _Istr.rdbuf()->snextc())
     953                 :                         if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     954                 :                                 {       // end of file, quit
     955                 :                                 _State |= ios_base::eofbit;
     956                 :                                 break;
     957                 :                                 }
     958                 :                         else if (_Ctype_fac.is(_Ctype::space,
     959                 :                                 _Ch = _Traits::to_char_type(_Meta))
     960                 :                                         || _Ch == _Elem())
     961                 :                                 break;  // whitespace or nul, quit
     962                 :                         else
     963                 :                                 *_Str++ = _Traits::to_char_type(_Meta); // add it to string
     964                 :                 _CATCH_IO_(_Istr)
     965                 :                 }
     966                 : 
     967                 :         *_Str = _Elem();        // add terminating null character
     968                 :         _Istr.width(0);
     969                 :         _Istr.setstate(_Str == _Str0 ? _State | ios_base::failbit : _State);
     970                 :         return (_Istr);
     971                 :         }
     972                 : 
     973                 : template<class _Elem,
     974                 :         class _Traits> inline
     975                 :         basic_istream<_Elem, _Traits>& __CLRCALL_OR_CDECL  operator>>(
     976                 :                 basic_istream<_Elem, _Traits>& _Istr, _Elem& _Ch)
     977                 :         {       // extract a character
     978                 :         typedef basic_istream<_Elem, _Traits> _Myis;
     979                 :         typename _Myis::int_type _Meta;
     980                 :         ios_base::iostate _State = ios_base::goodbit;
     981                 :         const typename _Myis::sentry _Ok(_Istr);
     982                 : 
     983                 :         if (_Ok)
     984                 :                 {       // state okay, extract characters
     985                 :                 _TRY_IO_BEGIN
     986                 :                 _Meta = _Istr.rdbuf()->sbumpc();
     987                 :                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     988                 :                         _State |= ios_base::eofbit | ios_base::failbit; // end of file
     989                 :                 else
     990                 :                         _Ch = _Traits::to_char_type(_Meta);     // got a character
     991                 :                 _CATCH_IO_(_Istr)
     992                 :                 }
     993                 : 
     994                 :         _Istr.setstate(_State);
     995                 :         return (_Istr);
     996                 :         }
     997                 : 
     998                 : #ifdef _MSC_VER
     999                 : template<class _Traits> inline
    1000                 :         basic_istream<char, _Traits>& __CLRCALL_OR_CDECL  operator>>(
    1001                 :                 basic_istream<char, _Traits>& _Istr, signed char *_Str)
    1002                 :         {       // extract a signed char NTBS
    1003                 :         return (_Istr >> (char *)_Str);
    1004                 :         }
    1005                 : 
    1006                 : template<class _Traits> inline
    1007                 :         basic_istream<char, _Traits>& __CLRCALL_OR_CDECL  operator>>(
    1008                 :                 basic_istream<char, _Traits>& _Istr, signed char& _Ch)
    1009                 :         {       // extract a signed char
    1010                 :         return (_Istr >> (char&)_Ch);
    1011                 :         }
    1012                 : 
    1013                 : template<class _Traits> inline
    1014                 :         basic_istream<char, _Traits>& __CLRCALL_OR_CDECL  operator>>(
    1015                 :                 basic_istream<char, _Traits>& _Istr, unsigned char *_Str)
    1016                 :         {       // extract an unsigned char NTBS
    1017                 :         return (_Istr >> (char *)_Str);
    1018                 :         }
    1019                 : 
    1020                 : template<class _Traits> inline
    1021                 :         basic_istream<char, _Traits>& __CLRCALL_OR_CDECL  operator>>(
    1022                 :                 basic_istream<char, _Traits>& _Istr, unsigned char& _Ch)
    1023                 :         {       // extract an unsigned char
    1024                 :         return (_Istr >> (char&)_Ch);
    1025                 :         }
    1026                 : 
    1027                 : #endif
    1028                 : 
    1029                 :                 // MANIPULATORS
    1030                 : template<class _Elem,
    1031                 :         class _Traits> inline
    1032                 :         basic_istream<_Elem, _Traits>&
    1033                 :                 __CLRCALL_OR_CDECL ws(basic_istream<_Elem, _Traits>& _Istr)
    1034                 :         {       // consume whitespace
    1035                 :         typedef basic_istream<_Elem, _Traits> _Myis;
    1036                 :         typedef ctype<_Elem> _Ctype;
    1037                 : 
    1038                 :         if (!_Istr.eof())
    1039                 :                 {       // not at eof, okay to construct sentry and skip
    1040                 :                 ios_base::iostate _State = ios_base::goodbit;
    1041                 :                 const typename _Myis::sentry _Ok(_Istr, true);
    1042                 : 
    1043                 :                 if (_Ok)
    1044                 :                         {       // state okay, extract characters
    1045                 :                         const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
    1046                 : 
    1047                 :                         _TRY_IO_BEGIN
    1048                 :                         for (typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
    1049                 :                                 _Meta = _Istr.rdbuf()->snextc())
    1050                 :                                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
    1051                 :                                         {       // end of file, quit
    1052                 :                                         _State |= ios_base::eofbit;
    1053                 :                                         break;
    1054                 :                                         }
    1055                 :                                 else if (!_Ctype_fac.is(_Ctype::space,
    1056                 :                                         _Traits::to_char_type(_Meta)))
    1057                 :                                         break;  // not whitespace, quit
    1058                 :                         _CATCH_IO_(_Istr)
    1059                 :                         }
    1060                 : 
    1061                 :                 _Istr.setstate(_State);
    1062                 :                 }
    1063                 :         return (_Istr);
    1064                 :         }
    1065                 : 
    1066                 : _CRTIMP2_PURE inline basic_istream<char, char_traits<char> >&
    1067                 :         __CLRCALL_OR_CDECL ws(basic_istream<char, char_traits<char> >& _Istr)
    1068                 :         {       // consume whitespace
    1069                 :         typedef char _Elem;
    1070                 :         typedef char_traits<_Elem> _Traits;
    1071                 : 
    1072                 :         if (!_Istr.eof())
    1073                 :                 {       // not at eof, okay to construct sentry and skip
    1074                 :                 ios_base::iostate _State = ios_base::goodbit;
    1075                 :                 const basic_istream<_Elem, _Traits>::sentry _Ok(_Istr, true);
    1076                 : 
    1077                 :                 if (_Ok)
    1078                 :                         {       // state okay, use facet to extract
    1079                 :                         const ctype<_Elem>& _Ctype_fac =
    1080                 :                                 _USE(_Istr.getloc(), ctype<_Elem>);
    1081                 : 
    1082                 :                         _TRY_IO_BEGIN
    1083                 :                         for (_Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
    1084                 :                                 _Meta = _Istr.rdbuf()->snextc())
    1085                 :                                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
    1086                 :                                         {       // end of file, quit
    1087                 :                                         _State |= ios_base::eofbit;
    1088                 :                                         break;
    1089                 :                                         }
    1090                 :                                 else if (!_Ctype_fac.is(ctype<_Elem>::space,
    1091                 :                                         _Traits::to_char_type(_Meta)))
    1092                 :                                         break;  // not whitespace, quit
    1093                 :                         _CATCH_IO_(_Istr)
    1094                 :                         }
    1095                 : 
    1096                 :                 _Istr.setstate(_State);
    1097                 :                 }
    1098                 :         return (_Istr);
    1099                 :         }
    1100                 : 
    1101                 : _CRTIMP2_PURE inline basic_istream<wchar_t, char_traits<wchar_t> >&
    1102                 :         __CLRCALL_OR_CDECL ws(basic_istream<wchar_t, char_traits<wchar_t> >& _Istr)
    1103                 :         {       // consume whitespace
    1104                 :         typedef wchar_t _Elem;
    1105                 :         typedef char_traits<_Elem> _Traits;
    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 basic_istream<_Elem, _Traits>::sentry _Ok(_Istr, true);
    1111                 : 
    1112                 :                 if (_Ok)
    1113                 :                         {       // state okay, use facet to extract
    1114                 :                         const ctype<_Elem>& _Ctype_fac =
    1115                 :                                 _USE(_Istr.getloc(), ctype<_Elem>);
    1116                 : 
    1117                 :                         _TRY_IO_BEGIN
    1118                 :                         for (_Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); ;
    1119                 :                                 _Meta = _Istr.rdbuf()->snextc())
    1120                 :                                 if (_Traits::eq_int_type(_Traits::eof(), _Meta))
    1121                 :                                         {       // end of file, quit
    1122                 :                                         _State |= ios_base::eofbit;
    1123                 :                                         break;
    1124                 :                                         }
    1125                 :                                 else if (!_Ctype_fac.is(ctype<_Elem>::space,
    1126                 :                                         _Traits::to_char_type(_Meta)))
    1127                 :                                         break;  // not whitespace, quit
    1128                 :                         _CATCH_IO_(_Istr)
    1129                 :                         }
    1130                 : 
    1131                 :                 _Istr.setstate(_State);
    1132                 :                 }
    1133                 :         return (_Istr);
    1134                 :         }
    1135                 : 
    1136                 : 
    1137                 : 
    1138                 :  #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE)
    1139                 : template _CRTIMP2_PURE basic_istream<char, char_traits<char> >& __CLRCALL_OR_CDECL
    1140                 :         operator>>(basic_istream<char, char_traits<char> >&, char *);
    1141                 : template _CRTIMP2_PURE basic_istream<char, char_traits<char> >& __CLRCALL_OR_CDECL
    1142                 :         operator>>(basic_istream<char, char_traits<char> >&, char&);
    1143                 : template _CRTIMP2_PURE basic_istream<char, char_traits<char> >& __CLRCALL_OR_CDECL
    1144                 :         operator>>(basic_istream<char, char_traits<char> >&, signed char *);
    1145                 : template _CRTIMP2_PURE basic_istream<char, char_traits<char> >& __CLRCALL_OR_CDECL
    1146                 :         operator>>(basic_istream<char, char_traits<char> >&, signed char&);
    1147                 : template _CRTIMP2_PURE basic_istream<char, char_traits<char> >& __CLRCALL_OR_CDECL
    1148                 :         operator>>(basic_istream<char, char_traits<char> >&, unsigned char *);
    1149                 : template _CRTIMP2_PURE basic_istream<char, char_traits<char> >& __CLRCALL_OR_CDECL
    1150                 :         operator>>(basic_istream<char, char_traits<char> >&, unsigned char&);
    1151                 : template _CRTIMP2_PURE basic_istream<wchar_t, char_traits<wchar_t> >& __CLRCALL_OR_CDECL
    1152                 :         operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, wchar_t *);
    1153                 : template _CRTIMP2_PURE basic_istream<wchar_t, char_traits<wchar_t> >& __CLRCALL_OR_CDECL
    1154                 :         operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, wchar_t&);
    1155                 : 
    1156                 : 
    1157                 : 
    1158                 :  #endif /* _DLL_CPPLIB */
    1159                 : _STD_END
    1160                 : 
    1161                 : #ifdef _MSC_VER
    1162                 :  #pragma warning(pop)
    1163                 :  #pragma pack(pop)
    1164                 : #endif  /* _MSC_VER */
    1165                 : 
    1166                 : #endif /* RC_INVOKED */
    1167                 : #endif /* _ISTREAM_ */
    1168                 : 
    1169                 : /*
    1170                 :  * Copyright (c) 1992-2006 by P.J. Plauger.  ALL RIGHTS RESERVED.
    1171                 :  * Consult your license regarding permissions and restrictions.
    1172                 :  V5.02:0009 */

Generated by: LCOV version 1.7