1/* This is part of libio/iostream, providing -*- C++ -*- input/output.
2Copyright (C) 1993 Free Software Foundation
3
4This file is part of the GNU IO Library.  This library is free
5software; you can redistribute it and/or modify it under the
6terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option)
8any later version.
9
10This library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this library; see the file COPYING.  If not, write to the Free
17Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19As a special exception, if you link this library with files
20compiled with a GNU compiler to produce an executable, this does not cause
21the resulting executable to be covered by the GNU General Public License.
22This exception does not however invalidate any other reasons why
23the 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
35ios & __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
53ios & __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
62ios &  __iomanip_setprecision (ios& i, int n)
63{
64    i.precision(n);
65    return i;
66}
67ios &  __iomanip_setw (ios& i, int n)
68{
69    i.width(n);
70    return i;
71}
72
73ios & __iomanip_setiosflags (ios& i, ios::fmtflags n)
74{
75    i.setf(n,n);
76    return i;
77}
78
79ios & __iomanip_resetiosflags (ios& i, ios::fmtflags n)
80{
81    i.setf(0,n);
82    return i;
83}
84
85template class smanip<int>;
86template class smanip<ios::fmtflags>;
87template istream& operator>>(istream&, const smanip<int>&);
88template istream& operator>>(istream&, const smanip<ios::fmtflags>&);
89template ostream& operator<<(ostream&, const smanip<int>&);
90template ostream& operator<<(ostream&, const smanip<ios::fmtflags>&);
91