1 // Standard stream manipulators -*- C++ -*-
3 // Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
31 // ISO C++ 14882: 27.6.3 Standard manipulators
34 /** @file std_iomanip.h
35 * This is an internal header file, included by other library headers.
36 * You should not attempt to use it directly.
40 #define _CPP_IOMANIP 1
42 #pragma GCC system_header
44 #include <bits/c++config.h>
51 struct _Resetiosflags { ios_base::fmtflags _M_mask; };
54 resetiosflags(ios_base::fmtflags __mask)
61 template <class _CharT, class _Traits>
62 basic_istream<_CharT,_Traits>&
63 operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
65 __is.setf(ios_base::fmtflags(0), __f._M_mask);
69 template <class _CharT, class _Traits>
70 basic_ostream<_CharT,_Traits>&
71 operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
73 __os.setf(ios_base::fmtflags(0), __f._M_mask);
78 struct _Setiosflags { ios_base::fmtflags _M_mask; };
81 setiosflags(ios_base::fmtflags __mask)
88 template <class _CharT, class _Traits>
89 basic_istream<_CharT,_Traits>&
90 operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
92 __is.setf(__f._M_mask);
96 template <class _CharT, class _Traits>
97 basic_ostream<_CharT,_Traits>&
98 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
100 __os.setf(__f._M_mask);
105 struct _Setbase { int _M_base; };
111 __x._M_base = __base;
115 template <class _CharT, class _Traits>
116 basic_istream<_CharT,_Traits>&
117 operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
119 __is.setf(__f._M_base == 8 ? ios_base::oct :
120 __f._M_base == 10 ? ios_base::dec :
121 __f._M_base == 16 ? ios_base::hex :
122 ios_base::fmtflags(0), ios_base::basefield);
126 template <class _CharT, class _Traits>
127 basic_ostream<_CharT,_Traits>&
128 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
130 __os.setf(__f._M_base == 8 ? ios_base::oct :
131 __f._M_base == 10 ? ios_base::dec :
132 __f._M_base == 16 ? ios_base::hex :
133 ios_base::fmtflags(0), ios_base::basefield);
138 template<class _CharT>
139 struct _Setfill { _CharT _M_c; };
141 template<class _CharT>
145 _Setfill<_CharT> __x;
150 template <class _CharT, class _Traits>
151 basic_istream<_CharT,_Traits>&
152 operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
158 template <class _CharT, class _Traits>
159 basic_ostream<_CharT,_Traits>&
160 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
167 struct _Setprecision { int _M_n; };
170 setprecision(int __n)
177 template <class _CharT, class _Traits>
178 basic_istream<_CharT,_Traits>&
179 operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
181 __is.precision(__f._M_n);
185 template <class _CharT, class _Traits>
186 basic_ostream<_CharT,_Traits>&
187 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
189 __os.precision(__f._M_n);
194 struct _Setw { int _M_n; };
204 template <class _CharT, class _Traits>
205 basic_istream<_CharT,_Traits>&
206 operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
208 __is.width(__f._M_n);
212 template <class _CharT, class _Traits>
213 basic_ostream<_CharT,_Traits>&
214 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
216 __os.width(__f._M_n);