1 /* This is part of libio/iostream, providing -*- C++ -*- input/output. 2 Copyright (C) 1993 Free Software Foundation 3 4 This file is part of the GNU IO Library. This library is free 5 software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the 7 Free Software Foundation; either version 2, or (at your option) 8 any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this library; see the file COPYING. If not, write to the Free 17 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 As a special exception, if you link this library with files 20 compiled with a GNU compiler to produce an executable, this does not cause 21 the resulting executable to be covered by the GNU General Public License. 22 This exception does not however invalidate any other reasons why 23 the executable file might be covered by the GNU General Public License. */ 24 25 #ifdef __GNUG__ 26 #pragma implementation 27 #endif 28 29 #include "iomanip.h" 30 31 32 // Those functions are called through a pointer, 33 // thus it does not make sense, to inline them. 34 35 ios & __iomanip_setbase (ios& i, int n) 36 { 37 ios::fmtflags b; 38 switch (n) 39 { 40 case 8: 41 b = ios::oct; break; 42 case 10: 43 b = ios::dec; break; 44 case 16: 45 b = ios::hex; break; 46 default: 47 b = 0; 48 } 49 i.setf(b, ios::basefield); 50 return i; 51 } 52 53 ios & __iomanip_setfill (ios& i, int n) 54 { 55 //FIXME if ( i.flags() & ios::widechar ) 56 i.fill( (char) n); 57 //FIXME else 58 //FIXME i.fill( (wchar) n); 59 return i; 60 } 61 62 ios & __iomanip_setprecision (ios& i, int n) 63 { 64 i.precision(n); 65 return i; 66 } 67 ios & __iomanip_setw (ios& i, int n) 68 { 69 i.width(n); 70 return i; 71 } 72 73 ios & __iomanip_setiosflags (ios& i, ios::fmtflags n) 74 { 75 i.setf(n,n); 76 return i; 77 } 78 79 ios & __iomanip_resetiosflags (ios& i, ios::fmtflags n) 80 { 81 i.setf(0,n); 82 return i; 83 } 84 85 template class smanip<int>; 86 template class smanip<ios::fmtflags>; 87 template istream& operator>>(istream&, const smanip<int>&); 88 template istream& operator>>(istream&, const smanip<ios::fmtflags>&); 89 template ostream& operator<<(ostream&, const smanip<int>&); 90 template ostream& operator<<(ostream&, const smanip<ios::fmtflags>&); 91