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 #ifndef _GLIBCXX_IOMANIP
00036 #define _GLIBCXX_IOMANIP 1
00037
00038 #pragma GCC system_header
00039
00040 #include <bits/c++config.h>
00041 #include <iosfwd>
00042 #include <bits/ios_base.h>
00043
00044 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00045 #include <locale>
00046 #endif
00047
00048 _GLIBCXX_BEGIN_NAMESPACE(std)
00049
00050
00051
00052
00053 struct _Resetiosflags { ios_base::fmtflags _M_mask; };
00054
00055
00056
00057
00058
00059
00060
00061
00062 inline _Resetiosflags
00063 resetiosflags(ios_base::fmtflags __mask)
00064 { return { __mask }; }
00065
00066 template<typename _CharT, typename _Traits>
00067 inline basic_istream<_CharT, _Traits>&
00068 operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
00069 {
00070 __is.setf(ios_base::fmtflags(0), __f._M_mask);
00071 return __is;
00072 }
00073
00074 template<typename _CharT, typename _Traits>
00075 inline basic_ostream<_CharT, _Traits>&
00076 operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
00077 {
00078 __os.setf(ios_base::fmtflags(0), __f._M_mask);
00079 return __os;
00080 }
00081
00082
00083 struct _Setiosflags { ios_base::fmtflags _M_mask; };
00084
00085
00086
00087
00088
00089
00090
00091
00092 inline _Setiosflags
00093 setiosflags(ios_base::fmtflags __mask)
00094 { return { __mask }; }
00095
00096 template<typename _CharT, typename _Traits>
00097 inline basic_istream<_CharT, _Traits>&
00098 operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
00099 {
00100 __is.setf(__f._M_mask);
00101 return __is;
00102 }
00103
00104 template<typename _CharT, typename _Traits>
00105 inline basic_ostream<_CharT, _Traits>&
00106 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
00107 {
00108 __os.setf(__f._M_mask);
00109 return __os;
00110 }
00111
00112
00113 struct _Setbase { int _M_base; };
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 inline _Setbase
00124 setbase(int __base)
00125 { return { __base }; }
00126
00127 template<typename _CharT, typename _Traits>
00128 inline basic_istream<_CharT, _Traits>&
00129 operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
00130 {
00131 __is.setf(__f._M_base == 8 ? ios_base::oct :
00132 __f._M_base == 10 ? ios_base::dec :
00133 __f._M_base == 16 ? ios_base::hex :
00134 ios_base::fmtflags(0), ios_base::basefield);
00135 return __is;
00136 }
00137
00138 template<typename _CharT, typename _Traits>
00139 inline basic_ostream<_CharT, _Traits>&
00140 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f)
00141 {
00142 __os.setf(__f._M_base == 8 ? ios_base::oct :
00143 __f._M_base == 10 ? ios_base::dec :
00144 __f._M_base == 16 ? ios_base::hex :
00145 ios_base::fmtflags(0), ios_base::basefield);
00146 return __os;
00147 }
00148
00149
00150 template<typename _CharT>
00151 struct _Setfill { _CharT _M_c; };
00152
00153
00154
00155
00156
00157
00158
00159
00160 template<typename _CharT>
00161 inline _Setfill<_CharT>
00162 setfill(_CharT __c)
00163 { return { __c }; }
00164
00165 template<typename _CharT, typename _Traits>
00166 inline basic_istream<_CharT, _Traits>&
00167 operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
00168 {
00169 __is.fill(__f._M_c);
00170 return __is;
00171 }
00172
00173 template<typename _CharT, typename _Traits>
00174 inline basic_ostream<_CharT, _Traits>&
00175 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f)
00176 {
00177 __os.fill(__f._M_c);
00178 return __os;
00179 }
00180
00181
00182 struct _Setprecision { int _M_n; };
00183
00184
00185
00186
00187
00188
00189
00190
00191 inline _Setprecision
00192 setprecision(int __n)
00193 { return { __n }; }
00194
00195 template<typename _CharT, typename _Traits>
00196 inline basic_istream<_CharT, _Traits>&
00197 operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
00198 {
00199 __is.precision(__f._M_n);
00200 return __is;
00201 }
00202
00203 template<typename _CharT, typename _Traits>
00204 inline basic_ostream<_CharT, _Traits>&
00205 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f)
00206 {
00207 __os.precision(__f._M_n);
00208 return __os;
00209 }
00210
00211
00212 struct _Setw { int _M_n; };
00213
00214
00215
00216
00217
00218
00219
00220
00221 inline _Setw
00222 setw(int __n)
00223 { return { __n }; }
00224
00225 template<typename _CharT, typename _Traits>
00226 inline basic_istream<_CharT, _Traits>&
00227 operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
00228 {
00229 __is.width(__f._M_n);
00230 return __is;
00231 }
00232
00233 template<typename _CharT, typename _Traits>
00234 inline basic_ostream<_CharT, _Traits>&
00235 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f)
00236 {
00237 __os.width(__f._M_n);
00238 return __os;
00239 }
00240
00241 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00242
00243 template<typename _MoneyT>
00244 struct _Get_money { _MoneyT& _M_mon; bool _M_intl; };
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254 template<typename _MoneyT>
00255 inline _Get_money<_MoneyT>
00256 get_money(_MoneyT& __mon, bool __intl = false)
00257 { return { __mon, __intl }; }
00258
00259 template<typename _CharT, typename _Traits, typename _MoneyT>
00260 basic_istream<_CharT, _Traits>&
00261 operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)
00262 {
00263 typedef istreambuf_iterator<_CharT, _Traits> _Iter;
00264 typedef money_get<_CharT, _Iter> _MoneyGet;
00265
00266 ios_base::iostate __err = ios_base::goodbit;
00267 const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
00268
00269 __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
00270 __is, __err, __f._M_mon);
00271
00272 if (ios_base::goodbit != __err)
00273 __is.setstate(__err);
00274
00275 return __is;
00276 }
00277
00278
00279 template<typename _MoneyT>
00280 struct _Put_money { const _MoneyT& _M_mon; bool _M_intl; };
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290 template<typename _MoneyT>
00291 inline _Put_money<_MoneyT>
00292 put_money(const _MoneyT& __mon, bool __intl = false)
00293 { return { __mon, __intl }; }
00294
00295 template<typename _CharT, typename _Traits, typename _MoneyT>
00296 basic_ostream<_CharT, _Traits>&
00297 operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f)
00298 {
00299 typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
00300 typedef money_put<_CharT, _Iter> _MoneyPut;
00301
00302 const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
00303 const _Iter __end = __mp.put(_Iter(__os.rdbuf()), __f._M_intl,
00304 __os, __os.fill(), __f._M_mon);
00305
00306 if (__end.failed())
00307 __os.setstate(ios_base::badbit);
00308
00309 return __os;
00310 }
00311
00312 #endif
00313
00314
00315
00316
00317 #if _GLIBCXX_EXTERN_TEMPLATE
00318 extern template ostream& operator<<(ostream&, _Setfill<char>);
00319 extern template ostream& operator<<(ostream&, _Setiosflags);
00320 extern template ostream& operator<<(ostream&, _Resetiosflags);
00321 extern template ostream& operator<<(ostream&, _Setbase);
00322 extern template ostream& operator<<(ostream&, _Setprecision);
00323 extern template ostream& operator<<(ostream&, _Setw);
00324 extern template istream& operator>>(istream&, _Setfill<char>);
00325 extern template istream& operator>>(istream&, _Setiosflags);
00326 extern template istream& operator>>(istream&, _Resetiosflags);
00327 extern template istream& operator>>(istream&, _Setbase);
00328 extern template istream& operator>>(istream&, _Setprecision);
00329 extern template istream& operator>>(istream&, _Setw);
00330
00331 #ifdef _GLIBCXX_USE_WCHAR_T
00332 extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
00333 extern template wostream& operator<<(wostream&, _Setiosflags);
00334 extern template wostream& operator<<(wostream&, _Resetiosflags);
00335 extern template wostream& operator<<(wostream&, _Setbase);
00336 extern template wostream& operator<<(wostream&, _Setprecision);
00337 extern template wostream& operator<<(wostream&, _Setw);
00338 extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
00339 extern template wistream& operator>>(wistream&, _Setiosflags);
00340 extern template wistream& operator>>(wistream&, _Resetiosflags);
00341 extern template wistream& operator>>(wistream&, _Setbase);
00342 extern template wistream& operator>>(wistream&, _Setprecision);
00343 extern template wistream& operator>>(wistream&, _Setw);
00344 #endif
00345 #endif
00346
00347 _GLIBCXX_END_NAMESPACE
00348
00349 #endif