2002-11-21 Phil Edwards <pme@gcc.gnu.org>
[official-gcc.git] / libstdc++-v3 / include / bits / ios_base.h
blob1f085d9e4e717c487e54d9c84f508e5b7de98dcc
1 // Iostreams base classes -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
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.
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.
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.
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.
32 // ISO C++ 14882: 27.8 File-based streams
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.
40 #ifndef _CPP_BITS_IOSBASE_H
41 #define _CPP_BITS_IOSBASE_H 1
43 #pragma GCC system_header
45 #include <bits/atomicity.h>
47 namespace std
49 // The following definitions of bitmask types are enums, not ints,
50 // as permitted (but not required) in the standard, in order to provide
51 // better type safety in iostream calls. A side effect is that
52 // expressions involving them are no longer compile-time constants.
53 enum _Ios_Fmtflags { _M_ios_fmtflags_end = 1L << 16 };
55 inline _Ios_Fmtflags
56 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
57 { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
59 inline _Ios_Fmtflags
60 operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
61 { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
63 inline _Ios_Fmtflags
64 operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
65 { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
67 inline _Ios_Fmtflags
68 operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
69 { return __a = __a | __b; }
71 inline _Ios_Fmtflags
72 operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
73 { return __a = __a & __b; }
75 inline _Ios_Fmtflags
76 operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
77 { return __a = __a ^ __b; }
79 inline _Ios_Fmtflags
80 operator~(_Ios_Fmtflags __a)
81 { return _Ios_Fmtflags(~static_cast<int>(__a)); }
84 enum _Ios_Openmode { _M_ios_openmode_end = 1L << 16 };
86 inline _Ios_Openmode
87 operator&(_Ios_Openmode __a, _Ios_Openmode __b)
88 { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
90 inline _Ios_Openmode
91 operator|(_Ios_Openmode __a, _Ios_Openmode __b)
92 { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
94 inline _Ios_Openmode
95 operator^(_Ios_Openmode __a, _Ios_Openmode __b)
96 { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
98 inline _Ios_Openmode
99 operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
100 { return __a = __a | __b; }
102 inline _Ios_Openmode
103 operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
104 { return __a = __a & __b; }
106 inline _Ios_Openmode
107 operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
108 { return __a = __a ^ __b; }
110 inline _Ios_Openmode
111 operator~(_Ios_Openmode __a)
112 { return _Ios_Openmode(~static_cast<int>(__a)); }
115 enum _Ios_Iostate { _M_ios_iostate_end = 1L << 16 };
117 inline _Ios_Iostate
118 operator&(_Ios_Iostate __a, _Ios_Iostate __b)
119 { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
121 inline _Ios_Iostate
122 operator|(_Ios_Iostate __a, _Ios_Iostate __b)
123 { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
125 inline _Ios_Iostate
126 operator^(_Ios_Iostate __a, _Ios_Iostate __b)
127 { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
129 inline _Ios_Iostate
130 operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
131 { return __a = __a | __b; }
133 inline _Ios_Iostate
134 operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
135 { return __a = __a & __b; }
137 inline _Ios_Iostate
138 operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
139 { return __a = __a ^ __b; }
141 inline _Ios_Iostate
142 operator~(_Ios_Iostate __a)
143 { return _Ios_Iostate(~static_cast<int>(__a)); }
145 enum _Ios_Seekdir { _M_ios_seekdir_end = 1L << 16 };
147 // 27.4.2 Class ios_base
149 * @brief The very top of the I/O class hierarchy.
151 * This class defines everything that can be defined about I/O that does
152 * not depend on the type of characters being input or output. Most
153 * people will only see @c ios_base when they need to specify the full
154 * name of the various I/O flags (e.g., the openmodes).
156 class ios_base
158 public:
160 // 27.4.2.1.1 Class ios_base::failure
161 /// These are thrown to indicate problems. Doc me.
162 class failure : public exception
164 public:
165 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
166 //48. Use of non-existent exception constructor
167 explicit
168 failure(const string& __str) throw();
170 // This declaration is not useless:
171 // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
172 virtual
173 ~failure() throw();
175 virtual const char*
176 what() const throw();
178 private:
179 enum { _M_bufsize = 256 };
180 char _M_name[_M_bufsize];
181 #endif
184 // 27.4.2.1.2 Type ios_base::fmtflags
186 * @brief This is a bitmask type.
188 * @c "_Ios_Fmtflags" is implementation-defined, but it is valid to
189 * perform bitwise operations on these values and expect the Right
190 * Thing to happen. Defined objects of type fmtflags are:
191 * - boolalpha
192 * - dec
193 * - fixed
194 * - hex
195 * - internal
196 * - left
197 * - oct
198 * - right
199 * - scientific
200 * - showbase
201 * - showpoint
202 * - showpos
203 * - skipws
204 * - unitbuf
205 * - uppercase
206 * - adjustfield
207 * - basefield
208 * - floatfield
210 typedef _Ios_Fmtflags fmtflags;
211 /// Insert/extract @c bool in alphabetic rather than numeric format.
212 static const fmtflags boolalpha = fmtflags(__ios_flags::_S_boolalpha);
213 /// Converts integer input or generates integer output in decimal base.
214 static const fmtflags dec = fmtflags(__ios_flags::_S_dec);
215 /// Generate floating-point output in fixed-point notation.
216 static const fmtflags fixed = fmtflags(__ios_flags::_S_fixed);
217 /// Converts integer input or generates integer output in hexadecimal base.
218 static const fmtflags hex = fmtflags(__ios_flags::_S_hex);
219 /// Adds fill characters at a designated internal point in certain
220 /// generated output, or identical to @c right if no such point is
221 /// designated.
222 static const fmtflags internal = fmtflags(__ios_flags::_S_internal);
223 /// Adds fill characters on the right (final positions) of certain
224 /// generated output. (I.e., the thing you print is flush left.)
225 static const fmtflags left = fmtflags(__ios_flags::_S_left);
226 /// Converts integer input or generates integer output in octal base.
227 static const fmtflags oct = fmtflags(__ios_flags::_S_oct);
228 /// Adds fill characters on the left (initial positions) of certain
229 /// generated output. (I.e., the thing you print is flush right.)
230 static const fmtflags right = fmtflags(__ios_flags::_S_right);
231 /// Generates floating-point output in scientific notation.
232 static const fmtflags scientific = fmtflags(__ios_flags::_S_scientific);
233 /// Generates a prefix indicating the numeric base of generated integer
234 /// output.
235 static const fmtflags showbase = fmtflags(__ios_flags::_S_showbase);
236 /// Generates a decimal-point character unconditionally in generated
237 /// floating-point output.
238 static const fmtflags showpoint = fmtflags(__ios_flags::_S_showpoint);
239 /// Generates a + sign in non-negative generated numeric output.
240 static const fmtflags showpos = fmtflags(__ios_flags::_S_showpos);
241 /// Skips leading white space before certain input operations.
242 static const fmtflags skipws = fmtflags(__ios_flags::_S_skipws);
243 /// Flushes output after each output operation.
244 static const fmtflags unitbuf = fmtflags(__ios_flags::_S_unitbuf);
245 /// Replaces certain lowercase letters with their uppercase equivalents
246 /// in generated output.
247 static const fmtflags uppercase = fmtflags(__ios_flags::_S_uppercase);
248 /// A mask of left|right|internal. Useful for the 2-arg form of @c setf.
249 static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
250 /// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf.
251 static const fmtflags basefield = fmtflags(__ios_flags::_S_basefield);
252 /// A mask of scientific|fixed. Useful for the 2-arg form of @c setf.
253 static const fmtflags floatfield = fmtflags(__ios_flags::_S_floatfield);
255 // 27.4.2.1.3 Type ios_base::iostate
257 * @brief This is a bitmask type.
259 * @c "_Ios_Iostate" is implementation-defined, but it is valid to
260 * perform bitwise operations on these values and expect the Right
261 * Thing to happen. Defined objects of type iostate are:
262 * - badbit
263 * - eofbit
264 * - failbit
265 * - goodbit
267 typedef _Ios_Iostate iostate;
268 /// Indicates a loss of integrity in an input or output sequence (such
269 /// as an irrecoverable read error from a file).
270 static const iostate badbit = iostate(__ios_flags::_S_badbit);
271 /// Indicates that an input operation reached the end of an input sequence.
272 static const iostate eofbit = iostate(__ios_flags::_S_eofbit);
273 /// Indicates that an input operation failed to read the expected
274 /// characters, or that an output operation failed to generate the
275 /// desired characters.
276 static const iostate failbit = iostate(__ios_flags::_S_failbit);
277 /// Indicates all is well.
278 static const iostate goodbit = iostate(0);
280 // 27.4.2.1.4 Type ios_base::openmode
282 * @brief This is a bitmask type.
284 * @c "_Ios_Openmode" is implementation-defined, but it is valid to
285 * perform bitwise operations on these values and expect the Right
286 * Thing to happen. Defined objects of type openmode are:
287 * - app
288 * - ate
289 * - binary
290 * - in
291 * - out
292 * - trunc
294 typedef _Ios_Openmode openmode;
295 /// Seek to end before each write.
296 static const openmode app = openmode(__ios_flags::_S_app);
297 /// Open and seek to end immediately after opening.
298 static const openmode ate = openmode(__ios_flags::_S_ate);
299 /// Perform input and output in binary mode (as opposed to text mode).
300 /// This is probably not what you think it is; see
301 /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and
302 /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.
303 static const openmode binary = openmode(__ios_flags::_S_bin);
304 /// Open for input. Default for @c ifstream and fstream.
305 static const openmode in = openmode(__ios_flags::_S_in);
306 /// Open for output. Default for @c ofstream and fstream.
307 static const openmode out = openmode(__ios_flags::_S_out);
308 /// Open for input. Default for @c ofstream.
309 static const openmode trunc = openmode(__ios_flags::_S_trunc);
311 // 27.4.2.1.5 Type ios_base::seekdir
313 * @brief This is an enumerated type.
315 * @c "_Ios_Seekdir" is implementation-defined. Defined values
316 * of type seekdir are:
317 * - beg
318 * - cur, equivalent to @c SEEK_CUR in the C standard library.
319 * - end, equivalent to @c SEEK_END in the C standard library.
321 typedef _Ios_Seekdir seekdir;
322 /// Request a seek relative to the beginning of the stream.
323 static const seekdir beg = seekdir(0);
324 /// Request a seek relative to the current position within the sequence.
325 static const seekdir cur = seekdir(SEEK_CUR);
326 /// Request a seek relative to the current end of the sequence.
327 static const seekdir end = seekdir(SEEK_END);
329 #ifdef _GLIBCPP_DEPRECATED
330 // Annex D.6
331 typedef int io_state;
332 typedef int open_mode;
333 typedef int seek_dir;
335 typedef std::streampos streampos;
336 typedef std::streamoff streamoff;
337 #endif
339 // Callbacks;
341 * @doctodo
343 enum event
345 erase_event,
346 imbue_event,
347 copyfmt_event
351 * @doctodo
353 typedef void (*event_callback) (event, ios_base&, int);
356 * @doctodo
358 void
359 register_callback(event_callback __fn, int __index);
361 protected:
362 //@{
364 * @if maint
365 * ios_base data members (doc me)
366 * @endif
368 streamsize _M_precision;
369 streamsize _M_width;
370 fmtflags _M_flags;
371 iostate _M_exception;
372 iostate _M_streambuf_state;
373 //@}
375 // 27.4.2.6 Members for callbacks
376 // 27.4.2.6 ios_base callbacks
377 struct _Callback_list
379 // Data Members
380 _Callback_list* _M_next;
381 ios_base::event_callback _M_fn;
382 int _M_index;
383 _Atomic_word _M_refcount; // 0 means one reference.
385 _Callback_list(ios_base::event_callback __fn, int __index,
386 _Callback_list* __cb)
387 : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
389 void
390 _M_add_reference() { __atomic_add(&_M_refcount, 1); }
392 // 0 => OK to delete.
393 int
394 _M_remove_reference() { return __exchange_and_add(&_M_refcount, -1); }
397 _Callback_list* _M_callbacks;
399 void
400 _M_call_callbacks(event __ev) throw();
402 void
403 _M_dispose_callbacks(void);
405 // 27.4.2.5 Members for iword/pword storage
406 struct _Words
408 void* _M_pword;
409 long _M_iword;
410 _Words() : _M_pword(0), _M_iword(0) { }
413 // Only for failed iword/pword calls.
414 _Words _M_word_zero;
416 // Guaranteed storage.
417 static const int _S_local_word_size = 8;
418 _Words _M_local_word[_S_local_word_size];
420 // Allocated storage.
421 int _M_word_size;
422 _Words* _M_word;
424 _Words&
425 _M_grow_words(int __index);
427 // Members for locale and locale caching.
428 locale _M_ios_locale;
430 void
431 _M_init();
433 public:
435 // 27.4.2.1.6 Class ios_base::Init
436 // Used to initialize standard streams. In theory, g++ could use
437 // -finit-priority to order this stuff correctly without going
438 // through these machinations.
439 class Init
441 friend class ios_base;
442 public:
443 Init();
444 ~Init();
446 static void
447 _S_ios_create(bool __sync);
449 static void
450 _S_ios_destroy();
452 private:
453 static int _S_ios_base_init;
454 static bool _S_synced_with_stdio;
457 // [27.4.2.2] fmtflags state functions
459 * @brief Access to format flags.
460 * @return The format control flags for both input and output.
462 inline fmtflags
463 flags() const { return _M_flags; }
466 * @brief Setting new format flags all at once.
467 * @param fmtfl The new flags to set.
468 * @return The previous format control flags.
470 * This function overwrites all the format flags with @a fmtfl.
472 inline fmtflags
473 flags(fmtflags __fmtfl)
475 fmtflags __old = _M_flags;
476 _M_flags = __fmtfl;
477 return __old;
481 * @brief Setting new format flags.
482 * @param fmtfl Additional flags to set.
483 * @return The previous format control flags.
485 * This function sets additional flags in format control. Flags that
486 * were previously set remain set.
488 inline fmtflags
489 setf(fmtflags __fmtfl)
491 fmtflags __old = _M_flags;
492 _M_flags |= __fmtfl;
493 return __old;
497 * @brief Setting new format flags.
498 * @param fmtfl Additional flags to set.
499 * @param mask The flags mask for @a fmtfl.
500 * @return The previous format control flags.
502 * This function clears @a mask in the format flags, then sets
503 * @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield.
505 inline fmtflags
506 setf(fmtflags __fmtfl, fmtflags __mask)
508 fmtflags __old = _M_flags;
509 _M_flags &= ~__mask;
510 _M_flags |= (__fmtfl & __mask);
511 return __old;
515 * @brief Clearing format flags.
516 * @param mask The flags to unset.
518 * This function clears @a mask in the format flags.
520 inline void
521 unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
524 * @brief Flags access.
525 * @return The precision to generate on certain output operations.
527 * @if maint
528 * Be careful if you try to give a definition of "precision" here; see
529 * DR 189.
530 * @endif
532 inline streamsize
533 precision() const { return _M_precision; }
536 * @brief Changing flags.
537 * @param prec The new precision value.
538 * @return The previous value of precision().
540 inline streamsize
541 precision(streamsize __prec)
543 streamsize __old = _M_precision;
544 _M_precision = __prec;
545 return __old;
549 * @brief Flags access.
550 * @return The minimum field width to generate on output operations.
552 * "Minimum field width" refers to the number of characters.
554 inline streamsize
555 width() const { return _M_width; }
558 * @brief Changing flags.
559 * @param wide The new width value.
560 * @return The previous value of width().
562 inline streamsize
563 width(streamsize __wide)
565 streamsize __old = _M_width;
566 _M_width = __wide;
567 return __old;
570 // [27.4.2.4] ios_base static members
572 * @brief Interaction with the standard C I/O objects.
573 * @param sync Whether to synchronize or not.
574 * @return True if the standard streams were previously synchronized.
576 * The synchronization referred to is @e only that between the standard
577 * C facilities (e.g., stdout) and the standard C++ objects (e.g.,
578 * cout). User-declared streams are unaffected. See
579 * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for more.
581 static bool
582 sync_with_stdio(bool __sync = true);
584 // [27.4.2.3] ios_base locale functions
586 * @brief Setting a new locale.
587 * @param loc The new locale.
588 * @return The previous locale.
590 * Sets the new locale for this stream, and
591 * [XXX does something with callbacks].
593 locale
594 imbue(const locale& __loc);
597 * @brief Locale access
598 * @return The locale currently in effect.
600 * If @c imbue(loc) has previously been called, then this function
601 * returns @c loc. Otherwise, it returns a copy of @c std::locale(),
602 * the global C++ locale.
604 inline locale
605 getloc() const { return _M_ios_locale; }
607 // [27.4.2.5] ios_base storage functions
609 * @doctodo
611 static int
612 xalloc() throw();
615 * @doctodo
617 inline long&
618 iword(int __ix)
620 _Words& __word = (__ix < _M_word_size)
621 ? _M_word[__ix] : _M_grow_words(__ix);
622 return __word._M_iword;
626 * @doctodo
628 inline void*&
629 pword(int __ix)
631 _Words& __word = (__ix < _M_word_size)
632 ? _M_word[__ix] : _M_grow_words(__ix);
633 return __word._M_pword;
636 // Destructor
638 * Destroys local storage and
639 * [XXX does something with callbacks].
641 virtual ~ios_base();
643 protected:
644 ios_base();
646 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
647 //50. Copy constructor and assignment operator of ios_base
648 private:
649 ios_base(const ios_base&);
651 ios_base&
652 operator=(const ios_base&);
653 #endif
656 // [27.4.5.1] fmtflags manipulators
657 /// Calls base.setf(ios_base::boolalpha).
658 inline ios_base&
659 boolalpha(ios_base& __base)
661 __base.setf(ios_base::boolalpha);
662 return __base;
665 /// Calls base.unsetf(ios_base::boolalpha).
666 inline ios_base&
667 noboolalpha(ios_base& __base)
669 __base.unsetf(ios_base::boolalpha);
670 return __base;
673 /// Calls base.setf(ios_base::showbase).
674 inline ios_base&
675 showbase(ios_base& __base)
677 __base.setf(ios_base::showbase);
678 return __base;
681 /// Calls base.unsetf(ios_base::showbase).
682 inline ios_base&
683 noshowbase(ios_base& __base)
685 __base.unsetf(ios_base::showbase);
686 return __base;
689 /// Calls base.setf(ios_base::showpoint).
690 inline ios_base&
691 showpoint(ios_base& __base)
693 __base.setf(ios_base::showpoint);
694 return __base;
697 /// Calls base.unsetf(ios_base::showpoint).
698 inline ios_base&
699 noshowpoint(ios_base& __base)
701 __base.unsetf(ios_base::showpoint);
702 return __base;
705 /// Calls base.setf(ios_base::showpos).
706 inline ios_base&
707 showpos(ios_base& __base)
709 __base.setf(ios_base::showpos);
710 return __base;
713 /// Calls base.unsetf(ios_base::showpos).
714 inline ios_base&
715 noshowpos(ios_base& __base)
717 __base.unsetf(ios_base::showpos);
718 return __base;
721 /// Calls base.setf(ios_base::skipws).
722 inline ios_base&
723 skipws(ios_base& __base)
725 __base.setf(ios_base::skipws);
726 return __base;
729 /// Calls base.unsetf(ios_base::skipws).
730 inline ios_base&
731 noskipws(ios_base& __base)
733 __base.unsetf(ios_base::skipws);
734 return __base;
737 /// Calls base.setf(ios_base::uppercase).
738 inline ios_base&
739 uppercase(ios_base& __base)
741 __base.setf(ios_base::uppercase);
742 return __base;
745 /// Calls base.unsetf(ios_base::uppercase).
746 inline ios_base&
747 nouppercase(ios_base& __base)
749 __base.unsetf(ios_base::uppercase);
750 return __base;
753 /// Calls base.setf(ios_base::unitbuf).
754 inline ios_base&
755 unitbuf(ios_base& __base)
757 __base.setf(ios_base::unitbuf);
758 return __base;
761 /// Calls base.unsetf(ios_base::unitbuf).
762 inline ios_base&
763 nounitbuf(ios_base& __base)
765 __base.unsetf(ios_base::unitbuf);
766 return __base;
769 // [27.4.5.2] adjustfield anipulators
770 /// Calls base.setf(ios_base::internal, ios_base::adjustfield).
771 inline ios_base&
772 internal(ios_base& __base)
774 __base.setf(ios_base::internal, ios_base::adjustfield);
775 return __base;
778 /// Calls base.setf(ios_base::left, ios_base::adjustfield).
779 inline ios_base&
780 left(ios_base& __base)
782 __base.setf(ios_base::left, ios_base::adjustfield);
783 return __base;
786 /// Calls base.setf(ios_base::right, ios_base::adjustfield).
787 inline ios_base&
788 right(ios_base& __base)
790 __base.setf(ios_base::right, ios_base::adjustfield);
791 return __base;
794 // [27.4.5.3] basefield anipulators
795 /// Calls base.setf(ios_base::dec, ios_base::basefield).
796 inline ios_base&
797 dec(ios_base& __base)
799 __base.setf(ios_base::dec, ios_base::basefield);
800 return __base;
803 /// Calls base.setf(ios_base::hex, ios_base::basefield).
804 inline ios_base&
805 hex(ios_base& __base)
807 __base.setf(ios_base::hex, ios_base::basefield);
808 return __base;
811 /// Calls base.setf(ios_base::oct, ios_base::basefield).
812 inline ios_base&
813 oct(ios_base& __base)
815 __base.setf(ios_base::oct, ios_base::basefield);
816 return __base;
819 // [27.4.5.4] floatfield anipulators
820 /// Calls base.setf(ios_base::fixed, ios_base::floatfield).
821 inline ios_base&
822 fixed(ios_base& __base)
824 __base.setf(ios_base::fixed, ios_base::floatfield);
825 return __base;
828 /// Calls base.setf(ios_base::scientific, ios_base::floatfield).
829 inline ios_base&
830 scientific(ios_base& __base)
832 __base.setf(ios_base::scientific, ios_base::floatfield);
833 return __base;
836 } // namespace std
838 #endif /* _CPP_BITS_IOSBASE_H */