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 
00039 #ifndef _CPP_IOMANIP
00040 #define _CPP_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   struct _Resetiosflags { ios_base::fmtflags _M_mask; };
00051 
00052   inline _Resetiosflags 
00053   resetiosflags(ios_base::fmtflags __mask)
00054   { 
00055     _Resetiosflags __x; 
00056     __x._M_mask = __mask; 
00057     return __x; 
00058   }
00059 
00060   template<typename _CharT, typename _Traits>
00061     inline basic_istream<_CharT,_Traits>& 
00062     operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
00063     { 
00064       __is.setf(ios_base::fmtflags(0), __f._M_mask); 
00065       return __is; 
00066     }
00067 
00068   template<typename _CharT, typename _Traits>
00069     inline basic_ostream<_CharT,_Traits>& 
00070     operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
00071     { 
00072       __os.setf(ios_base::fmtflags(0), __f._M_mask); 
00073       return __os; 
00074     }
00075 
00076 
00077   struct _Setiosflags { ios_base::fmtflags _M_mask; };
00078 
00079   inline _Setiosflags 
00080   setiosflags(ios_base::fmtflags __mask)
00081   { 
00082     _Setiosflags __x; 
00083     __x._M_mask = __mask; 
00084     return __x; 
00085   }
00086 
00087   template<typename _CharT, typename _Traits>
00088     inline basic_istream<_CharT,_Traits>& 
00089     operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
00090     { 
00091       __is.setf(__f._M_mask); 
00092       return __is; 
00093     }
00094 
00095   template<typename _CharT, typename _Traits>
00096     inline basic_ostream<_CharT,_Traits>& 
00097     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
00098     { 
00099       __os.setf(__f._M_mask); 
00100       return __os; 
00101     }
00102 
00103 
00104   struct _Setbase { int _M_base; };
00105 
00106   inline _Setbase 
00107   setbase(int __base)
00108   { 
00109     _Setbase __x; 
00110     __x._M_base = __base; 
00111     return __x; 
00112   }
00113 
00114   template<typename _CharT, typename _Traits>
00115     inline basic_istream<_CharT,_Traits>& 
00116     operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
00117     {
00118       __is.setf(__f._M_base ==  8 ? ios_base::oct : 
00119           __f._M_base == 10 ? ios_base::dec : 
00120           __f._M_base == 16 ? ios_base::hex : 
00121           ios_base::fmtflags(0), ios_base::basefield);
00122       return __is; 
00123     }
00124   
00125   template<typename _CharT, typename _Traits>
00126     inline basic_ostream<_CharT,_Traits>& 
00127     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
00128     {
00129       __os.setf(__f._M_base ==  8 ? ios_base::oct : 
00130         __f._M_base == 10 ? ios_base::dec : 
00131         __f._M_base == 16 ? ios_base::hex : 
00132         ios_base::fmtflags(0), ios_base::basefield);
00133       return __os; 
00134     }
00135   
00136 
00137   template<typename _CharT> 
00138     struct _Setfill { _CharT _M_c; };
00139 
00140   template<typename _CharT> 
00141     inline _Setfill<_CharT> 
00142     setfill(_CharT __c)
00143     { 
00144       _Setfill<_CharT> __x; 
00145       __x._M_c = __c; 
00146       return __x; 
00147     }
00148 
00149   template<typename _CharT, typename _Traits>
00150     inline basic_istream<_CharT,_Traits>& 
00151     operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
00152     { 
00153       __is.fill(__f._M_c); 
00154       return __is; 
00155     }
00156 
00157   template<typename _CharT, typename _Traits>
00158     inline basic_ostream<_CharT,_Traits>& 
00159     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
00160     { 
00161       __os.fill(__f._M_c); 
00162       return __os; 
00163     }
00164 
00165 
00166   struct _Setprecision { int _M_n; };
00167 
00168   inline _Setprecision 
00169   setprecision(int __n)
00170   { 
00171     _Setprecision __x; 
00172     __x._M_n = __n; 
00173     return __x; 
00174   }
00175 
00176   template<typename _CharT, typename _Traits>
00177     inline basic_istream<_CharT,_Traits>& 
00178     operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
00179     { 
00180       __is.precision(__f._M_n); 
00181       return __is; 
00182     }
00183 
00184   template<typename _CharT, typename _Traits>
00185     inline basic_ostream<_CharT,_Traits>& 
00186     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
00187     { 
00188       __os.precision(__f._M_n); 
00189       return __os; 
00190     }
00191 
00192 
00193   struct _Setw { int _M_n; };
00194 
00195   inline _Setw 
00196   setw(int __n)
00197   { 
00198     _Setw __x; 
00199     __x._M_n = __n; 
00200     return __x; 
00201   }
00202 
00203   template<typename _CharT, typename _Traits>
00204     inline basic_istream<_CharT,_Traits>& 
00205     operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
00206     { 
00207       __is.width(__f._M_n); 
00208       return __is; 
00209     }
00210 
00211   template<typename _CharT, typename _Traits>
00212     inline basic_ostream<_CharT,_Traits>& 
00213     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
00214     { 
00215       __os.width(__f._M_n); 
00216       return __os; 
00217     }
00218 
00219   
00220   
00221   
00222   extern template ostream& operator<<(ostream&, _Setfill<char>);
00223   extern template ostream& operator<<(ostream&, _Setiosflags);
00224   extern template ostream& operator<<(ostream&, _Resetiosflags);
00225   extern template ostream& operator<<(ostream&, _Setbase);
00226   extern template ostream& operator<<(ostream&, _Setprecision);
00227   extern template ostream& operator<<(ostream&, _Setw);
00228   extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
00229   extern template wostream& operator<<(wostream&, _Setiosflags);
00230   extern template wostream& operator<<(wostream&, _Resetiosflags);
00231   extern template wostream& operator<<(wostream&, _Setbase);
00232   extern template wostream& operator<<(wostream&, _Setprecision);
00233   extern template wostream& operator<<(wostream&, _Setw);
00234 
00235   extern template istream& operator>>(istream&, _Setfill<char>);
00236   extern template istream& operator>>(istream&, _Setiosflags);
00237   extern template istream& operator>>(istream&, _Resetiosflags);
00238   extern template istream& operator>>(istream&, _Setbase);
00239   extern template istream& operator>>(istream&, _Setprecision);
00240   extern template istream& operator>>(istream&, _Setw);
00241   extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
00242   extern template wistream& operator>>(wistream&, _Setiosflags);
00243   extern template wistream& operator>>(wistream&, _Resetiosflags);
00244   extern template wistream& operator>>(wistream&, _Setbase);
00245   extern template wistream& operator>>(wistream&, _Setprecision);
00246   extern template wistream& operator>>(wistream&, _Setw);
00247 } 
00248 
00249 #endif