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 
00039 #ifndef _GLIBCXX_IOMANIP
00040 #define _GLIBCXX_IOMANIP 1
00041 
00042 #pragma GCC system_header
00043 
00044 #include <bits/c++config.h>
00045 #include <istream>
00046 #include <functional>
00047 
00048 namespace std
00049 {
00050   
00051   
00052 
00053   struct _Resetiosflags { ios_base::fmtflags _M_mask; };
00054 
00062   inline _Resetiosflags 
00063   resetiosflags(ios_base::fmtflags __mask)
00064   { 
00065     _Resetiosflags __x; 
00066     __x._M_mask = __mask; 
00067     return __x; 
00068   }
00069 
00070   template<typename _CharT, typename _Traits>
00071     inline basic_istream<_CharT,_Traits>& 
00072     operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
00073     { 
00074       __is.setf(ios_base::fmtflags(0), __f._M_mask); 
00075       return __is; 
00076     }
00077 
00078   template<typename _CharT, typename _Traits>
00079     inline basic_ostream<_CharT,_Traits>& 
00080     operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
00081     { 
00082       __os.setf(ios_base::fmtflags(0), __f._M_mask); 
00083       return __os; 
00084     }
00085 
00086 
00087   struct _Setiosflags { ios_base::fmtflags _M_mask; };
00088 
00096   inline _Setiosflags 
00097   setiosflags(ios_base::fmtflags __mask)
00098   { 
00099     _Setiosflags __x; 
00100     __x._M_mask = __mask; 
00101     return __x; 
00102   }
00103 
00104   template<typename _CharT, typename _Traits>
00105     inline basic_istream<_CharT,_Traits>& 
00106     operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
00107     { 
00108       __is.setf(__f._M_mask); 
00109       return __is; 
00110     }
00111 
00112   template<typename _CharT, typename _Traits>
00113     inline basic_ostream<_CharT,_Traits>& 
00114     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
00115     { 
00116       __os.setf(__f._M_mask); 
00117       return __os; 
00118     }
00119 
00120 
00121   struct _Setbase { int _M_base; };
00122 
00131   inline _Setbase 
00132   setbase(int __base)
00133   { 
00134     _Setbase __x; 
00135     __x._M_base = __base; 
00136     return __x; 
00137   }
00138 
00139   template<typename _CharT, typename _Traits>
00140     inline basic_istream<_CharT,_Traits>& 
00141     operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
00142     {
00143       __is.setf(__f._M_base ==  8 ? ios_base::oct : 
00144           __f._M_base == 10 ? ios_base::dec : 
00145           __f._M_base == 16 ? ios_base::hex : 
00146           ios_base::fmtflags(0), ios_base::basefield);
00147       return __is; 
00148     }
00149   
00150   template<typename _CharT, typename _Traits>
00151     inline basic_ostream<_CharT,_Traits>& 
00152     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
00153     {
00154       __os.setf(__f._M_base ==  8 ? ios_base::oct : 
00155         __f._M_base == 10 ? ios_base::dec : 
00156         __f._M_base == 16 ? ios_base::hex : 
00157         ios_base::fmtflags(0), ios_base::basefield);
00158       return __os; 
00159     }
00160   
00161 
00162   template<typename _CharT> 
00163     struct _Setfill { _CharT _M_c; };
00164 
00172   template<typename _CharT> 
00173     inline _Setfill<_CharT> 
00174     setfill(_CharT __c)
00175     { 
00176       _Setfill<_CharT> __x; 
00177       __x._M_c = __c; 
00178       return __x; 
00179     }
00180 
00181   template<typename _CharT, typename _Traits>
00182     inline basic_istream<_CharT,_Traits>& 
00183     operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
00184     { 
00185       __is.fill(__f._M_c); 
00186       return __is; 
00187     }
00188 
00189   template<typename _CharT, typename _Traits>
00190     inline basic_ostream<_CharT,_Traits>& 
00191     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
00192     { 
00193       __os.fill(__f._M_c); 
00194       return __os; 
00195     }
00196 
00197 
00198   struct _Setprecision { int _M_n; };
00199 
00207   inline _Setprecision 
00208   setprecision(int __n)
00209   { 
00210     _Setprecision __x; 
00211     __x._M_n = __n; 
00212     return __x; 
00213   }
00214 
00215   template<typename _CharT, typename _Traits>
00216     inline basic_istream<_CharT,_Traits>& 
00217     operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
00218     { 
00219       __is.precision(__f._M_n); 
00220       return __is; 
00221     }
00222 
00223   template<typename _CharT, typename _Traits>
00224     inline basic_ostream<_CharT,_Traits>& 
00225     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
00226     { 
00227       __os.precision(__f._M_n); 
00228       return __os; 
00229     }
00230 
00231 
00232   struct _Setw { int _M_n; };
00233 
00241   inline _Setw 
00242   setw(int __n)
00243   { 
00244     _Setw __x; 
00245     __x._M_n = __n; 
00246     return __x; 
00247   }
00248 
00249   template<typename _CharT, typename _Traits>
00250     inline basic_istream<_CharT,_Traits>& 
00251     operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
00252     { 
00253       __is.width(__f._M_n); 
00254       return __is; 
00255     }
00256 
00257   template<typename _CharT, typename _Traits>
00258     inline basic_ostream<_CharT,_Traits>& 
00259     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
00260     { 
00261       __os.width(__f._M_n); 
00262       return __os; 
00263     }
00264 
00265   
00266   
00267   
00268 #if _GLIBCXX_EXTERN_TEMPLATE
00269   extern template ostream& operator<<(ostream&, _Setfill<char>);
00270   extern template ostream& operator<<(ostream&, _Setiosflags);
00271   extern template ostream& operator<<(ostream&, _Resetiosflags);
00272   extern template ostream& operator<<(ostream&, _Setbase);
00273   extern template ostream& operator<<(ostream&, _Setprecision);
00274   extern template ostream& operator<<(ostream&, _Setw);
00275   extern template istream& operator>>(istream&, _Setfill<char>);
00276   extern template istream& operator>>(istream&, _Setiosflags);
00277   extern template istream& operator>>(istream&, _Resetiosflags);
00278   extern template istream& operator>>(istream&, _Setbase);
00279   extern template istream& operator>>(istream&, _Setprecision);
00280   extern template istream& operator>>(istream&, _Setw);
00281 
00282 #ifdef _GLIBCXX_USE_WCHAR_T
00283   extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
00284   extern template wostream& operator<<(wostream&, _Setiosflags);
00285   extern template wostream& operator<<(wostream&, _Resetiosflags);
00286   extern template wostream& operator<<(wostream&, _Setbase);
00287   extern template wostream& operator<<(wostream&, _Setprecision);
00288   extern template wostream& operator<<(wostream&, _Setw);
00289   extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
00290   extern template wistream& operator>>(wistream&, _Setiosflags);
00291   extern template wistream& operator>>(wistream&, _Resetiosflags);
00292   extern template wistream& operator>>(wistream&, _Setbase);
00293   extern template wistream& operator>>(wistream&, _Setprecision);
00294   extern template wistream& operator>>(wistream&, _Setw);
00295 #endif
00296 #endif
00297 } 
00298 
00299 #endif