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.

70 lines
1.9 KiB

  1. // iomanip -- instantiations of iomanip
  2. #include <iomanip>
  3. _STD_BEGIN
  4. // FUNCTION resetiosflags
  5. static void __cdecl rsfun(ios_base& iostr, ios_base::fmtflags mask)
  6. { // reset specified format flags
  7. iostr.setf(ios_base::_Fmtzero, mask);
  8. }
  9. // FUNCTION setiosflags
  10. static void __cdecl sifun(ios_base& iostr, ios_base::fmtflags mask)
  11. { // set specified format flags
  12. iostr.setf(ios_base::_Fmtmask, mask);
  13. }
  14. // FUNCTION setbase
  15. static void __cdecl sbfun(ios_base& iostr, int base)
  16. { // set base
  17. iostr.setf(base == 8 ? ios_base::oct
  18. : base == 10 ? ios_base::dec
  19. : base == 16 ? ios_base::hex
  20. : ios_base::_Fmtzero,
  21. ios_base::basefield);
  22. }
  23. // FUNCTION setprecision
  24. static void __cdecl spfun(ios_base& iostr, streamsize prec)
  25. { // set precision
  26. iostr.precision(prec);
  27. }
  28. // FUNCTION setw
  29. static void __cdecl swfun(ios_base& iostr, streamsize wide)
  30. { // set width
  31. iostr.width(wide);
  32. }
  33. _CRTIMP2 _Smanip<ios_base::fmtflags>
  34. __cdecl resetiosflags(ios_base::fmtflags mask)
  35. { // manipulator to reset format flags
  36. return (_Smanip<ios_base::fmtflags>(&rsfun, mask));
  37. }
  38. _CRTIMP2 _Smanip<ios_base::fmtflags>
  39. __cdecl setiosflags(ios_base::fmtflags mask)
  40. { // manipulator to set format flags
  41. return (_Smanip<ios_base::fmtflags>(&sifun, mask));
  42. }
  43. _CRTIMP2 _Smanip<int> __cdecl setbase(int base)
  44. { // manipulator to set base
  45. return (_Smanip<int>(&sbfun, base));
  46. }
  47. _CRTIMP2 _Smanip<streamsize> __cdecl setprecision(streamsize prec)
  48. { // manipulator to set precision
  49. return (_Smanip<streamsize>(&spfun, prec));
  50. }
  51. _CRTIMP2 _Smanip<streamsize> __cdecl setw(streamsize wide)
  52. { // manipulator to set width
  53. return (_Smanip<streamsize>(&swfun, wide));
  54. }
  55. _STD_END
  56. /*
  57. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  58. * Consult your license regarding permissions and restrictions.
  59. V3.10:0009 */