00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
#ifndef _CPP_IOMANIP
00041
#define _CPP_IOMANIP 1
00042
00043
#pragma GCC system_header
00044
00045
#include <bits/c++config.h>
00046
#include <istream>
00047
#include <functional>
00048
00049
namespace std
00050 {
00051
00052
00053
00054
struct _Resetiosflags { ios_base::fmtflags _M_mask; };
00055
00056
00057
00058
00059
00060
00061
00062
00063
inline _Resetiosflags
00064 resetiosflags(
ios_base::fmtflags __mask)
00065 {
00066 _Resetiosflags __x;
00067 __x._M_mask = __mask;
00068
return __x;
00069 }
00070
00071
template<
typename _CharT,
typename _Traits>
00072
inline basic_istream<_CharT,_Traits>&
00073
operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
00074 {
00075 __is.setf(ios_base::fmtflags(0), __f._M_mask);
00076
return __is;
00077 }
00078
00079
template<
typename _CharT,
typename _Traits>
00080
inline basic_ostream<_CharT,_Traits>&
00081 operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
00082 {
00083 __os.setf(ios_base::fmtflags(0), __f._M_mask);
00084
return __os;
00085 }
00086
00087
00088
struct _Setiosflags { ios_base::fmtflags _M_mask; };
00089
00090
00091
00092
00093
00094
00095
00096
00097
inline _Setiosflags
00098 setiosflags(
ios_base::fmtflags __mask)
00099 {
00100 _Setiosflags __x;
00101 __x._M_mask = __mask;
00102
return __x;
00103 }
00104
00105
template<
typename _CharT,
typename _Traits>
00106
inline basic_istream<_CharT,_Traits>&
00107
operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
00108 {
00109 __is.setf(__f._M_mask);
00110
return __is;
00111 }
00112
00113
template<
typename _CharT,
typename _Traits>
00114
inline basic_ostream<_CharT,_Traits>&
00115 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
00116 {
00117 __os.setf(__f._M_mask);
00118
return __os;
00119 }
00120
00121
00122
struct _Setbase {
int _M_base; };
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
inline _Setbase
00133 setbase(
int __base)
00134 {
00135 _Setbase __x;
00136 __x._M_base = __base;
00137
return __x;
00138 }
00139
00140
template<
typename _CharT,
typename _Traits>
00141
inline basic_istream<_CharT,_Traits>&
00142
operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
00143 {
00144 __is.setf(__f._M_base == 8 ? ios_base::oct :
00145 __f._M_base == 10 ? ios_base::dec :
00146 __f._M_base == 16 ? ios_base::hex :
00147 ios_base::fmtflags(0), ios_base::basefield);
00148
return __is;
00149 }
00150
00151
template<
typename _CharT,
typename _Traits>
00152
inline basic_ostream<_CharT,_Traits>&
00153 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
00154 {
00155 __os.setf(__f._M_base == 8 ? ios_base::oct :
00156 __f._M_base == 10 ? ios_base::dec :
00157 __f._M_base == 16 ? ios_base::hex :
00158 ios_base::fmtflags(0), ios_base::basefield);
00159
return __os;
00160 }
00161
00162
00163
template<
typename _CharT>
00164
struct _Setfill { _CharT _M_c; };
00165
00166
00167
00168
00169
00170
00171
00172
00173
template<
typename _CharT>
00174
inline _Setfill<_CharT>
00175 setfill(_CharT __c)
00176 {
00177 _Setfill<_CharT> __x;
00178 __x._M_c = __c;
00179
return __x;
00180 }
00181
00182
template<
typename _CharT,
typename _Traits>
00183
inline basic_istream<_CharT,_Traits>&
00184
operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
00185 {
00186 __is.fill(__f._M_c);
00187
return __is;
00188 }
00189
00190
template<
typename _CharT,
typename _Traits>
00191
inline basic_ostream<_CharT,_Traits>&
00192 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
00193 {
00194 __os.fill(__f._M_c);
00195
return __os;
00196 }
00197
00198
00199
struct _Setprecision {
int _M_n; };
00200
00201
00202
00203
00204
00205
00206
00207
00208
inline _Setprecision
00209 setprecision(
int __n)
00210 {
00211 _Setprecision __x;
00212 __x._M_n = __n;
00213
return __x;
00214 }
00215
00216
template<
typename _CharT,
typename _Traits>
00217
inline basic_istream<_CharT,_Traits>&
00218
operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
00219 {
00220 __is.precision(__f._M_n);
00221
return __is;
00222 }
00223
00224
template<
typename _CharT,
typename _Traits>
00225
inline basic_ostream<_CharT,_Traits>&
00226 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
00227 {
00228 __os.precision(__f._M_n);
00229
return __os;
00230 }
00231
00232
00233
struct _Setw {
int _M_n; };
00234
00235
00236
00237
00238
00239
00240
00241
00242
inline _Setw
00243 setw(
int __n)
00244 {
00245 _Setw __x;
00246 __x._M_n = __n;
00247
return __x;
00248 }
00249
00250
template<
typename _CharT,
typename _Traits>
00251
inline basic_istream<_CharT,_Traits>&
00252
operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
00253 {
00254 __is.width(__f._M_n);
00255
return __is;
00256 }
00257
00258
template<
typename _CharT,
typename _Traits>
00259
inline basic_ostream<_CharT,_Traits>&
00260 operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
00261 {
00262 __os.width(__f._M_n);
00263
return __os;
00264 }
00265
00266
00267
00268
00269
#if _GLIBCPP_EXTERN_TEMPLATE
00270
extern template ostream& operator<<(ostream&, _Setfill<char>);
00271
extern template ostream&
operator<<(ostream&, _Setiosflags);
00272
extern template ostream&
operator<<(ostream&, _Resetiosflags);
00273
extern template ostream&
operator<<(ostream&, _Setbase);
00274
extern template ostream&
operator<<(ostream&, _Setprecision);
00275
extern template ostream&
operator<<(ostream&, _Setw);
00276
extern template istream&
operator>>(istream&, _Setfill<char>);
00277
extern template istream&
operator>>(istream&, _Setiosflags);
00278
extern template istream&
operator>>(istream&, _Resetiosflags);
00279
extern template istream&
operator>>(istream&, _Setbase);
00280
extern template istream&
operator>>(istream&, _Setprecision);
00281
extern template istream&
operator>>(istream&, _Setw);
00282
00283
#ifdef _GLIBCPP_USE_WCHAR_T
00284
extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
00285
extern template wostream&
operator<<(wostream&, _Setiosflags);
00286
extern template wostream&
operator<<(wostream&, _Resetiosflags);
00287
extern template wostream&
operator<<(wostream&, _Setbase);
00288
extern template wostream&
operator<<(wostream&, _Setprecision);
00289
extern template wostream&
operator<<(wostream&, _Setw);
00290
extern template wistream&
operator>>(wistream&, _Setfill<wchar_t>);
00291
extern template wistream&
operator>>(wistream&, _Setiosflags);
00292
extern template wistream&
operator>>(wistream&, _Resetiosflags);
00293
extern template wistream&
operator>>(wistream&, _Setbase);
00294
extern template wistream&
operator>>(wistream&, _Setprecision);
00295
extern template wistream&
operator>>(wistream&, _Setw);
00296
#endif
00297
#endif
00298
}
00299
00300
#endif