OSDN Git Service

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