Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.8 KiB

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