home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / iomanip < prev    next >
Text File  |  1998-06-16  |  2KB  |  73 lines

  1. // iomanip standard header
  2.  
  3. #if     _MSC_VER > 1000 /*IFSTRIP=IGN*/
  4. #pragma once
  5. #endif
  6.  
  7. #ifndef _IOMANIP_
  8. #define _IOMANIP_
  9. #include <istream>
  10. #include <xstddef>
  11.  
  12. #ifdef  _MSC_VER
  13. #pragma pack(push,8)
  14. #endif  /* _MSC_VER */
  15. _STD_BEGIN
  16.         // TEMPLATE FUNCTION setfill
  17. template<class _E>
  18.     struct _Fillobj {
  19.     _Fillobj(_E _Charg)
  20.         : _Ch(_Charg) {}
  21.     _E _Ch;
  22.     };
  23. template<class _E> inline
  24.     _Fillobj<_E> __cdecl setfill(_E _C)
  25.     {return (_Fillobj<_E>(_C)); }
  26. template<class _E, class _Tr> inline
  27.     basic_istream<_E, _Tr>& __cdecl operator>>(
  28.         basic_istream<_E, _Tr>& _I, const _Fillobj<_E>& _X)
  29.         {_I.fill(_X._Ch);
  30.         return (_I); }
  31. template<class _E, class _Tr> inline
  32.     basic_ostream<_E, _Tr>& __cdecl operator<<(
  33.         basic_ostream<_E, _Tr>& _O, const _Fillobj<_E>& _X)
  34.         {_O.fill(_X._Ch);
  35.         return (_O); }
  36.         // TEMPLATE STRUCT _Smanip
  37. template<class _Tm>
  38.     struct _Smanip {
  39.     _Smanip(void (__cdecl *_F)(ios_base&, _Tm), _Tm _A)
  40.         : _Pf(_F), _Manarg(_A) {}
  41.     void (__cdecl *_Pf)(ios_base&, _Tm);
  42.     _Tm _Manarg;
  43.     };
  44. template<class _E, class _Tr, class _Tm> inline
  45.     basic_istream<_E, _Tr>& __cdecl operator>>(
  46.         basic_istream<_E, _Tr>& _I, const _Smanip<_Tm>& _M)
  47.     {(*_M._Pf)(_I, _M._Manarg);
  48.     return (_I); }
  49. template<class _E, class _Tr, class _Tm> inline
  50.     basic_ostream<_E, _Tr>& __cdecl operator<<(
  51.         basic_ostream<_E, _Tr>& _O, const _Smanip<_Tm>& _M)
  52.     {(*_M._Pf)(_O, _M._Manarg);
  53.     return (_O); }
  54.         // INSTANTIATIONS
  55. _CRTIMP2 _Smanip<ios_base::fmtflags>
  56.     __cdecl resetiosflags(ios_base::fmtflags);
  57. _CRTIMP2 _Smanip<ios_base::fmtflags>
  58.     __cdecl setiosflags(ios_base::fmtflags);
  59. _CRTIMP2 _Smanip<int> __cdecl setbase(int);
  60. _CRTIMP2 _Smanip<streamsize> __cdecl setprecision(streamsize);
  61. _CRTIMP2 _Smanip<streamsize> __cdecl setw(streamsize);
  62. _STD_END
  63. #ifdef  _MSC_VER
  64. #pragma pack(pop)
  65. #endif  /* _MSC_VER */
  66.  
  67. #endif /* _IOMANIP_ */
  68.  
  69. /*
  70.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  71.  * Consult your license regarding permissions and restrictions.
  72.  */
  73.