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