home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / MS_VC.50 / VC / INCLUDE / IOS < prev    next >
Encoding:
Text File  |  1996-11-02  |  4.7 KB  |  169 lines

  1. // ios standard header
  2. #ifndef _IOS_
  3. #define _IOS_
  4. #include <streambuf>
  5.  
  6. #ifdef  _MSC_VER
  7. #pragma pack(push,8)
  8. #endif  /* _MSC_VER */
  9. _STD_BEGIN
  10.         // TEMPLATE CLASS basic_ios
  11. template<class _E, class _Tr = char_traits<_E> >
  12.     class basic_ios : public ios_base {
  13. public:
  14.     typedef basic_ios<_E, _Tr> _Myt;
  15.     typedef basic_ostream<_E, _Tr> _Myos;
  16.     typedef basic_streambuf<_E, _Tr> _Mysb;
  17.     typedef ctype<_E> _Ctype;
  18.     explicit basic_ios(_Mysb *_S)
  19.         {init(_S); }
  20.     basic_ios(const _Myt& _R)
  21.         {init(0), *this = _R; }
  22.     virtual ~basic_ios()
  23.         {}
  24.     typedef _E char_type;
  25.     typedef _Tr traits_type;
  26.     typedef _Tr::int_type int_type;
  27.     typedef _Tr::pos_type pos_type;
  28.     typedef _Tr::off_type off_type;
  29.     void clear(iostate _St = goodbit, bool _Ex = false)
  30.         {ios_base::clear(_Sb == 0 ? (int)_St | (int)badbit
  31.             : (int)_St, _Ex); }
  32.     void clear(io_state _St)
  33.         {clear((iostate)_St); }
  34.     void setstate(iostate _St, bool _Ex = false)
  35.         {if (_St != goodbit)
  36.             clear((iostate)((int)rdstate() | (int)_St), _Ex); }
  37.     void setstate(io_state _St)
  38.         {setstate((iostate)_St); }
  39.     _Myt& copyfmt(const _Myt& _R)
  40.         {_Tiestr = _R.tie();
  41.         _Fillch = _R.fill();
  42.         ios_base::copyfmt(_R);
  43.         return (*this); }
  44.     _Myos *tie() const
  45.         {return (_Tiestr); }
  46.     _Myos *tie(_Myos *_N)
  47.         {_Myos *_O = _Tiestr;
  48.         _Tiestr = _N;
  49.         return (_O); }
  50.     _Mysb *rdbuf() const
  51.         {return (_Sb); }
  52.     _Mysb *rdbuf(_Mysb *_N)
  53.         {_Mysb *_O = _Sb;
  54.         _Sb = _N;
  55.         clear();
  56.         return (_O); }
  57.     locale imbue(const locale& _Ln)
  58.         {if (rdbuf() != 0)
  59.             rdbuf()->pubimbue(_Ln);
  60.         return (ios_base::imbue(_Ln)); }
  61.     _E fill() const
  62.         {return (_Fillch); }
  63.     _E fill(_E _Nf)
  64.         {_E _Of = _Fillch;
  65.         _Fillch = _Nf;
  66.         return (_Of); }
  67.     char narrow(_E _C, char _D = '\0') const
  68.         {const _Ctype& _Fac = _USE(getloc(), _Ctype);
  69.         return (_Fac.narrow(_C, _D)); }
  70.     _E widen(char _C) const
  71.         {const _Ctype& _Fac = _USE(getloc(), _Ctype);
  72.         return (_Fac.widen(_C)); }
  73. protected:
  74.     void init(_Mysb *_S = 0,
  75.         bool _Isstd = false)
  76.         {_Sb = _S;
  77.         _Tiestr = 0;
  78.         _Fillch = _WIDEN(_E, ' ');
  79.         _Init();
  80.         if (_Sb == 0)
  81.             setstate(badbit);
  82.         if (_Isstd)
  83.             _Addstd(); }
  84.     basic_ios()
  85.         {}
  86. private:
  87.     _Mysb *_Sb;
  88.     _Myos *_Tiestr;
  89.     _E _Fillch;
  90.     };
  91.         // MANIPULATORS
  92. inline ios_base& __cdecl boolalpha(ios_base& _I)
  93.     {_I.setf(ios_base::boolalpha);
  94.     return (_I); }
  95. inline ios_base& __cdecl dec(ios_base& _I)
  96.     {_I.setf(ios_base::dec, ios_base::basefield);
  97.     return (_I); }
  98. inline ios_base& __cdecl fixed(ios_base& _I)
  99.     {_I.setf(ios_base::fixed, ios_base::floatfield);
  100.     return (_I); }
  101. inline ios_base& __cdecl hex(ios_base& _I)
  102.     {_I.setf(ios_base::hex, ios_base::basefield);
  103.     return (_I); }
  104. inline ios_base& __cdecl internal(ios_base& _I)
  105.     {_I.setf(ios_base::internal, ios_base::adjustfield);
  106.     return (_I); }
  107. inline ios_base& __cdecl left(ios_base& _I)
  108.     {_I.setf(ios_base::left, ios_base::adjustfield);
  109.     return (_I); }
  110. inline ios_base& __cdecl noboolalpha(ios_base& _I)
  111.     {_I.unsetf(ios_base::boolalpha);
  112.     return (_I); }
  113. inline ios_base& __cdecl noshowbase(ios_base& _I)
  114.     {_I.unsetf(ios_base::showbase);
  115.     return (_I); }
  116. inline ios_base& __cdecl noshowpoint(ios_base& _I)
  117.     {_I.unsetf(ios_base::showpoint);
  118.     return (_I); }
  119. inline ios_base& __cdecl noshowpos(ios_base& _I)
  120.     {_I.unsetf(ios_base::showpos);
  121.     return (_I); }
  122. inline ios_base& __cdecl noskipws(ios_base& _I)
  123.     {_I.unsetf(ios_base::skipws);
  124.     return (_I); }
  125. inline ios_base& __cdecl nounitbuf(ios_base& _I)
  126.     {_I.unsetf(ios_base::unitbuf);
  127.     return (_I); }
  128. inline ios_base& __cdecl nouppercase(ios_base& _I)
  129.     {_I.unsetf(ios_base::uppercase);
  130.     return (_I); }
  131. inline ios_base& __cdecl oct(ios_base& _I)
  132.     {_I.setf(ios_base::oct, ios_base::basefield);
  133.     return (_I); }
  134. inline ios_base& __cdecl right(ios_base& _I)
  135.     {_I.setf(ios_base::right, ios_base::adjustfield);
  136.     return (_I); }
  137. inline ios_base& __cdecl scientific(ios_base& _I)
  138.     {_I.setf(ios_base::scientific, ios_base::floatfield);
  139.     return (_I); }
  140. inline ios_base& __cdecl showbase(ios_base& _I)
  141.     {_I.setf(ios_base::showbase);
  142.     return (_I); }
  143. inline ios_base& __cdecl showpoint(ios_base& _I)
  144.     {_I.setf(ios_base::showpoint);
  145.     return (_I); }
  146. inline ios_base& __cdecl showpos(ios_base& _I)
  147.     {_I.setf(ios_base::showpos);
  148.     return (_I); }
  149. inline ios_base& __cdecl skipws(ios_base& _I)
  150.     {_I.setf(ios_base::skipws);
  151.     return (_I); }
  152. inline ios_base& __cdecl unitbuf(ios_base& _I)
  153.     {_I.setf(ios_base::unitbuf);
  154.     return (_I); }
  155. inline ios_base& __cdecl uppercase(ios_base& _I)
  156.     {_I.setf(ios_base::uppercase);
  157.     return (_I); }
  158. _STD_END
  159. #ifdef  _MSC_VER
  160. #pragma pack(pop)
  161. #endif  /* _MSC_VER */
  162.  
  163. #endif /* _IOS_ */
  164.  
  165. /*
  166.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  167.  * Consult your license regarding permissions and restrictions.
  168.  */
  169.