OSDN Git Service

2003-04-28 Petur Runolfsson <peturr02@ru.is>
[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   class __locale_cache_base;
150
151   // 27.4.2  Class ios_base
152   /**
153    *  @brief  The very top of the I/O class hierarchy.
154    *
155    *  This class defines everything that can be defined about I/O that does
156    *  not depend on the type of characters being input or output.  Most
157    *  people will only see @c ios_base when they need to specify the full
158    *  name of the various I/O flags (e.g., the openmodes).
159   */
160   class ios_base
161   {
162   public:
163     
164     // 27.4.2.1.1  Class ios_base::failure
165     /// These are thrown to indicate problems.  Doc me.
166     class failure : public exception
167     {
168     public:
169 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
170       //48.  Use of non-existent exception constructor
171       explicit 
172       failure(const string& __str) throw();
173
174       // This declaration is not useless:
175       // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
176       virtual 
177       ~failure() throw();
178
179       virtual const char*
180       what() const throw();
181       
182     private:
183       enum { _M_bufsize = 256 };
184       char _M_name[_M_bufsize];
185 #endif
186     };
187
188     // 27.4.2.1.2  Type ios_base::fmtflags
189     /**
190      *  @brief This is a bitmask type.
191      *
192      *  @c "_Ios_Fmtflags" is implementation-defined, but it is valid to
193      *  perform bitwise operations on these values and expect the Right
194      *  Thing to happen.  Defined objects of type fmtflags are:
195      *  - boolalpha
196      *  - dec
197      *  - fixed
198      *  - hex
199      *  - internal
200      *  - left
201      *  - oct
202      *  - right
203      *  - scientific
204      *  - showbase
205      *  - showpoint
206      *  - showpos
207      *  - skipws
208      *  - unitbuf
209      *  - uppercase
210      *  - adjustfield
211      *  - basefield
212      *  - floatfield
213     */
214     typedef _Ios_Fmtflags fmtflags;
215     /// Insert/extract @c bool in alphabetic rather than numeric format.
216     static const fmtflags boolalpha =   fmtflags(__ios_flags::_S_boolalpha);
217     /// Converts integer input or generates integer output in decimal base.
218     static const fmtflags dec =         fmtflags(__ios_flags::_S_dec);
219     /// Generate floating-point output in fixed-point notation.
220     static const fmtflags fixed =       fmtflags(__ios_flags::_S_fixed);
221     /// Converts integer input or generates integer output in hexadecimal base.
222     static const fmtflags hex =         fmtflags(__ios_flags::_S_hex);
223     /// Adds fill characters at a designated internal point in certain
224     /// generated output, or identical to @c right if no such point is
225     /// designated.
226     static const fmtflags internal =    fmtflags(__ios_flags::_S_internal);
227     /// Adds fill characters on the right (final positions) of certain
228     /// generated output.  (I.e., the thing you print is flush left.)
229     static const fmtflags left =        fmtflags(__ios_flags::_S_left);
230     /// Converts integer input or generates integer output in octal base.
231     static const fmtflags oct =         fmtflags(__ios_flags::_S_oct);
232     /// Adds fill characters on the left (initial positions) of certain
233     /// generated output.  (I.e., the thing you print is flush right.)
234     static const fmtflags right =       fmtflags(__ios_flags::_S_right);
235     /// Generates floating-point output in scientific notation.
236     static const fmtflags scientific =  fmtflags(__ios_flags::_S_scientific);
237     /// Generates a prefix indicating the numeric base of generated integer
238     /// output.
239     static const fmtflags showbase =    fmtflags(__ios_flags::_S_showbase);
240     /// Generates a decimal-point character unconditionally in generated
241     /// floating-point output.
242     static const fmtflags showpoint =   fmtflags(__ios_flags::_S_showpoint);
243     /// Generates a + sign in non-negative generated numeric output.
244     static const fmtflags showpos =     fmtflags(__ios_flags::_S_showpos);
245     /// Skips leading white space before certain input operations.
246     static const fmtflags skipws =      fmtflags(__ios_flags::_S_skipws);
247     /// Flushes output after each output operation.
248     static const fmtflags unitbuf =     fmtflags(__ios_flags::_S_unitbuf);
249     /// Replaces certain lowercase letters with their uppercase equivalents
250     /// in generated output.
251     static const fmtflags uppercase =   fmtflags(__ios_flags::_S_uppercase);
252     /// A mask of left|right|internal.  Useful for the 2-arg form of @c setf.
253     static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
254     /// A mask of dec|oct|hex.  Useful for the 2-arg form of @c setf.
255     static const fmtflags basefield =   fmtflags(__ios_flags::_S_basefield);
256     /// A mask of scientific|fixed.  Useful for the 2-arg form of @c setf.
257     static const fmtflags floatfield =  fmtflags(__ios_flags::_S_floatfield);
258
259     // 27.4.2.1.3  Type ios_base::iostate
260     /**
261      *  @brief This is a bitmask type.
262      *
263      *  @c "_Ios_Iostate" is implementation-defined, but it is valid to
264      *  perform bitwise operations on these values and expect the Right
265      *  Thing to happen.  Defined objects of type iostate are:
266      *  - badbit
267      *  - eofbit
268      *  - failbit
269      *  - goodbit
270     */
271     typedef _Ios_Iostate iostate;
272     /// Indicates a loss of integrity in an input or output sequence (such
273     /// as an irrecoverable read error from a file).
274     static const iostate badbit =       iostate(__ios_flags::_S_badbit);
275     /// Indicates that an input operation reached the end of an input sequence.
276     static const iostate eofbit =       iostate(__ios_flags::_S_eofbit);
277     /// Indicates that an input operation failed to read the expected
278     /// characters, or that an output operation failed to generate the
279     /// desired characters.
280     static const iostate failbit =      iostate(__ios_flags::_S_failbit);
281     /// Indicates all is well.
282     static const iostate goodbit =      iostate(0);
283
284     // 27.4.2.1.4  Type ios_base::openmode
285     /**
286      *  @brief This is a bitmask type.
287      *
288      *  @c "_Ios_Openmode" is implementation-defined, but it is valid to
289      *  perform bitwise operations on these values and expect the Right
290      *  Thing to happen.  Defined objects of type openmode are:
291      *  - app
292      *  - ate
293      *  - binary
294      *  - in
295      *  - out
296      *  - trunc
297     */
298     typedef _Ios_Openmode openmode;
299     /// Seek to end before each write.
300     static const openmode app =         openmode(__ios_flags::_S_app);
301     /// Open and seek to end immediately after opening.
302     static const openmode ate =         openmode(__ios_flags::_S_ate);
303     /// Perform input and output in binary mode (as opposed to text mode).
304     /// This is probably not what you think it is; see
305     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and
306     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.
307     static const openmode binary =      openmode(__ios_flags::_S_bin);
308     /// Open for input.  Default for @c ifstream and fstream.
309     static const openmode in =          openmode(__ios_flags::_S_in);
310     /// Open for output.  Default for @c ofstream and fstream.
311     static const openmode out =         openmode(__ios_flags::_S_out);
312     /// Open for input.  Default for @c ofstream.
313     static const openmode trunc =       openmode(__ios_flags::_S_trunc);
314
315     // 27.4.2.1.5  Type ios_base::seekdir
316     /**
317      *  @brief This is an enumerated type.
318      *
319      *  @c "_Ios_Seekdir" is implementation-defined.  Defined values
320      *  of type seekdir are:
321      *  - beg
322      *  - cur, equivalent to @c SEEK_CUR in the C standard library.
323      *  - end, equivalent to @c SEEK_END in the C standard library.
324     */
325     typedef _Ios_Seekdir seekdir;
326     /// Request a seek relative to the beginning of the stream.
327     static const seekdir beg =          seekdir(0);
328     /// Request a seek relative to the current position within the sequence.
329     static const seekdir cur =          seekdir(SEEK_CUR);
330     /// Request a seek relative to the current end of the sequence.
331     static const seekdir end =          seekdir(SEEK_END);
332
333 #ifdef _GLIBCPP_DEPRECATED
334     // Annex D.6
335     typedef int io_state;
336     typedef int open_mode;
337     typedef int seek_dir;
338     
339     typedef std::streampos streampos;
340     typedef std::streamoff streamoff;
341 #endif
342
343     // Callbacks;
344     /**
345      *  @doctodo
346     */
347     enum event
348     {
349       erase_event,
350       imbue_event,
351       copyfmt_event
352     };
353
354     /**
355      *  @doctodo
356     */
357     typedef void (*event_callback) (event, ios_base&, int);
358
359     /**
360      *  @doctodo
361     */
362     void 
363     register_callback(event_callback __fn, int __index);
364
365   protected:
366     //@{
367     /**
368      *  @if maint
369      *  ios_base data members (doc me)
370      *  @endif
371     */
372     streamsize          _M_precision;
373     streamsize          _M_width;
374     fmtflags            _M_flags;
375     iostate             _M_exception;
376     iostate             _M_streambuf_state;
377     //@}
378
379     // 27.4.2.6  Members for callbacks
380     // 27.4.2.6  ios_base callbacks
381     struct _Callback_list
382     {
383       // Data Members
384       _Callback_list*           _M_next;
385       ios_base::event_callback  _M_fn;
386       int                       _M_index;
387       _Atomic_word              _M_refcount;  // 0 means one reference.
388     
389       _Callback_list(ios_base::event_callback __fn, int __index, 
390                      _Callback_list* __cb)
391       : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
392       
393       void 
394       _M_add_reference() { __atomic_add(&_M_refcount, 1); }
395
396       // 0 => OK to delete.
397       int 
398       _M_remove_reference() { return __exchange_and_add(&_M_refcount, -1); }
399     };
400
401      _Callback_list*    _M_callbacks;
402
403     void 
404     _M_call_callbacks(event __ev) throw();
405
406     void 
407     _M_dispose_callbacks(void);
408
409     // 27.4.2.5  Members for iword/pword storage
410     struct _Words 
411     { 
412       void*     _M_pword; 
413       long      _M_iword; 
414       _Words() : _M_pword(0), _M_iword(0) { }
415     };
416
417     // Only for failed iword/pword calls.
418     _Words              _M_word_zero;    
419
420     // Guaranteed storage.
421     // The first 5 iword and pword slots are reserved for internal use.
422     static const int    _S_local_word_size = 8;
423     _Words              _M_local_word[_S_local_word_size];  
424
425     // Allocated storage.
426     int                 _M_word_size;
427     _Words*             _M_word;
428  
429     _Words& 
430     _M_grow_words(int __index);
431
432     // Members for locale and locale caching.
433     locale              _M_ios_locale;
434
435     // Cache of locale and facet data.
436     // Cast this to __locale_cache<_CharT>*
437     auto_ptr<__locale_cache_base>       _M_locale_cache;
438
439     void 
440     _M_init();
441
442   public:
443
444     // 27.4.2.1.6  Class ios_base::Init
445     // Used to initialize standard streams. In theory, g++ could use
446     // -finit-priority to order this stuff correctly without going
447     // through these machinations. 
448     class Init 
449     {
450       friend class ios_base;
451     public:
452       Init();
453       ~Init();
454       
455       static void
456       _S_create_buffers(bool __sync);
457       
458       static void
459       _S_destroy_buffers();
460
461       // NB: Allows debugger applications use of the standard streams
462       // from operator new. _S_ios_base_init must be incremented in
463       // _S_ios_create _after_ initialization is completed.
464       static bool
465       _S_initialized() { return _S_ios_base_init; }
466
467     private:
468       static int        _S_ios_base_init;
469       static bool       _S_synced_with_stdio;
470     };
471
472     // [27.4.2.2] fmtflags state functions
473     /**
474      *  @brief  Access to format flags.
475      *  @return  The format control flags for both input and output.
476     */
477     inline fmtflags 
478     flags() const { return _M_flags; }
479
480     /**
481      *  @brief  Setting new format flags all at once.
482      *  @param  fmtfl  The new flags to set.
483      *  @return  The previous format control flags.
484      *
485      *  This function overwrites all the format flags with @a fmtfl.
486     */
487     inline fmtflags 
488     flags(fmtflags __fmtfl)
489     { 
490       fmtflags __old = _M_flags; 
491       _M_flags = __fmtfl; 
492       return __old; 
493     }
494
495     /**
496      *  @brief  Setting new format flags.
497      *  @param  fmtfl  Additional flags to set.
498      *  @return  The previous format control flags.
499      *
500      *  This function sets additional flags in format control.  Flags that
501      *  were previously set remain set.
502     */
503     inline fmtflags 
504     setf(fmtflags __fmtfl)
505     { 
506       fmtflags __old = _M_flags; 
507       _M_flags |= __fmtfl; 
508       return __old; 
509     }
510
511     /**
512      *  @brief  Setting new format flags.
513      *  @param  fmtfl  Additional flags to set.
514      *  @param  mask  The flags mask for @a fmtfl.
515      *  @return  The previous format control flags.
516      *
517      *  This function clears @a mask in the format flags, then sets
518      *  @a fmtfl @c & @a mask.  An example mask is @c ios_base::adjustfield.
519     */
520     inline fmtflags 
521     setf(fmtflags __fmtfl, fmtflags __mask)
522     {
523       fmtflags __old = _M_flags;
524       _M_flags &= ~__mask;
525       _M_flags |= (__fmtfl & __mask);
526       return __old;
527     }
528
529     /**
530      *  @brief  Clearing format flags.
531      *  @param  mask  The flags to unset.
532      *
533      *  This function clears @a mask in the format flags.
534     */
535     inline void 
536     unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
537
538     /**
539      *  @brief  Flags access.
540      *  @return  The precision to generate on certain output operations.
541      *
542      *  @if maint
543      *  Be careful if you try to give a definition of "precision" here; see
544      *  DR 189.
545      *  @endif
546     */
547     inline streamsize 
548     precision() const { return _M_precision; }
549
550     /**
551      *  @brief  Changing flags.
552      *  @param  prec  The new precision value.
553      *  @return  The previous value of precision().
554     */
555     inline streamsize 
556     precision(streamsize __prec)
557     { 
558       streamsize __old = _M_precision; 
559       _M_precision = __prec; 
560       return __old; 
561     }
562
563     /**
564      *  @brief  Flags access.
565      *  @return  The minimum field width to generate on output operations.
566      *
567      *  "Minimum field width" refers to the number of characters.
568     */
569     inline streamsize 
570     width() const { return _M_width; }
571
572     /**
573      *  @brief  Changing flags.
574      *  @param  wide  The new width value.
575      *  @return  The previous value of width().
576     */
577     inline streamsize 
578     width(streamsize __wide)
579     { 
580       streamsize __old = _M_width; 
581       _M_width = __wide; 
582       return __old; 
583     }
584
585     // [27.4.2.4] ios_base static members
586     /**
587      *  @brief  Interaction with the standard C I/O objects.
588      *  @param  sync  Whether to synchronize or not.
589      *  @return  True if the standard streams were previously synchronized.
590      *
591      *  The synchronization referred to is @e only that between the standard
592      *  C facilities (e.g., stdout) and the standard C++ objects (e.g.,
593      *  cout).  User-declared streams are unaffected.  See
594      *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for more.
595     */
596     static bool 
597     sync_with_stdio(bool __sync = true);
598
599     // [27.4.2.3] ios_base locale functions
600     /**
601      *  @brief  Setting a new locale.
602      *  @param  loc  The new locale.
603      *  @return  The previous locale.
604      *
605      *  Sets the new locale for this stream, and
606      *  [XXX does something with callbacks].
607     */
608     locale 
609     imbue(const locale& __loc);
610
611     /**
612      *  @brief  Locale access
613      *  @return  The locale currently in effect.
614      *
615      *  If @c imbue(loc) has previously been called, then this function
616      *  returns @c loc.  Otherwise, it returns a copy of @c std::locale(),
617      *  the global C++ locale.
618     */
619     inline locale 
620     getloc() const { return _M_ios_locale; }
621
622     // [27.4.2.5] ios_base storage functions
623     /**
624      *  @doctodo
625     */
626     static int 
627     xalloc() throw();
628
629     /**
630      *  @doctodo
631     */
632     inline long& 
633     iword(int __ix)
634     {
635       _Words& __word = (__ix < _M_word_size) 
636                         ? _M_word[__ix] : _M_grow_words(__ix);
637       return __word._M_iword;
638     }
639
640     /**
641      *  @doctodo
642     */
643     inline void*& 
644     pword(int __ix)
645     {
646       _Words& __word = (__ix < _M_word_size) 
647                         ? _M_word[__ix] : _M_grow_words(__ix);
648       return __word._M_pword;
649     }
650
651     // Access to the cache.  Not safe to call until basic_ios::_M_init() has
652     // happened.
653     __locale_cache_base&
654     _M_cache() { return *_M_locale_cache; }
655
656     // Destructor
657     /**
658      *  Destroys local storage and
659      *  [XXX does something with callbacks].
660     */
661     virtual ~ios_base();
662
663   protected:
664     ios_base();
665
666 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
667   //50.  Copy constructor and assignment operator of ios_base
668   private:
669     ios_base(const ios_base&);
670
671     ios_base& 
672     operator=(const ios_base&);
673 #endif
674   };
675  
676   // [27.4.5.1] fmtflags manipulators
677   /// Calls base.setf(ios_base::boolalpha).
678   inline ios_base& 
679   boolalpha(ios_base& __base)
680   {
681     __base.setf(ios_base::boolalpha);
682     return __base;
683   }
684
685   /// Calls base.unsetf(ios_base::boolalpha).
686   inline ios_base& 
687   noboolalpha(ios_base& __base)
688   {
689     __base.unsetf(ios_base::boolalpha);
690     return __base;
691   }
692
693   /// Calls base.setf(ios_base::showbase).
694   inline ios_base& 
695   showbase(ios_base& __base)
696   {
697     __base.setf(ios_base::showbase);
698     return __base;
699   }
700
701   /// Calls base.unsetf(ios_base::showbase).
702   inline ios_base& 
703   noshowbase(ios_base& __base)
704   {
705     __base.unsetf(ios_base::showbase);
706     return __base;
707   }
708
709   /// Calls base.setf(ios_base::showpoint).
710   inline ios_base& 
711   showpoint(ios_base& __base)
712   {
713     __base.setf(ios_base::showpoint);
714     return __base;
715   }
716
717   /// Calls base.unsetf(ios_base::showpoint).
718   inline ios_base& 
719   noshowpoint(ios_base& __base)
720   {
721     __base.unsetf(ios_base::showpoint);
722     return __base;
723   }
724
725   /// Calls base.setf(ios_base::showpos).
726   inline ios_base& 
727   showpos(ios_base& __base)
728   {
729     __base.setf(ios_base::showpos);
730     return __base;
731   }
732
733   /// Calls base.unsetf(ios_base::showpos).
734   inline ios_base& 
735   noshowpos(ios_base& __base)
736   {
737     __base.unsetf(ios_base::showpos);
738     return __base;
739   }
740
741   /// Calls base.setf(ios_base::skipws).
742   inline ios_base& 
743   skipws(ios_base& __base)
744   {
745     __base.setf(ios_base::skipws);
746     return __base;
747   }
748   
749   /// Calls base.unsetf(ios_base::skipws).
750   inline ios_base& 
751   noskipws(ios_base& __base)
752   {
753     __base.unsetf(ios_base::skipws);
754     return __base;
755   }
756
757   /// Calls base.setf(ios_base::uppercase).
758   inline ios_base& 
759   uppercase(ios_base& __base)
760   {
761     __base.setf(ios_base::uppercase);
762     return __base;
763   }
764
765   /// Calls base.unsetf(ios_base::uppercase).
766   inline ios_base& 
767   nouppercase(ios_base& __base)
768   {
769     __base.unsetf(ios_base::uppercase);
770     return __base;
771   }
772
773   /// Calls base.setf(ios_base::unitbuf).
774   inline ios_base& 
775   unitbuf(ios_base& __base)
776   {
777      __base.setf(ios_base::unitbuf);      
778      return __base;
779   }
780
781   /// Calls base.unsetf(ios_base::unitbuf).
782   inline ios_base& 
783   nounitbuf(ios_base& __base)
784   {
785      __base.unsetf(ios_base::unitbuf);
786      return __base;    
787   }
788
789   // [27.4.5.2] adjustfield anipulators
790   /// Calls base.setf(ios_base::internal, ios_base::adjustfield).
791   inline ios_base& 
792   internal(ios_base& __base)
793   {
794      __base.setf(ios_base::internal, ios_base::adjustfield);
795      return __base;    
796   }
797
798   /// Calls base.setf(ios_base::left, ios_base::adjustfield).
799   inline ios_base& 
800   left(ios_base& __base)
801   {
802     __base.setf(ios_base::left, ios_base::adjustfield);
803     return __base;
804   }
805   
806   /// Calls base.setf(ios_base::right, ios_base::adjustfield).
807   inline ios_base& 
808   right(ios_base& __base)
809   {
810     __base.setf(ios_base::right, ios_base::adjustfield);
811     return __base;
812   }
813   
814   // [27.4.5.3] basefield anipulators
815   /// Calls base.setf(ios_base::dec, ios_base::basefield).
816   inline ios_base& 
817   dec(ios_base& __base)
818   {
819     __base.setf(ios_base::dec, ios_base::basefield);
820     return __base;
821   }
822   
823   /// Calls base.setf(ios_base::hex, ios_base::basefield).
824   inline ios_base& 
825   hex(ios_base& __base)
826   {
827     __base.setf(ios_base::hex, ios_base::basefield);
828     return __base;
829   }
830
831   /// Calls base.setf(ios_base::oct, ios_base::basefield).
832   inline ios_base& 
833   oct(ios_base& __base)
834   {
835     __base.setf(ios_base::oct, ios_base::basefield);
836     return __base;
837   }
838   
839   // [27.4.5.4] floatfield anipulators
840   /// Calls base.setf(ios_base::fixed, ios_base::floatfield).
841   inline ios_base& 
842   fixed(ios_base& __base)
843   {
844     __base.setf(ios_base::fixed, ios_base::floatfield);
845     return __base;
846   }
847
848   /// Calls base.setf(ios_base::scientific, ios_base::floatfield).
849   inline ios_base& 
850   scientific(ios_base& __base)
851   {
852     __base.setf(ios_base::scientific, ios_base::floatfield);
853     return __base;
854   }
855
856 } // namespace std
857
858 #endif /* _CPP_BITS_IOSBASE_H */
859