Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5496 leency 1
// Standard stream manipulators -*- C++ -*-
2
 
3
// Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc.
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the
8
// Free Software Foundation; either version 2, or (at your option)
9
// any later version.
10
 
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
// GNU General Public License for more details.
15
 
16
// You should have received a copy of the GNU General Public License along
17
// with this library; see the file COPYING.  If not, write to the Free
18
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19
// USA.
20
 
21
// As a special exception, you may use this file as part of a free software
22
// library without restriction.  Specifically, if other files instantiate
23
// templates or use macros or inline functions from this file, or you compile
24
// this file and link it with other files to produce an executable, this
25
// file does not by itself cause the resulting executable to be covered by
26
// the GNU General Public License.  This exception does not however
27
// invalidate any other reasons why the executable file might be covered by
28
// the GNU General Public License.
29
 
30
//
31
// ISO C++ 14882: 27.6.3  Standard manipulators
32
//
33
 
34
#ifndef _CPP_IOMANIP
35
#define _CPP_IOMANIP 1
36
 
37
#pragma GCC system_header
38
 
39
#include 
40
#include 
41
#include 
42
 
43
namespace std
44
{
45
 
46
  struct _Resetiosflags { ios_base::fmtflags _M_mask; };
47
 
48
  inline _Resetiosflags
49
  resetiosflags(ios_base::fmtflags __mask)
50
  {
51
    _Resetiosflags __x;
52
    __x._M_mask = __mask;
53
    return __x;
54
  }
55
 
56
  template 
57
    basic_istream<_CharT,_Traits>&
58
    operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
59
    {
60
      __is.setf(ios_base::fmtflags(0), __f._M_mask);
61
      return __is;
62
    }
63
 
64
  template 
65
    basic_ostream<_CharT,_Traits>&
66
    operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
67
    {
68
      __os.setf(ios_base::fmtflags(0), __f._M_mask);
69
      return __os;
70
    }
71
 
72
 
73
  struct _Setiosflags { ios_base::fmtflags _M_mask; };
74
 
75
  inline _Setiosflags
76
  setiosflags (ios_base::fmtflags __mask)
77
  {
78
    _Setiosflags __x;
79
    __x._M_mask = __mask;
80
    return __x;
81
  }
82
 
83
  template 
84
    basic_istream<_CharT,_Traits>&
85
    operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
86
    {
87
      __is.setf(__f._M_mask);
88
      return __is;
89
    }
90
 
91
  template 
92
    basic_ostream<_CharT,_Traits>&
93
    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
94
    {
95
      __os.setf(__f._M_mask);
96
      return __os;
97
    }
98
 
99
 
100
  struct _Setbase { int _M_base; };
101
 
102
  inline _Setbase
103
  setbase (int __base)
104
  {
105
    _Setbase __x;
106
    __x._M_base = __base;
107
    return __x;
108
  }
109
 
110
  template 
111
    basic_istream<_CharT,_Traits>&
112
    operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
113
    {
114
      __is.setf(__f._M_base ==  8 ? ios_base::oct :
115
	      __f._M_base == 10 ? ios_base::dec :
116
	      __f._M_base == 16 ? ios_base::hex :
117
	      ios_base::fmtflags(0), ios_base::basefield);
118
      return __is;
119
    }
120
 
121
  template 
122
    basic_ostream<_CharT,_Traits>&
123
    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
124
    {
125
      __os.setf(__f._M_base ==  8 ? ios_base::oct :
126
		__f._M_base == 10 ? ios_base::dec :
127
		__f._M_base == 16 ? ios_base::hex :
128
		ios_base::fmtflags(0), ios_base::basefield);
129
      return __os;
130
    }
131
 
132
 
133
  template
134
    struct _Setfill { _CharT _M_c; };
135
 
136
  template
137
    _Setfill<_CharT>
138
    setfill(_CharT __c)
139
    {
140
      _Setfill<_CharT> __x;
141
      __x._M_c = __c;
142
      return __x;
143
    }
144
 
145
  template 
146
    basic_istream<_CharT,_Traits>&
147
    operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
148
    {
149
      __is.fill(__f._M_c);
150
      return __is;
151
    }
152
 
153
  template 
154
    basic_ostream<_CharT,_Traits>&
155
    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
156
    {
157
      __os.fill(__f._M_c);
158
      return __os;
159
    }
160
 
161
 
162
  struct _Setprecision { int _M_n; };
163
 
164
  inline _Setprecision
165
  setprecision(int __n)
166
  {
167
    _Setprecision __x;
168
    __x._M_n = __n;
169
    return __x;
170
  }
171
 
172
  template 
173
    basic_istream<_CharT,_Traits>&
174
    operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
175
    {
176
      __is.precision(__f._M_n);
177
      return __is;
178
    }
179
 
180
  template 
181
    basic_ostream<_CharT,_Traits>&
182
    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
183
    {
184
      __os.precision(__f._M_n);
185
      return __os;
186
    }
187
 
188
 
189
  struct _Setw { int _M_n; };
190
 
191
  inline _Setw
192
  setw(int __n)
193
  {
194
    _Setw __x;
195
    __x._M_n = __n;
196
    return __x;
197
  }
198
 
199
  template 
200
    basic_istream<_CharT,_Traits>&
201
    operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
202
    {
203
      __is.width(__f._M_n);
204
      return __is;
205
    }
206
 
207
  template 
208
    basic_ostream<_CharT,_Traits>&
209
    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
210
    {
211
      __os.width(__f._M_n);
212
      return __os;
213
    }
214
 
215
} // namespace std
216
 
217
#endif	/* __IOMANIP */
218