Leaked source code of windows server 2003
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.

92 lines
2.6 KiB

  1. // iomanip standard header
  2. #pragma once
  3. #ifndef _IOMANIP_
  4. #define _IOMANIP_
  5. #include <istream>
  6. #pragma pack(push,8)
  7. #pragma warning(push,3)
  8. _STD_BEGIN
  9. // TEMPLATE STRUCT _Fillobj
  10. template<class _Elem>
  11. struct _Fillobj
  12. { // store fill character
  13. _Fillobj(_Elem _Ch)
  14. : _Fill(_Ch)
  15. { // construct from fill character
  16. }
  17. _Elem _Fill; // the fill character
  18. };
  19. // TEMPLATE FUNCTION setfill
  20. template<class _Elem> inline
  21. _Fillobj<_Elem> __cdecl setfill(_Elem _Ch)
  22. { // return a _Fillobj manipulator
  23. return (_Fillobj<_Elem>(_Ch));
  24. }
  25. template<class _Elem, class _Traits> inline
  26. basic_istream<_Elem, _Traits>&
  27. __cdecl operator>>(basic_istream<_Elem, _Traits>& _Istr,
  28. const _Fillobj<_Elem>& _Manip)
  29. { // set fill character in input stream
  30. _Istr.fill(_Manip._Fill);
  31. return (_Istr);
  32. }
  33. template<class _Elem, class _Traits> inline
  34. basic_ostream<_Elem, _Traits>&
  35. __cdecl operator<<(basic_ostream<_Elem, _Traits>& _Ostr,
  36. const _Fillobj<_Elem>& _Manip)
  37. { // set fill character in output stream
  38. _Ostr.fill(_Manip._Fill);
  39. return (_Ostr);
  40. }
  41. // TEMPLATE STRUCT _Smanip
  42. template<class _Arg>
  43. struct _Smanip
  44. { // store function pointer and argument value
  45. _Smanip(void (__cdecl *_Left)(ios_base&, _Arg), _Arg _Val)
  46. : _Pfun(_Left), _Manarg(_Val)
  47. { // construct from function pointer and argument value
  48. }
  49. void (__cdecl *_Pfun)(ios_base&, _Arg); // the function pointer
  50. _Arg _Manarg; // the argument value
  51. };
  52. template<class _Elem, class _Traits, class _Arg> inline
  53. basic_istream<_Elem, _Traits>& __cdecl operator>>(
  54. basic_istream<_Elem, _Traits>& _Istr, const _Smanip<_Arg>& _Manip)
  55. { // extract by calling function with input stream and argument
  56. (*_Manip._Pfun)(_Istr, _Manip._Manarg);
  57. return (_Istr);
  58. }
  59. template<class _Elem, class _Traits, class _Arg> inline
  60. basic_ostream<_Elem, _Traits>& __cdecl operator<<(
  61. basic_ostream<_Elem, _Traits>& _Ostr, const _Smanip<_Arg>& _Manip)
  62. { // insert by calling function with output stream and argument
  63. (*_Manip._Pfun)(_Ostr, _Manip._Manarg);
  64. return (_Ostr);
  65. }
  66. // INSTANTIATIONS
  67. _CRTIMP2 _Smanip<ios_base::fmtflags> __cdecl resetiosflags(ios_base::fmtflags);
  68. _CRTIMP2 _Smanip<ios_base::fmtflags> __cdecl setiosflags(ios_base::fmtflags);
  69. _CRTIMP2 _Smanip<int> __cdecl setbase(int);
  70. _CRTIMP2 _Smanip<streamsize> __cdecl setprecision(streamsize);
  71. _CRTIMP2 _Smanip<streamsize> __cdecl setw(streamsize);
  72. _STD_END
  73. #pragma warning(pop)
  74. #pragma pack(pop)
  75. #endif /* _IOMANIP_ */
  76. /*
  77. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  78. * Consult your license regarding permissions and restrictions.
  79. V3.10:0009 */