windows-nt/Source/XPSP1/NT/base/crts/crtw32/stdhpp/iomanip

93 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
// iomanip standard header
#pragma once
#ifndef _IOMANIP_
#define _IOMANIP_
#include <istream>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE STRUCT _Fillobj
template<class _Elem>
struct _Fillobj
{ // store fill character
_Fillobj(_Elem _Ch)
: _Fill(_Ch)
{ // construct from fill character
}
_Elem _Fill; // the fill character
};
// TEMPLATE FUNCTION setfill
template<class _Elem> inline
_Fillobj<_Elem> __cdecl setfill(_Elem _Ch)
{ // return a _Fillobj manipulator
return (_Fillobj<_Elem>(_Ch));
}
template<class _Elem, class _Traits> inline
basic_istream<_Elem, _Traits>&
__cdecl operator>>(basic_istream<_Elem, _Traits>& _Istr,
const _Fillobj<_Elem>& _Manip)
{ // set fill character in input stream
_Istr.fill(_Manip._Fill);
return (_Istr);
}
template<class _Elem, class _Traits> inline
basic_ostream<_Elem, _Traits>&
__cdecl operator<<(basic_ostream<_Elem, _Traits>& _Ostr,
const _Fillobj<_Elem>& _Manip)
{ // set fill character in output stream
_Ostr.fill(_Manip._Fill);
return (_Ostr);
}
// TEMPLATE STRUCT _Smanip
template<class _Arg>
struct _Smanip
{ // store function pointer and argument value
_Smanip(void (__cdecl *_Left)(ios_base&, _Arg), _Arg _Val)
: _Pfun(_Left), _Manarg(_Val)
{ // construct from function pointer and argument value
}
void (__cdecl *_Pfun)(ios_base&, _Arg); // the function pointer
_Arg _Manarg; // the argument value
};
template<class _Elem, class _Traits, class _Arg> inline
basic_istream<_Elem, _Traits>& __cdecl operator>>(
basic_istream<_Elem, _Traits>& _Istr, const _Smanip<_Arg>& _Manip)
{ // extract by calling function with input stream and argument
(*_Manip._Pfun)(_Istr, _Manip._Manarg);
return (_Istr);
}
template<class _Elem, class _Traits, class _Arg> inline
basic_ostream<_Elem, _Traits>& __cdecl operator<<(
basic_ostream<_Elem, _Traits>& _Ostr, const _Smanip<_Arg>& _Manip)
{ // insert by calling function with output stream and argument
(*_Manip._Pfun)(_Ostr, _Manip._Manarg);
return (_Ostr);
}
// INSTANTIATIONS
_CRTIMP2 _Smanip<ios_base::fmtflags> __cdecl resetiosflags(ios_base::fmtflags);
_CRTIMP2 _Smanip<ios_base::fmtflags> __cdecl setiosflags(ios_base::fmtflags);
_CRTIMP2 _Smanip<int> __cdecl setbase(int);
_CRTIMP2 _Smanip<streamsize> __cdecl setprecision(streamsize);
_CRTIMP2 _Smanip<streamsize> __cdecl setw(streamsize);
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _IOMANIP_ */
/*
* Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.10:0009 */