|
|
|
| 1 |
|
// iomanip standard header |
| 2 |
|
#pragma once |
| 3 |
|
#ifndef _IOMANIP_ |
| 4 |
|
#define _IOMANIP_ |
| 5 |
|
#ifndef RC_INVOKED |
| 6 |
|
#include <istream> |
| 7 |
|
|
| 8 |
|
#ifdef _MSC_VER |
| 9 |
|
#pragma pack(push,_CRT_PACKING) |
| 10 |
|
#pragma warning(push,3) |
| 11 |
|
#endif /* _MSC_VER */ |
| 12 |
|
_STD_BEGIN |
| 13 |
|
|
| 14 |
|
// TEMPLATE STRUCT _Fillobj |
| 15 |
|
template<class _Elem> |
| 16 |
|
struct _Fillobj |
| 17 |
|
{ // store fill character |
| 18 |
|
_Fillobj(_Elem _Ch) |
| 19 |
|
: _Fill(_Ch) |
| 20 |
|
{ // construct from fill character |
| 21 |
|
} |
| 22 |
|
|
| 23 |
|
_Elem _Fill; // the fill character |
| 24 |
|
}; |
| 25 |
|
|
| 26 |
|
// TEMPLATE FUNCTION setfill |
| 27 |
|
template<class _Elem> inline |
| 28 |
|
_Fillobj<_Elem> __CLRCALL_OR_CDECL setfill(_Elem _Ch) |
| 29 |
|
{ // return a _Fillobj manipulator |
| 30 |
|
return (_Fillobj<_Elem>(_Ch)); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
template<class _Elem, |
| 34 |
|
class _Traits> inline |
| 35 |
|
basic_istream<_Elem, _Traits>& |
| 36 |
|
__CLRCALL_OR_CDECL operator>>(basic_istream<_Elem, _Traits>& _Istr, |
| 37 |
|
const _Fillobj<_Elem>& _Manip) |
| 38 |
|
{ // set fill character in input stream |
| 39 |
|
_Istr.fill(_Manip._Fill); |
| 40 |
|
return (_Istr); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
template<class _Elem, |
| 44 |
|
class _Traits> inline |
| 45 |
|
basic_ostream<_Elem, _Traits>& |
| 56 |
|
{ // store function pointer and argument value |
| 57 |
|
_Smanip(void (__cdecl *_Left)(ios_base&, _Arg), _Arg _Val) |
| 58 |
|
: _Pfun(_Left), _Manarg(_Val) |
| 59 |
|
{ // construct from function pointer and argument value |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
void (__cdecl *_Pfun)(ios_base&, _Arg); // the function pointer |
| 63 |
|
_Arg _Manarg; // the argument value |
| 64 |
|
}; |
| 65 |
|
|
| 66 |
|
template<class _Elem, |
| 67 |
|
class _Traits, |
| 68 |
|
class _Arg> inline |
| 69 |
|
basic_istream<_Elem, _Traits>& __CLRCALL_OR_CDECL operator>>( |
| 70 |
|
basic_istream<_Elem, _Traits>& _Istr, const _Smanip<_Arg>& _Manip) |
| 71 |
|
{ // extract by calling function with input stream and argument |
| 72 |
|
(*_Manip._Pfun)(_Istr, _Manip._Manarg); |
| 73 |
|
return (_Istr); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
template<class _Elem, |
| 77 |
|
class _Traits, |
| 78 |
|
class _Arg> inline |
| 79 |
|
basic_ostream<_Elem, _Traits>& __CLRCALL_OR_CDECL operator<<( |
| 80 |
|
basic_ostream<_Elem, _Traits>& _Ostr, const _Smanip<_Arg>& _Manip) |
| 81 |
|
{ // insert by calling function with output stream and argument |
| 82 |
|
(*_Manip._Pfun)(_Ostr, _Manip._Manarg); |
| 83 |
|
return (_Ostr); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
// INSTANTIATIONS |
| 87 |
|
_MRTIMP2 _Smanip<ios_base::fmtflags> __cdecl resetiosflags(ios_base::fmtflags); |
| 88 |
|
_MRTIMP2 _Smanip<ios_base::fmtflags> __cdecl setiosflags(ios_base::fmtflags); |
| 89 |
|
_MRTIMP2 _Smanip<int> __cdecl setbase(int); |
| 90 |
|
_MRTIMP2 _Smanip<streamsize> __cdecl setprecision(streamsize); |
| 91 |
|
_MRTIMP2 _Smanip<streamsize> __cdecl setw(streamsize); |
| 92 |
|
_STD_END |
| 93 |
|
#ifdef _MSC_VER |
| 94 |
|
#pragma warning(pop) |
| 95 |
|
#pragma pack(pop) |
| 96 |
|
#endif /* _MSC_VER */ |
| 97 |
|
|
| 98 |
|
#endif /* RC_INVOKED */ |
| 99 |
|
#endif /* _IOMANIP_ */ |
| 100 |
|
|
| 101 |
|
/* |
| 102 |
|
* Copyright (c) 1992-2006 by P.J. Plauger. ALL RIGHTS RESERVED. |
| 103 |
|
* Consult your license regarding permissions and restrictions. |
| 104 |
|
V5.02:0009 */ |
| 105 |
|
|
|
|
|