xref: /openbsd-src/gnu/gcc/libstdc++-v3/include/bits/ios_base.h (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1*404b540aSrobert // Iostreams base classes -*- C++ -*-
2*404b540aSrobert 
3*404b540aSrobert // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
4*404b540aSrobert // Free Software Foundation, Inc.
5*404b540aSrobert //
6*404b540aSrobert // This file is part of the GNU ISO C++ Library.  This library is free
7*404b540aSrobert // software; you can redistribute it and/or modify it under the
8*404b540aSrobert // terms of the GNU General Public License as published by the
9*404b540aSrobert // Free Software Foundation; either version 2, or (at your option)
10*404b540aSrobert // any later version.
11*404b540aSrobert 
12*404b540aSrobert // This library is distributed in the hope that it will be useful,
13*404b540aSrobert // but WITHOUT ANY WARRANTY; without even the implied warranty of
14*404b540aSrobert // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*404b540aSrobert // GNU General Public License for more details.
16*404b540aSrobert 
17*404b540aSrobert // You should have received a copy of the GNU General Public License along
18*404b540aSrobert // with this library; see the file COPYING.  If not, write to the Free
19*404b540aSrobert // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20*404b540aSrobert // USA.
21*404b540aSrobert 
22*404b540aSrobert // As a special exception, you may use this file as part of a free software
23*404b540aSrobert // library without restriction.  Specifically, if other files instantiate
24*404b540aSrobert // templates or use macros or inline functions from this file, or you compile
25*404b540aSrobert // this file and link it with other files to produce an executable, this
26*404b540aSrobert // file does not by itself cause the resulting executable to be covered by
27*404b540aSrobert // the GNU General Public License.  This exception does not however
28*404b540aSrobert // invalidate any other reasons why the executable file might be covered by
29*404b540aSrobert // the GNU General Public License.
30*404b540aSrobert 
31*404b540aSrobert /** @file ios_base.h
32*404b540aSrobert  *  This is an internal header file, included by other library headers.
33*404b540aSrobert  *  You should not attempt to use it directly.
34*404b540aSrobert  */
35*404b540aSrobert 
36*404b540aSrobert //
37*404b540aSrobert // ISO C++ 14882: 27.4  Iostreams base classes
38*404b540aSrobert //
39*404b540aSrobert 
40*404b540aSrobert #ifndef _IOS_BASE_H
41*404b540aSrobert #define _IOS_BASE_H 1
42*404b540aSrobert 
43*404b540aSrobert #pragma GCC system_header
44*404b540aSrobert 
45*404b540aSrobert #include <ext/atomicity.h>
46*404b540aSrobert #include <bits/localefwd.h>
47*404b540aSrobert #include <bits/locale_classes.h>
48*404b540aSrobert 
49*404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(std)
50*404b540aSrobert 
51*404b540aSrobert   // The following definitions of bitmask types are enums, not ints,
52*404b540aSrobert   // as permitted (but not required) in the standard, in order to provide
53*404b540aSrobert   // better type safety in iostream calls.  A side effect is that
54*404b540aSrobert   // expressions involving them are no longer compile-time constants.
55*404b540aSrobert   enum _Ios_Fmtflags
56*404b540aSrobert     {
57*404b540aSrobert       _S_boolalpha 	= 1L << 0,
58*404b540aSrobert       _S_dec 		= 1L << 1,
59*404b540aSrobert       _S_fixed 		= 1L << 2,
60*404b540aSrobert       _S_hex 		= 1L << 3,
61*404b540aSrobert       _S_internal 	= 1L << 4,
62*404b540aSrobert       _S_left 		= 1L << 5,
63*404b540aSrobert       _S_oct 		= 1L << 6,
64*404b540aSrobert       _S_right 		= 1L << 7,
65*404b540aSrobert       _S_scientific 	= 1L << 8,
66*404b540aSrobert       _S_showbase 	= 1L << 9,
67*404b540aSrobert       _S_showpoint 	= 1L << 10,
68*404b540aSrobert       _S_showpos 	= 1L << 11,
69*404b540aSrobert       _S_skipws 	= 1L << 12,
70*404b540aSrobert       _S_unitbuf 	= 1L << 13,
71*404b540aSrobert       _S_uppercase 	= 1L << 14,
72*404b540aSrobert       _S_adjustfield 	= _S_left | _S_right | _S_internal,
73*404b540aSrobert       _S_basefield 	= _S_dec | _S_oct | _S_hex,
74*404b540aSrobert       _S_floatfield 	= _S_scientific | _S_fixed,
75*404b540aSrobert       _S_ios_fmtflags_end = 1L << 16
76*404b540aSrobert     };
77*404b540aSrobert 
78*404b540aSrobert   inline _Ios_Fmtflags
79*404b540aSrobert   operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
80*404b540aSrobert   { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
81*404b540aSrobert 
82*404b540aSrobert   inline _Ios_Fmtflags
83*404b540aSrobert   operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
84*404b540aSrobert   { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
85*404b540aSrobert 
86*404b540aSrobert   inline _Ios_Fmtflags
87*404b540aSrobert   operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
88*404b540aSrobert   { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
89*404b540aSrobert 
90*404b540aSrobert   inline _Ios_Fmtflags&
91*404b540aSrobert   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
92*404b540aSrobert   { return __a = __a | __b; }
93*404b540aSrobert 
94*404b540aSrobert   inline _Ios_Fmtflags&
95*404b540aSrobert   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
96*404b540aSrobert   { return __a = __a & __b; }
97*404b540aSrobert 
98*404b540aSrobert   inline _Ios_Fmtflags&
99*404b540aSrobert   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
100*404b540aSrobert   { return __a = __a ^ __b; }
101*404b540aSrobert 
102*404b540aSrobert   inline _Ios_Fmtflags
103*404b540aSrobert   operator~(_Ios_Fmtflags __a)
104*404b540aSrobert   { return _Ios_Fmtflags(~static_cast<int>(__a)); }
105*404b540aSrobert 
106*404b540aSrobert 
107*404b540aSrobert   enum _Ios_Openmode
108*404b540aSrobert     {
109*404b540aSrobert       _S_app 		= 1L << 0,
110*404b540aSrobert       _S_ate 		= 1L << 1,
111*404b540aSrobert       _S_bin 		= 1L << 2,
112*404b540aSrobert       _S_in 		= 1L << 3,
113*404b540aSrobert       _S_out 		= 1L << 4,
114*404b540aSrobert       _S_trunc 		= 1L << 5,
115*404b540aSrobert       _S_ios_openmode_end = 1L << 16
116*404b540aSrobert     };
117*404b540aSrobert 
118*404b540aSrobert   inline _Ios_Openmode
119*404b540aSrobert   operator&(_Ios_Openmode __a, _Ios_Openmode __b)
120*404b540aSrobert   { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
121*404b540aSrobert 
122*404b540aSrobert   inline _Ios_Openmode
123*404b540aSrobert   operator|(_Ios_Openmode __a, _Ios_Openmode __b)
124*404b540aSrobert   { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
125*404b540aSrobert 
126*404b540aSrobert   inline _Ios_Openmode
127*404b540aSrobert   operator^(_Ios_Openmode __a, _Ios_Openmode __b)
128*404b540aSrobert   { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
129*404b540aSrobert 
130*404b540aSrobert   inline _Ios_Openmode&
131*404b540aSrobert   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
132*404b540aSrobert   { return __a = __a | __b; }
133*404b540aSrobert 
134*404b540aSrobert   inline _Ios_Openmode&
135*404b540aSrobert   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
136*404b540aSrobert   { return __a = __a & __b; }
137*404b540aSrobert 
138*404b540aSrobert   inline _Ios_Openmode&
139*404b540aSrobert   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
140*404b540aSrobert   { return __a = __a ^ __b; }
141*404b540aSrobert 
142*404b540aSrobert   inline _Ios_Openmode
143*404b540aSrobert   operator~(_Ios_Openmode __a)
144*404b540aSrobert   { return _Ios_Openmode(~static_cast<int>(__a)); }
145*404b540aSrobert 
146*404b540aSrobert 
147*404b540aSrobert   enum _Ios_Iostate
148*404b540aSrobert     {
149*404b540aSrobert       _S_goodbit 		= 0,
150*404b540aSrobert       _S_badbit 		= 1L << 0,
151*404b540aSrobert       _S_eofbit 		= 1L << 1,
152*404b540aSrobert       _S_failbit		= 1L << 2,
153*404b540aSrobert       _S_ios_iostate_end = 1L << 16
154*404b540aSrobert     };
155*404b540aSrobert 
156*404b540aSrobert   inline _Ios_Iostate
157*404b540aSrobert   operator&(_Ios_Iostate __a, _Ios_Iostate __b)
158*404b540aSrobert   { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
159*404b540aSrobert 
160*404b540aSrobert   inline _Ios_Iostate
161*404b540aSrobert   operator|(_Ios_Iostate __a, _Ios_Iostate __b)
162*404b540aSrobert   { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
163*404b540aSrobert 
164*404b540aSrobert   inline _Ios_Iostate
165*404b540aSrobert   operator^(_Ios_Iostate __a, _Ios_Iostate __b)
166*404b540aSrobert   { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
167*404b540aSrobert 
168*404b540aSrobert   inline _Ios_Iostate&
169*404b540aSrobert   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
170*404b540aSrobert   { return __a = __a | __b; }
171*404b540aSrobert 
172*404b540aSrobert   inline _Ios_Iostate&
173*404b540aSrobert   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
174*404b540aSrobert   { return __a = __a & __b; }
175*404b540aSrobert 
176*404b540aSrobert   inline _Ios_Iostate&
177*404b540aSrobert   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
178*404b540aSrobert   { return __a = __a ^ __b; }
179*404b540aSrobert 
180*404b540aSrobert   inline _Ios_Iostate
181*404b540aSrobert   operator~(_Ios_Iostate __a)
182*404b540aSrobert   { return _Ios_Iostate(~static_cast<int>(__a)); }
183*404b540aSrobert 
184*404b540aSrobert   enum _Ios_Seekdir
185*404b540aSrobert     {
186*404b540aSrobert       _S_beg = 0,
187*404b540aSrobert       _S_cur = SEEK_CUR,
188*404b540aSrobert       _S_end = SEEK_END,
189*404b540aSrobert       _S_ios_seekdir_end = 1L << 16
190*404b540aSrobert     };
191*404b540aSrobert 
192*404b540aSrobert   // 27.4.2  Class ios_base
193*404b540aSrobert   /**
194*404b540aSrobert    *  @brief  The base of the I/O class hierarchy.
195*404b540aSrobert    *
196*404b540aSrobert    *  This class defines everything that can be defined about I/O that does
197*404b540aSrobert    *  not depend on the type of characters being input or output.  Most
198*404b540aSrobert    *  people will only see @c ios_base when they need to specify the full
199*404b540aSrobert    *  name of the various I/O flags (e.g., the openmodes).
200*404b540aSrobert   */
201*404b540aSrobert   class ios_base
202*404b540aSrobert   {
203*404b540aSrobert   public:
204*404b540aSrobert 
205*404b540aSrobert     // 27.4.2.1.1  Class ios_base::failure
206*404b540aSrobert     /// These are thrown to indicate problems.  Doc me.
207*404b540aSrobert     class failure : public exception
208*404b540aSrobert     {
209*404b540aSrobert     public:
210*404b540aSrobert       // _GLIBCXX_RESOLVE_LIB_DEFECTS
211*404b540aSrobert       // 48.  Use of non-existent exception constructor
212*404b540aSrobert       explicit
213*404b540aSrobert       failure(const string& __str) throw();
214*404b540aSrobert 
215*404b540aSrobert       // This declaration is not useless:
216*404b540aSrobert       // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
217*404b540aSrobert       virtual
218*404b540aSrobert       ~failure() throw();
219*404b540aSrobert 
220*404b540aSrobert       virtual const char*
221*404b540aSrobert       what() const throw();
222*404b540aSrobert 
223*404b540aSrobert     private:
224*404b540aSrobert       string _M_msg;
225*404b540aSrobert     };
226*404b540aSrobert 
227*404b540aSrobert     // 27.4.2.1.2  Type ios_base::fmtflags
228*404b540aSrobert     /**
229*404b540aSrobert      *  @brief This is a bitmask type.
230*404b540aSrobert      *
231*404b540aSrobert      *  @c "_Ios_Fmtflags" is implementation-defined, but it is valid to
232*404b540aSrobert      *  perform bitwise operations on these values and expect the Right
233*404b540aSrobert      *  Thing to happen.  Defined objects of type fmtflags are:
234*404b540aSrobert      *  - boolalpha
235*404b540aSrobert      *  - dec
236*404b540aSrobert      *  - fixed
237*404b540aSrobert      *  - hex
238*404b540aSrobert      *  - internal
239*404b540aSrobert      *  - left
240*404b540aSrobert      *  - oct
241*404b540aSrobert      *  - right
242*404b540aSrobert      *  - scientific
243*404b540aSrobert      *  - showbase
244*404b540aSrobert      *  - showpoint
245*404b540aSrobert      *  - showpos
246*404b540aSrobert      *  - skipws
247*404b540aSrobert      *  - unitbuf
248*404b540aSrobert      *  - uppercase
249*404b540aSrobert      *  - adjustfield
250*404b540aSrobert      *  - basefield
251*404b540aSrobert      *  - floatfield
252*404b540aSrobert     */
253*404b540aSrobert     typedef _Ios_Fmtflags fmtflags;
254*404b540aSrobert 
255*404b540aSrobert     /// Insert/extract @c bool in alphabetic rather than numeric format.
256*404b540aSrobert     static const fmtflags boolalpha =   _S_boolalpha;
257*404b540aSrobert 
258*404b540aSrobert     /// Converts integer input or generates integer output in decimal base.
259*404b540aSrobert     static const fmtflags dec =         _S_dec;
260*404b540aSrobert 
261*404b540aSrobert     /// Generate floating-point output in fixed-point notation.
262*404b540aSrobert     static const fmtflags fixed =       _S_fixed;
263*404b540aSrobert 
264*404b540aSrobert     /// Converts integer input or generates integer output in hexadecimal base.
265*404b540aSrobert     static const fmtflags hex =         _S_hex;
266*404b540aSrobert 
267*404b540aSrobert     /// Adds fill characters at a designated internal point in certain
268*404b540aSrobert     /// generated output, or identical to @c right if no such point is
269*404b540aSrobert     /// designated.
270*404b540aSrobert     static const fmtflags internal =    _S_internal;
271*404b540aSrobert 
272*404b540aSrobert     /// Adds fill characters on the right (final positions) of certain
273*404b540aSrobert     /// generated output.  (I.e., the thing you print is flush left.)
274*404b540aSrobert     static const fmtflags left =        _S_left;
275*404b540aSrobert 
276*404b540aSrobert     /// Converts integer input or generates integer output in octal base.
277*404b540aSrobert     static const fmtflags oct =         _S_oct;
278*404b540aSrobert 
279*404b540aSrobert     /// Adds fill characters on the left (initial positions) of certain
280*404b540aSrobert     /// generated output.  (I.e., the thing you print is flush right.)
281*404b540aSrobert     static const fmtflags right =       _S_right;
282*404b540aSrobert 
283*404b540aSrobert     /// Generates floating-point output in scientific notation.
284*404b540aSrobert     static const fmtflags scientific =  _S_scientific;
285*404b540aSrobert 
286*404b540aSrobert     /// Generates a prefix indicating the numeric base of generated integer
287*404b540aSrobert     /// output.
288*404b540aSrobert     static const fmtflags showbase =    _S_showbase;
289*404b540aSrobert 
290*404b540aSrobert     /// Generates a decimal-point character unconditionally in generated
291*404b540aSrobert     /// floating-point output.
292*404b540aSrobert     static const fmtflags showpoint =   _S_showpoint;
293*404b540aSrobert 
294*404b540aSrobert     /// Generates a + sign in non-negative generated numeric output.
295*404b540aSrobert     static const fmtflags showpos =     _S_showpos;
296*404b540aSrobert 
297*404b540aSrobert     /// Skips leading white space before certain input operations.
298*404b540aSrobert     static const fmtflags skipws =      _S_skipws;
299*404b540aSrobert 
300*404b540aSrobert     /// Flushes output after each output operation.
301*404b540aSrobert     static const fmtflags unitbuf =     _S_unitbuf;
302*404b540aSrobert 
303*404b540aSrobert     /// Replaces certain lowercase letters with their uppercase equivalents
304*404b540aSrobert     /// in generated output.
305*404b540aSrobert     static const fmtflags uppercase =   _S_uppercase;
306*404b540aSrobert 
307*404b540aSrobert     /// A mask of left|right|internal.  Useful for the 2-arg form of @c setf.
308*404b540aSrobert     static const fmtflags adjustfield = _S_adjustfield;
309*404b540aSrobert 
310*404b540aSrobert     /// A mask of dec|oct|hex.  Useful for the 2-arg form of @c setf.
311*404b540aSrobert     static const fmtflags basefield =   _S_basefield;
312*404b540aSrobert 
313*404b540aSrobert     /// A mask of scientific|fixed.  Useful for the 2-arg form of @c setf.
314*404b540aSrobert     static const fmtflags floatfield =  _S_floatfield;
315*404b540aSrobert 
316*404b540aSrobert     // 27.4.2.1.3  Type ios_base::iostate
317*404b540aSrobert     /**
318*404b540aSrobert      *  @brief This is a bitmask type.
319*404b540aSrobert      *
320*404b540aSrobert      *  @c "_Ios_Iostate" is implementation-defined, but it is valid to
321*404b540aSrobert      *  perform bitwise operations on these values and expect the Right
322*404b540aSrobert      *  Thing to happen.  Defined objects of type iostate are:
323*404b540aSrobert      *  - badbit
324*404b540aSrobert      *  - eofbit
325*404b540aSrobert      *  - failbit
326*404b540aSrobert      *  - goodbit
327*404b540aSrobert     */
328*404b540aSrobert     typedef _Ios_Iostate iostate;
329*404b540aSrobert 
330*404b540aSrobert     /// Indicates a loss of integrity in an input or output sequence (such
331*404b540aSrobert     /// as an irrecoverable read error from a file).
332*404b540aSrobert     static const iostate badbit =	_S_badbit;
333*404b540aSrobert 
334*404b540aSrobert     /// Indicates that an input operation reached the end of an input sequence.
335*404b540aSrobert     static const iostate eofbit =	_S_eofbit;
336*404b540aSrobert 
337*404b540aSrobert     /// Indicates that an input operation failed to read the expected
338*404b540aSrobert     /// characters, or that an output operation failed to generate the
339*404b540aSrobert     /// desired characters.
340*404b540aSrobert     static const iostate failbit =	_S_failbit;
341*404b540aSrobert 
342*404b540aSrobert     /// Indicates all is well.
343*404b540aSrobert     static const iostate goodbit =	_S_goodbit;
344*404b540aSrobert 
345*404b540aSrobert     // 27.4.2.1.4  Type ios_base::openmode
346*404b540aSrobert     /**
347*404b540aSrobert      *  @brief This is a bitmask type.
348*404b540aSrobert      *
349*404b540aSrobert      *  @c "_Ios_Openmode" is implementation-defined, but it is valid to
350*404b540aSrobert      *  perform bitwise operations on these values and expect the Right
351*404b540aSrobert      *  Thing to happen.  Defined objects of type openmode are:
352*404b540aSrobert      *  - app
353*404b540aSrobert      *  - ate
354*404b540aSrobert      *  - binary
355*404b540aSrobert      *  - in
356*404b540aSrobert      *  - out
357*404b540aSrobert      *  - trunc
358*404b540aSrobert     */
359*404b540aSrobert     typedef _Ios_Openmode openmode;
360*404b540aSrobert 
361*404b540aSrobert     /// Seek to end before each write.
362*404b540aSrobert     static const openmode app =		_S_app;
363*404b540aSrobert 
364*404b540aSrobert     /// Open and seek to end immediately after opening.
365*404b540aSrobert     static const openmode ate =		_S_ate;
366*404b540aSrobert 
367*404b540aSrobert     /// Perform input and output in binary mode (as opposed to text mode).
368*404b540aSrobert     /// This is probably not what you think it is; see
369*404b540aSrobert     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and
370*404b540aSrobert     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.
371*404b540aSrobert     static const openmode binary =	_S_bin;
372*404b540aSrobert 
373*404b540aSrobert     /// Open for input.  Default for @c ifstream and fstream.
374*404b540aSrobert     static const openmode in =		_S_in;
375*404b540aSrobert 
376*404b540aSrobert     /// Open for output.  Default for @c ofstream and fstream.
377*404b540aSrobert     static const openmode out =		_S_out;
378*404b540aSrobert 
379*404b540aSrobert     /// Open for input.  Default for @c ofstream.
380*404b540aSrobert     static const openmode trunc =	_S_trunc;
381*404b540aSrobert 
382*404b540aSrobert     // 27.4.2.1.5  Type ios_base::seekdir
383*404b540aSrobert     /**
384*404b540aSrobert      *  @brief This is an enumerated type.
385*404b540aSrobert      *
386*404b540aSrobert      *  @c "_Ios_Seekdir" is implementation-defined.  Defined values
387*404b540aSrobert      *  of type seekdir are:
388*404b540aSrobert      *  - beg
389*404b540aSrobert      *  - cur, equivalent to @c SEEK_CUR in the C standard library.
390*404b540aSrobert      *  - end, equivalent to @c SEEK_END in the C standard library.
391*404b540aSrobert     */
392*404b540aSrobert     typedef _Ios_Seekdir seekdir;
393*404b540aSrobert 
394*404b540aSrobert     /// Request a seek relative to the beginning of the stream.
395*404b540aSrobert     static const seekdir beg =		_S_beg;
396*404b540aSrobert 
397*404b540aSrobert     /// Request a seek relative to the current position within the sequence.
398*404b540aSrobert     static const seekdir cur =		_S_cur;
399*404b540aSrobert 
400*404b540aSrobert     /// Request a seek relative to the current end of the sequence.
401*404b540aSrobert     static const seekdir end =		_S_end;
402*404b540aSrobert 
403*404b540aSrobert     // Annex D.6
404*404b540aSrobert     typedef int io_state;
405*404b540aSrobert     typedef int open_mode;
406*404b540aSrobert     typedef int seek_dir;
407*404b540aSrobert 
408*404b540aSrobert     typedef std::streampos streampos;
409*404b540aSrobert     typedef std::streamoff streamoff;
410*404b540aSrobert 
411*404b540aSrobert     // Callbacks;
412*404b540aSrobert     /**
413*404b540aSrobert      *  @brief  The set of events that may be passed to an event callback.
414*404b540aSrobert      *
415*404b540aSrobert      *  erase_event is used during ~ios() and copyfmt().  imbue_event is used
416*404b540aSrobert      *  during imbue().  copyfmt_event is used during copyfmt().
417*404b540aSrobert     */
418*404b540aSrobert     enum event
419*404b540aSrobert     {
420*404b540aSrobert       erase_event,
421*404b540aSrobert       imbue_event,
422*404b540aSrobert       copyfmt_event
423*404b540aSrobert     };
424*404b540aSrobert 
425*404b540aSrobert     /**
426*404b540aSrobert      *  @brief  The type of an event callback function.
427*404b540aSrobert      *  @param  event  One of the members of the event enum.
428*404b540aSrobert      *  @param  ios_base  Reference to the ios_base object.
429*404b540aSrobert      *  @param  int  The integer provided when the callback was registered.
430*404b540aSrobert      *
431*404b540aSrobert      *  Event callbacks are user defined functions that get called during
432*404b540aSrobert      *  several ios_base and basic_ios functions, specifically imbue(),
433*404b540aSrobert      *  copyfmt(), and ~ios().
434*404b540aSrobert     */
435*404b540aSrobert     typedef void (*event_callback) (event, ios_base&, int);
436*404b540aSrobert 
437*404b540aSrobert     /**
438*404b540aSrobert      *  @brief  Add the callback __fn with parameter __index.
439*404b540aSrobert      *  @param  __fn  The function to add.
440*404b540aSrobert      *  @param  __index  The integer to pass to the function when invoked.
441*404b540aSrobert      *
442*404b540aSrobert      *  Registers a function as an event callback with an integer parameter to
443*404b540aSrobert      *  be passed to the function when invoked.  Multiple copies of the
444*404b540aSrobert      *  function are allowed.  If there are multiple callbacks, they are
445*404b540aSrobert      *  invoked in the order they were registered.
446*404b540aSrobert     */
447*404b540aSrobert     void
448*404b540aSrobert     register_callback(event_callback __fn, int __index);
449*404b540aSrobert 
450*404b540aSrobert   protected:
451*404b540aSrobert     //@{
452*404b540aSrobert     /**
453*404b540aSrobert      *  @if maint
454*404b540aSrobert      *  ios_base data members (doc me)
455*404b540aSrobert      *  @endif
456*404b540aSrobert     */
457*404b540aSrobert     streamsize		_M_precision;
458*404b540aSrobert     streamsize		_M_width;
459*404b540aSrobert     fmtflags		_M_flags;
460*404b540aSrobert     iostate		_M_exception;
461*404b540aSrobert     iostate		_M_streambuf_state;
462*404b540aSrobert     //@}
463*404b540aSrobert 
464*404b540aSrobert     // 27.4.2.6  Members for callbacks
465*404b540aSrobert     // 27.4.2.6  ios_base callbacks
466*404b540aSrobert     struct _Callback_list
467*404b540aSrobert     {
468*404b540aSrobert       // Data Members
469*404b540aSrobert       _Callback_list*		_M_next;
470*404b540aSrobert       ios_base::event_callback	_M_fn;
471*404b540aSrobert       int			_M_index;
472*404b540aSrobert       _Atomic_word		_M_refcount;  // 0 means one reference.
473*404b540aSrobert 
_Callback_list_Callback_list474*404b540aSrobert       _Callback_list(ios_base::event_callback __fn, int __index,
475*404b540aSrobert 		     _Callback_list* __cb)
476*404b540aSrobert       : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
477*404b540aSrobert 
478*404b540aSrobert       void
_M_add_reference_Callback_list479*404b540aSrobert       _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
480*404b540aSrobert 
481*404b540aSrobert       // 0 => OK to delete.
482*404b540aSrobert       int
_M_remove_reference_Callback_list483*404b540aSrobert       _M_remove_reference()
484*404b540aSrobert       { return __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); }
485*404b540aSrobert     };
486*404b540aSrobert 
487*404b540aSrobert      _Callback_list*	_M_callbacks;
488*404b540aSrobert 
489*404b540aSrobert     void
490*404b540aSrobert     _M_call_callbacks(event __ev) throw();
491*404b540aSrobert 
492*404b540aSrobert     void
493*404b540aSrobert     _M_dispose_callbacks(void);
494*404b540aSrobert 
495*404b540aSrobert     // 27.4.2.5  Members for iword/pword storage
496*404b540aSrobert     struct _Words
497*404b540aSrobert     {
498*404b540aSrobert       void*	_M_pword;
499*404b540aSrobert       long	_M_iword;
_Words_Words500*404b540aSrobert       _Words() : _M_pword(0), _M_iword(0) { }
501*404b540aSrobert     };
502*404b540aSrobert 
503*404b540aSrobert     // Only for failed iword/pword calls.
504*404b540aSrobert     _Words		_M_word_zero;
505*404b540aSrobert 
506*404b540aSrobert     // Guaranteed storage.
507*404b540aSrobert     // The first 5 iword and pword slots are reserved for internal use.
508*404b540aSrobert     enum { _S_local_word_size = 8 };
509*404b540aSrobert     _Words		_M_local_word[_S_local_word_size];
510*404b540aSrobert 
511*404b540aSrobert     // Allocated storage.
512*404b540aSrobert     int			_M_word_size;
513*404b540aSrobert     _Words*		_M_word;
514*404b540aSrobert 
515*404b540aSrobert     _Words&
516*404b540aSrobert     _M_grow_words(int __index, bool __iword);
517*404b540aSrobert 
518*404b540aSrobert     // Members for locale and locale caching.
519*404b540aSrobert     locale		_M_ios_locale;
520*404b540aSrobert 
521*404b540aSrobert     void
522*404b540aSrobert     _M_init();
523*404b540aSrobert 
524*404b540aSrobert   public:
525*404b540aSrobert 
526*404b540aSrobert     // 27.4.2.1.6  Class ios_base::Init
527*404b540aSrobert     // Used to initialize standard streams. In theory, g++ could use
528*404b540aSrobert     // -finit-priority to order this stuff correctly without going
529*404b540aSrobert     // through these machinations.
530*404b540aSrobert     class Init
531*404b540aSrobert     {
532*404b540aSrobert       friend class ios_base;
533*404b540aSrobert     public:
534*404b540aSrobert       Init();
535*404b540aSrobert       ~Init();
536*404b540aSrobert 
537*404b540aSrobert     private:
538*404b540aSrobert       static _Atomic_word	_S_refcount;
539*404b540aSrobert       static bool		_S_synced_with_stdio;
540*404b540aSrobert     };
541*404b540aSrobert 
542*404b540aSrobert     // [27.4.2.2] fmtflags state functions
543*404b540aSrobert     /**
544*404b540aSrobert      *  @brief  Access to format flags.
545*404b540aSrobert      *  @return  The format control flags for both input and output.
546*404b540aSrobert     */
547*404b540aSrobert     inline fmtflags
flags()548*404b540aSrobert     flags() const { return _M_flags; }
549*404b540aSrobert 
550*404b540aSrobert     /**
551*404b540aSrobert      *  @brief  Setting new format flags all at once.
552*404b540aSrobert      *  @param  fmtfl  The new flags to set.
553*404b540aSrobert      *  @return  The previous format control flags.
554*404b540aSrobert      *
555*404b540aSrobert      *  This function overwrites all the format flags with @a fmtfl.
556*404b540aSrobert     */
557*404b540aSrobert     inline fmtflags
flags(fmtflags __fmtfl)558*404b540aSrobert     flags(fmtflags __fmtfl)
559*404b540aSrobert     {
560*404b540aSrobert       fmtflags __old = _M_flags;
561*404b540aSrobert       _M_flags = __fmtfl;
562*404b540aSrobert       return __old;
563*404b540aSrobert     }
564*404b540aSrobert 
565*404b540aSrobert     /**
566*404b540aSrobert      *  @brief  Setting new format flags.
567*404b540aSrobert      *  @param  fmtfl  Additional flags to set.
568*404b540aSrobert      *  @return  The previous format control flags.
569*404b540aSrobert      *
570*404b540aSrobert      *  This function sets additional flags in format control.  Flags that
571*404b540aSrobert      *  were previously set remain set.
572*404b540aSrobert     */
573*404b540aSrobert     inline fmtflags
setf(fmtflags __fmtfl)574*404b540aSrobert     setf(fmtflags __fmtfl)
575*404b540aSrobert     {
576*404b540aSrobert       fmtflags __old = _M_flags;
577*404b540aSrobert       _M_flags |= __fmtfl;
578*404b540aSrobert       return __old;
579*404b540aSrobert     }
580*404b540aSrobert 
581*404b540aSrobert     /**
582*404b540aSrobert      *  @brief  Setting new format flags.
583*404b540aSrobert      *  @param  fmtfl  Additional flags to set.
584*404b540aSrobert      *  @param  mask  The flags mask for @a fmtfl.
585*404b540aSrobert      *  @return  The previous format control flags.
586*404b540aSrobert      *
587*404b540aSrobert      *  This function clears @a mask in the format flags, then sets
588*404b540aSrobert      *  @a fmtfl @c & @a mask.  An example mask is @c ios_base::adjustfield.
589*404b540aSrobert     */
590*404b540aSrobert     inline fmtflags
setf(fmtflags __fmtfl,fmtflags __mask)591*404b540aSrobert     setf(fmtflags __fmtfl, fmtflags __mask)
592*404b540aSrobert     {
593*404b540aSrobert       fmtflags __old = _M_flags;
594*404b540aSrobert       _M_flags &= ~__mask;
595*404b540aSrobert       _M_flags |= (__fmtfl & __mask);
596*404b540aSrobert       return __old;
597*404b540aSrobert     }
598*404b540aSrobert 
599*404b540aSrobert     /**
600*404b540aSrobert      *  @brief  Clearing format flags.
601*404b540aSrobert      *  @param  mask  The flags to unset.
602*404b540aSrobert      *
603*404b540aSrobert      *  This function clears @a mask in the format flags.
604*404b540aSrobert     */
605*404b540aSrobert     inline void
unsetf(fmtflags __mask)606*404b540aSrobert     unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
607*404b540aSrobert 
608*404b540aSrobert     /**
609*404b540aSrobert      *  @brief  Flags access.
610*404b540aSrobert      *  @return  The precision to generate on certain output operations.
611*404b540aSrobert      *
612*404b540aSrobert      *  @if maint
613*404b540aSrobert      *  Be careful if you try to give a definition of "precision" here; see
614*404b540aSrobert      *  DR 189.
615*404b540aSrobert      *  @endif
616*404b540aSrobert     */
617*404b540aSrobert     inline streamsize
precision()618*404b540aSrobert     precision() const { return _M_precision; }
619*404b540aSrobert 
620*404b540aSrobert     /**
621*404b540aSrobert      *  @brief  Changing flags.
622*404b540aSrobert      *  @param  prec  The new precision value.
623*404b540aSrobert      *  @return  The previous value of precision().
624*404b540aSrobert     */
625*404b540aSrobert     inline streamsize
precision(streamsize __prec)626*404b540aSrobert     precision(streamsize __prec)
627*404b540aSrobert     {
628*404b540aSrobert       streamsize __old = _M_precision;
629*404b540aSrobert       _M_precision = __prec;
630*404b540aSrobert       return __old;
631*404b540aSrobert     }
632*404b540aSrobert 
633*404b540aSrobert     /**
634*404b540aSrobert      *  @brief  Flags access.
635*404b540aSrobert      *  @return  The minimum field width to generate on output operations.
636*404b540aSrobert      *
637*404b540aSrobert      *  "Minimum field width" refers to the number of characters.
638*404b540aSrobert     */
639*404b540aSrobert     inline streamsize
width()640*404b540aSrobert     width() const { return _M_width; }
641*404b540aSrobert 
642*404b540aSrobert     /**
643*404b540aSrobert      *  @brief  Changing flags.
644*404b540aSrobert      *  @param  wide  The new width value.
645*404b540aSrobert      *  @return  The previous value of width().
646*404b540aSrobert     */
647*404b540aSrobert     inline streamsize
width(streamsize __wide)648*404b540aSrobert     width(streamsize __wide)
649*404b540aSrobert     {
650*404b540aSrobert       streamsize __old = _M_width;
651*404b540aSrobert       _M_width = __wide;
652*404b540aSrobert       return __old;
653*404b540aSrobert     }
654*404b540aSrobert 
655*404b540aSrobert     // [27.4.2.4] ios_base static members
656*404b540aSrobert     /**
657*404b540aSrobert      *  @brief  Interaction with the standard C I/O objects.
658*404b540aSrobert      *  @param  sync  Whether to synchronize or not.
659*404b540aSrobert      *  @return  True if the standard streams were previously synchronized.
660*404b540aSrobert      *
661*404b540aSrobert      *  The synchronization referred to is @e only that between the standard
662*404b540aSrobert      *  C facilities (e.g., stdout) and the standard C++ objects (e.g.,
663*404b540aSrobert      *  cout).  User-declared streams are unaffected.  See
664*404b540aSrobert      *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for more.
665*404b540aSrobert     */
666*404b540aSrobert     static bool
667*404b540aSrobert     sync_with_stdio(bool __sync = true);
668*404b540aSrobert 
669*404b540aSrobert     // [27.4.2.3] ios_base locale functions
670*404b540aSrobert     /**
671*404b540aSrobert      *  @brief  Setting a new locale.
672*404b540aSrobert      *  @param  loc  The new locale.
673*404b540aSrobert      *  @return  The previous locale.
674*404b540aSrobert      *
675*404b540aSrobert      *  Sets the new locale for this stream, and then invokes each callback
676*404b540aSrobert      *  with imbue_event.
677*404b540aSrobert     */
678*404b540aSrobert     locale
679*404b540aSrobert     imbue(const locale& __loc);
680*404b540aSrobert 
681*404b540aSrobert     /**
682*404b540aSrobert      *  @brief  Locale access
683*404b540aSrobert      *  @return  A copy of the current locale.
684*404b540aSrobert      *
685*404b540aSrobert      *  If @c imbue(loc) has previously been called, then this function
686*404b540aSrobert      *  returns @c loc.  Otherwise, it returns a copy of @c std::locale(),
687*404b540aSrobert      *  the global C++ locale.
688*404b540aSrobert     */
689*404b540aSrobert     inline locale
getloc()690*404b540aSrobert     getloc() const { return _M_ios_locale; }
691*404b540aSrobert 
692*404b540aSrobert     /**
693*404b540aSrobert      *  @brief  Locale access
694*404b540aSrobert      *  @return  A reference to the current locale.
695*404b540aSrobert      *
696*404b540aSrobert      *  Like getloc above, but returns a reference instead of
697*404b540aSrobert      *  generating a copy.
698*404b540aSrobert     */
699*404b540aSrobert     inline const locale&
_M_getloc()700*404b540aSrobert     _M_getloc() const { return _M_ios_locale; }
701*404b540aSrobert 
702*404b540aSrobert     // [27.4.2.5] ios_base storage functions
703*404b540aSrobert     /**
704*404b540aSrobert      *  @brief  Access to unique indices.
705*404b540aSrobert      *  @return  An integer different from all previous calls.
706*404b540aSrobert      *
707*404b540aSrobert      *  This function returns a unique integer every time it is called.  It
708*404b540aSrobert      *  can be used for any purpose, but is primarily intended to be a unique
709*404b540aSrobert      *  index for the iword and pword functions.  The expectation is that an
710*404b540aSrobert      *  application calls xalloc in order to obtain an index in the iword and
711*404b540aSrobert      *  pword arrays that can be used without fear of conflict.
712*404b540aSrobert      *
713*404b540aSrobert      *  The implementation maintains a static variable that is incremented and
714*404b540aSrobert      *  returned on each invocation.  xalloc is guaranteed to return an index
715*404b540aSrobert      *  that is safe to use in the iword and pword arrays.
716*404b540aSrobert     */
717*404b540aSrobert     static int
718*404b540aSrobert     xalloc() throw();
719*404b540aSrobert 
720*404b540aSrobert     /**
721*404b540aSrobert      *  @brief  Access to integer array.
722*404b540aSrobert      *  @param  __ix  Index into the array.
723*404b540aSrobert      *  @return  A reference to an integer associated with the index.
724*404b540aSrobert      *
725*404b540aSrobert      *  The iword function provides access to an array of integers that can be
726*404b540aSrobert      *  used for any purpose.  The array grows as required to hold the
727*404b540aSrobert      *  supplied index.  All integers in the array are initialized to 0.
728*404b540aSrobert      *
729*404b540aSrobert      *  The implementation reserves several indices.  You should use xalloc to
730*404b540aSrobert      *  obtain an index that is safe to use.  Also note that since the array
731*404b540aSrobert      *  can grow dynamically, it is not safe to hold onto the reference.
732*404b540aSrobert     */
733*404b540aSrobert     inline long&
iword(int __ix)734*404b540aSrobert     iword(int __ix)
735*404b540aSrobert     {
736*404b540aSrobert       _Words& __word = (__ix < _M_word_size)
737*404b540aSrobert 			? _M_word[__ix] : _M_grow_words(__ix, true);
738*404b540aSrobert       return __word._M_iword;
739*404b540aSrobert     }
740*404b540aSrobert 
741*404b540aSrobert     /**
742*404b540aSrobert      *  @brief  Access to void pointer array.
743*404b540aSrobert      *  @param  __ix  Index into the array.
744*404b540aSrobert      *  @return  A reference to a void* associated with the index.
745*404b540aSrobert      *
746*404b540aSrobert      *  The pword function provides access to an array of pointers that can be
747*404b540aSrobert      *  used for any purpose.  The array grows as required to hold the
748*404b540aSrobert      *  supplied index.  All pointers in the array are initialized to 0.
749*404b540aSrobert      *
750*404b540aSrobert      *  The implementation reserves several indices.  You should use xalloc to
751*404b540aSrobert      *  obtain an index that is safe to use.  Also note that since the array
752*404b540aSrobert      *  can grow dynamically, it is not safe to hold onto the reference.
753*404b540aSrobert     */
754*404b540aSrobert     inline void*&
pword(int __ix)755*404b540aSrobert     pword(int __ix)
756*404b540aSrobert     {
757*404b540aSrobert       _Words& __word = (__ix < _M_word_size)
758*404b540aSrobert 			? _M_word[__ix] : _M_grow_words(__ix, false);
759*404b540aSrobert       return __word._M_pword;
760*404b540aSrobert     }
761*404b540aSrobert 
762*404b540aSrobert     // Destructor
763*404b540aSrobert     /**
764*404b540aSrobert      *  Invokes each callback with erase_event.  Destroys local storage.
765*404b540aSrobert      *
766*404b540aSrobert      *  Note that the ios_base object for the standard streams never gets
767*404b540aSrobert      *  destroyed.  As a result, any callbacks registered with the standard
768*404b540aSrobert      *  streams will not get invoked with erase_event (unless copyfmt is
769*404b540aSrobert      *  used).
770*404b540aSrobert     */
771*404b540aSrobert     virtual ~ios_base();
772*404b540aSrobert 
773*404b540aSrobert   protected:
774*404b540aSrobert     ios_base();
775*404b540aSrobert 
776*404b540aSrobert   // _GLIBCXX_RESOLVE_LIB_DEFECTS
777*404b540aSrobert   // 50.  Copy constructor and assignment operator of ios_base
778*404b540aSrobert   private:
779*404b540aSrobert     ios_base(const ios_base&);
780*404b540aSrobert 
781*404b540aSrobert     ios_base&
782*404b540aSrobert     operator=(const ios_base&);
783*404b540aSrobert   };
784*404b540aSrobert 
785*404b540aSrobert   // [27.4.5.1] fmtflags manipulators
786*404b540aSrobert   /// Calls base.setf(ios_base::boolalpha).
787*404b540aSrobert   inline ios_base&
boolalpha(ios_base & __base)788*404b540aSrobert   boolalpha(ios_base& __base)
789*404b540aSrobert   {
790*404b540aSrobert     __base.setf(ios_base::boolalpha);
791*404b540aSrobert     return __base;
792*404b540aSrobert   }
793*404b540aSrobert 
794*404b540aSrobert   /// Calls base.unsetf(ios_base::boolalpha).
795*404b540aSrobert   inline ios_base&
noboolalpha(ios_base & __base)796*404b540aSrobert   noboolalpha(ios_base& __base)
797*404b540aSrobert   {
798*404b540aSrobert     __base.unsetf(ios_base::boolalpha);
799*404b540aSrobert     return __base;
800*404b540aSrobert   }
801*404b540aSrobert 
802*404b540aSrobert   /// Calls base.setf(ios_base::showbase).
803*404b540aSrobert   inline ios_base&
showbase(ios_base & __base)804*404b540aSrobert   showbase(ios_base& __base)
805*404b540aSrobert   {
806*404b540aSrobert     __base.setf(ios_base::showbase);
807*404b540aSrobert     return __base;
808*404b540aSrobert   }
809*404b540aSrobert 
810*404b540aSrobert   /// Calls base.unsetf(ios_base::showbase).
811*404b540aSrobert   inline ios_base&
noshowbase(ios_base & __base)812*404b540aSrobert   noshowbase(ios_base& __base)
813*404b540aSrobert   {
814*404b540aSrobert     __base.unsetf(ios_base::showbase);
815*404b540aSrobert     return __base;
816*404b540aSrobert   }
817*404b540aSrobert 
818*404b540aSrobert   /// Calls base.setf(ios_base::showpoint).
819*404b540aSrobert   inline ios_base&
showpoint(ios_base & __base)820*404b540aSrobert   showpoint(ios_base& __base)
821*404b540aSrobert   {
822*404b540aSrobert     __base.setf(ios_base::showpoint);
823*404b540aSrobert     return __base;
824*404b540aSrobert   }
825*404b540aSrobert 
826*404b540aSrobert   /// Calls base.unsetf(ios_base::showpoint).
827*404b540aSrobert   inline ios_base&
noshowpoint(ios_base & __base)828*404b540aSrobert   noshowpoint(ios_base& __base)
829*404b540aSrobert   {
830*404b540aSrobert     __base.unsetf(ios_base::showpoint);
831*404b540aSrobert     return __base;
832*404b540aSrobert   }
833*404b540aSrobert 
834*404b540aSrobert   /// Calls base.setf(ios_base::showpos).
835*404b540aSrobert   inline ios_base&
showpos(ios_base & __base)836*404b540aSrobert   showpos(ios_base& __base)
837*404b540aSrobert   {
838*404b540aSrobert     __base.setf(ios_base::showpos);
839*404b540aSrobert     return __base;
840*404b540aSrobert   }
841*404b540aSrobert 
842*404b540aSrobert   /// Calls base.unsetf(ios_base::showpos).
843*404b540aSrobert   inline ios_base&
noshowpos(ios_base & __base)844*404b540aSrobert   noshowpos(ios_base& __base)
845*404b540aSrobert   {
846*404b540aSrobert     __base.unsetf(ios_base::showpos);
847*404b540aSrobert     return __base;
848*404b540aSrobert   }
849*404b540aSrobert 
850*404b540aSrobert   /// Calls base.setf(ios_base::skipws).
851*404b540aSrobert   inline ios_base&
skipws(ios_base & __base)852*404b540aSrobert   skipws(ios_base& __base)
853*404b540aSrobert   {
854*404b540aSrobert     __base.setf(ios_base::skipws);
855*404b540aSrobert     return __base;
856*404b540aSrobert   }
857*404b540aSrobert 
858*404b540aSrobert   /// Calls base.unsetf(ios_base::skipws).
859*404b540aSrobert   inline ios_base&
noskipws(ios_base & __base)860*404b540aSrobert   noskipws(ios_base& __base)
861*404b540aSrobert   {
862*404b540aSrobert     __base.unsetf(ios_base::skipws);
863*404b540aSrobert     return __base;
864*404b540aSrobert   }
865*404b540aSrobert 
866*404b540aSrobert   /// Calls base.setf(ios_base::uppercase).
867*404b540aSrobert   inline ios_base&
uppercase(ios_base & __base)868*404b540aSrobert   uppercase(ios_base& __base)
869*404b540aSrobert   {
870*404b540aSrobert     __base.setf(ios_base::uppercase);
871*404b540aSrobert     return __base;
872*404b540aSrobert   }
873*404b540aSrobert 
874*404b540aSrobert   /// Calls base.unsetf(ios_base::uppercase).
875*404b540aSrobert   inline ios_base&
nouppercase(ios_base & __base)876*404b540aSrobert   nouppercase(ios_base& __base)
877*404b540aSrobert   {
878*404b540aSrobert     __base.unsetf(ios_base::uppercase);
879*404b540aSrobert     return __base;
880*404b540aSrobert   }
881*404b540aSrobert 
882*404b540aSrobert   /// Calls base.setf(ios_base::unitbuf).
883*404b540aSrobert   inline ios_base&
unitbuf(ios_base & __base)884*404b540aSrobert   unitbuf(ios_base& __base)
885*404b540aSrobert   {
886*404b540aSrobert      __base.setf(ios_base::unitbuf);
887*404b540aSrobert      return __base;
888*404b540aSrobert   }
889*404b540aSrobert 
890*404b540aSrobert   /// Calls base.unsetf(ios_base::unitbuf).
891*404b540aSrobert   inline ios_base&
nounitbuf(ios_base & __base)892*404b540aSrobert   nounitbuf(ios_base& __base)
893*404b540aSrobert   {
894*404b540aSrobert      __base.unsetf(ios_base::unitbuf);
895*404b540aSrobert      return __base;
896*404b540aSrobert   }
897*404b540aSrobert 
898*404b540aSrobert   // [27.4.5.2] adjustfield anipulators
899*404b540aSrobert   /// Calls base.setf(ios_base::internal, ios_base::adjustfield).
900*404b540aSrobert   inline ios_base&
internal(ios_base & __base)901*404b540aSrobert   internal(ios_base& __base)
902*404b540aSrobert   {
903*404b540aSrobert      __base.setf(ios_base::internal, ios_base::adjustfield);
904*404b540aSrobert      return __base;
905*404b540aSrobert   }
906*404b540aSrobert 
907*404b540aSrobert   /// Calls base.setf(ios_base::left, ios_base::adjustfield).
908*404b540aSrobert   inline ios_base&
left(ios_base & __base)909*404b540aSrobert   left(ios_base& __base)
910*404b540aSrobert   {
911*404b540aSrobert     __base.setf(ios_base::left, ios_base::adjustfield);
912*404b540aSrobert     return __base;
913*404b540aSrobert   }
914*404b540aSrobert 
915*404b540aSrobert   /// Calls base.setf(ios_base::right, ios_base::adjustfield).
916*404b540aSrobert   inline ios_base&
right(ios_base & __base)917*404b540aSrobert   right(ios_base& __base)
918*404b540aSrobert   {
919*404b540aSrobert     __base.setf(ios_base::right, ios_base::adjustfield);
920*404b540aSrobert     return __base;
921*404b540aSrobert   }
922*404b540aSrobert 
923*404b540aSrobert   // [27.4.5.3] basefield anipulators
924*404b540aSrobert   /// Calls base.setf(ios_base::dec, ios_base::basefield).
925*404b540aSrobert   inline ios_base&
dec(ios_base & __base)926*404b540aSrobert   dec(ios_base& __base)
927*404b540aSrobert   {
928*404b540aSrobert     __base.setf(ios_base::dec, ios_base::basefield);
929*404b540aSrobert     return __base;
930*404b540aSrobert   }
931*404b540aSrobert 
932*404b540aSrobert   /// Calls base.setf(ios_base::hex, ios_base::basefield).
933*404b540aSrobert   inline ios_base&
hex(ios_base & __base)934*404b540aSrobert   hex(ios_base& __base)
935*404b540aSrobert   {
936*404b540aSrobert     __base.setf(ios_base::hex, ios_base::basefield);
937*404b540aSrobert     return __base;
938*404b540aSrobert   }
939*404b540aSrobert 
940*404b540aSrobert   /// Calls base.setf(ios_base::oct, ios_base::basefield).
941*404b540aSrobert   inline ios_base&
oct(ios_base & __base)942*404b540aSrobert   oct(ios_base& __base)
943*404b540aSrobert   {
944*404b540aSrobert     __base.setf(ios_base::oct, ios_base::basefield);
945*404b540aSrobert     return __base;
946*404b540aSrobert   }
947*404b540aSrobert 
948*404b540aSrobert   // [27.4.5.4] floatfield anipulators
949*404b540aSrobert   /// Calls base.setf(ios_base::fixed, ios_base::floatfield).
950*404b540aSrobert   inline ios_base&
fixed(ios_base & __base)951*404b540aSrobert   fixed(ios_base& __base)
952*404b540aSrobert   {
953*404b540aSrobert     __base.setf(ios_base::fixed, ios_base::floatfield);
954*404b540aSrobert     return __base;
955*404b540aSrobert   }
956*404b540aSrobert 
957*404b540aSrobert   /// Calls base.setf(ios_base::scientific, ios_base::floatfield).
958*404b540aSrobert   inline ios_base&
scientific(ios_base & __base)959*404b540aSrobert   scientific(ios_base& __base)
960*404b540aSrobert   {
961*404b540aSrobert     __base.setf(ios_base::scientific, ios_base::floatfield);
962*404b540aSrobert     return __base;
963*404b540aSrobert   }
964*404b540aSrobert 
965*404b540aSrobert _GLIBCXX_END_NAMESPACE
966*404b540aSrobert 
967*404b540aSrobert #endif /* _IOS_BASE_H */
968*404b540aSrobert 
969