Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / libstdc++-v3 / include / bits / ios_base.h
blobe6374243cebed692c2a7c000a9ff48d43ea5ede5
1 // Iostreams base classes -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
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.4 Iostreams base classes
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 _IOS_BASE_H
41 #define _IOS_BASE_H 1
43 #pragma GCC system_header
45 #include <bits/atomicity.h>
46 #include <bits/localefwd.h>
47 #include <bits/locale_classes.h>
49 namespace std
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
57 _S_boolalpha = 1L << 0,
58 _S_dec = 1L << 1,
59 _S_fixed = 1L << 2,
60 _S_hex = 1L << 3,
61 _S_internal = 1L << 4,
62 _S_left = 1L << 5,
63 _S_oct = 1L << 6,
64 _S_right = 1L << 7,
65 _S_scientific = 1L << 8,
66 _S_showbase = 1L << 9,
67 _S_showpoint = 1L << 10,
68 _S_showpos = 1L << 11,
69 _S_skipws = 1L << 12,
70 _S_unitbuf = 1L << 13,
71 _S_uppercase = 1L << 14,
72 _S_adjustfield = _S_left | _S_right | _S_internal,
73 _S_basefield = _S_dec | _S_oct | _S_hex,
74 _S_floatfield = _S_scientific | _S_fixed,
75 _S_ios_fmtflags_end = 1L << 16
78 inline _Ios_Fmtflags
79 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
80 { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
82 inline _Ios_Fmtflags
83 operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
84 { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
86 inline _Ios_Fmtflags
87 operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
88 { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
90 inline _Ios_Fmtflags&
91 operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
92 { return __a = __a | __b; }
94 inline _Ios_Fmtflags&
95 operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
96 { return __a = __a & __b; }
98 inline _Ios_Fmtflags&
99 operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
100 { return __a = __a ^ __b; }
102 inline _Ios_Fmtflags
103 operator~(_Ios_Fmtflags __a)
104 { return _Ios_Fmtflags(~static_cast<int>(__a)); }
107 enum _Ios_Openmode
109 _S_app = 1L << 0,
110 _S_ate = 1L << 1,
111 _S_bin = 1L << 2,
112 _S_in = 1L << 3,
113 _S_out = 1L << 4,
114 _S_trunc = 1L << 5,
115 _S_ios_openmode_end = 1L << 16
118 inline _Ios_Openmode
119 operator&(_Ios_Openmode __a, _Ios_Openmode __b)
120 { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
122 inline _Ios_Openmode
123 operator|(_Ios_Openmode __a, _Ios_Openmode __b)
124 { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
126 inline _Ios_Openmode
127 operator^(_Ios_Openmode __a, _Ios_Openmode __b)
128 { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
130 inline _Ios_Openmode&
131 operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
132 { return __a = __a | __b; }
134 inline _Ios_Openmode&
135 operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
136 { return __a = __a & __b; }
138 inline _Ios_Openmode&
139 operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
140 { return __a = __a ^ __b; }
142 inline _Ios_Openmode
143 operator~(_Ios_Openmode __a)
144 { return _Ios_Openmode(~static_cast<int>(__a)); }
147 enum _Ios_Iostate
149 _S_goodbit = 0,
150 _S_badbit = 1L << 0,
151 _S_eofbit = 1L << 1,
152 _S_failbit = 1L << 2,
153 _S_ios_iostate_end = 1L << 16
156 inline _Ios_Iostate
157 operator&(_Ios_Iostate __a, _Ios_Iostate __b)
158 { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
160 inline _Ios_Iostate
161 operator|(_Ios_Iostate __a, _Ios_Iostate __b)
162 { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
164 inline _Ios_Iostate
165 operator^(_Ios_Iostate __a, _Ios_Iostate __b)
166 { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
168 inline _Ios_Iostate&
169 operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
170 { return __a = __a | __b; }
172 inline _Ios_Iostate&
173 operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
174 { return __a = __a & __b; }
176 inline _Ios_Iostate&
177 operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
178 { return __a = __a ^ __b; }
180 inline _Ios_Iostate
181 operator~(_Ios_Iostate __a)
182 { return _Ios_Iostate(~static_cast<int>(__a)); }
184 enum _Ios_Seekdir
186 _S_beg = 0,
187 _S_cur = SEEK_CUR,
188 _S_end = SEEK_END,
189 _S_ios_seekdir_end = 1L << 16
192 // 27.4.2 Class ios_base
194 * @brief The base of the I/O class hierarchy.
196 * This class defines everything that can be defined about I/O that does
197 * not depend on the type of characters being input or output. Most
198 * people will only see @c ios_base when they need to specify the full
199 * name of the various I/O flags (e.g., the openmodes).
201 class ios_base
203 public:
205 // 27.4.2.1.1 Class ios_base::failure
206 /// These are thrown to indicate problems. Doc me.
207 class failure : public exception
209 public:
210 // _GLIBCXX_RESOLVE_LIB_DEFECTS
211 // 48. Use of non-existent exception constructor
212 explicit
213 failure(const string& __str) throw();
215 // This declaration is not useless:
216 // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
217 virtual
218 ~failure() throw();
220 virtual const char*
221 what() const throw();
223 private:
224 string _M_msg;
227 // 27.4.2.1.2 Type ios_base::fmtflags
229 * @brief This is a bitmask type.
231 * @c "_Ios_Fmtflags" is implementation-defined, but it is valid to
232 * perform bitwise operations on these values and expect the Right
233 * Thing to happen. Defined objects of type fmtflags are:
234 * - boolalpha
235 * - dec
236 * - fixed
237 * - hex
238 * - internal
239 * - left
240 * - oct
241 * - right
242 * - scientific
243 * - showbase
244 * - showpoint
245 * - showpos
246 * - skipws
247 * - unitbuf
248 * - uppercase
249 * - adjustfield
250 * - basefield
251 * - floatfield
253 typedef _Ios_Fmtflags fmtflags;
255 /// Insert/extract @c bool in alphabetic rather than numeric format.
256 static const fmtflags boolalpha = fmtflags(__ios_flags::_S_boolalpha);
258 /// Converts integer input or generates integer output in decimal base.
259 static const fmtflags dec = fmtflags(__ios_flags::_S_dec);
261 /// Generate floating-point output in fixed-point notation.
262 static const fmtflags fixed = fmtflags(__ios_flags::_S_fixed);
264 /// Converts integer input or generates integer output in hexadecimal base.
265 static const fmtflags hex = fmtflags(__ios_flags::_S_hex);
267 /// Adds fill characters at a designated internal point in certain
268 /// generated output, or identical to @c right if no such point is
269 /// designated.
270 static const fmtflags internal = fmtflags(__ios_flags::_S_internal);
272 /// Adds fill characters on the right (final positions) of certain
273 /// generated output. (I.e., the thing you print is flush left.)
274 static const fmtflags left = fmtflags(__ios_flags::_S_left);
276 /// Converts integer input or generates integer output in octal base.
277 static const fmtflags oct = fmtflags(__ios_flags::_S_oct);
279 /// Adds fill characters on the left (initial positions) of certain
280 /// generated output. (I.e., the thing you print is flush right.)
281 static const fmtflags right = fmtflags(__ios_flags::_S_right);
283 /// Generates floating-point output in scientific notation.
284 static const fmtflags scientific = fmtflags(__ios_flags::_S_scientific);
286 /// Generates a prefix indicating the numeric base of generated integer
287 /// output.
288 static const fmtflags showbase = fmtflags(__ios_flags::_S_showbase);
290 /// Generates a decimal-point character unconditionally in generated
291 /// floating-point output.
292 static const fmtflags showpoint = fmtflags(__ios_flags::_S_showpoint);
294 /// Generates a + sign in non-negative generated numeric output.
295 static const fmtflags showpos = fmtflags(__ios_flags::_S_showpos);
297 /// Skips leading white space before certain input operations.
298 static const fmtflags skipws = fmtflags(__ios_flags::_S_skipws);
300 /// Flushes output after each output operation.
301 static const fmtflags unitbuf = fmtflags(__ios_flags::_S_unitbuf);
303 /// Replaces certain lowercase letters with their uppercase equivalents
304 /// in generated output.
305 static const fmtflags uppercase = fmtflags(__ios_flags::_S_uppercase);
307 /// A mask of left|right|internal. Useful for the 2-arg form of @c setf.
308 static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
310 /// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf.
311 static const fmtflags basefield = fmtflags(__ios_flags::_S_basefield);
313 /// A mask of scientific|fixed. Useful for the 2-arg form of @c setf.
314 static const fmtflags floatfield = fmtflags(__ios_flags::_S_floatfield);
316 // 27.4.2.1.3 Type ios_base::iostate
318 * @brief This is a bitmask type.
320 * @c "_Ios_Iostate" is implementation-defined, but it is valid to
321 * perform bitwise operations on these values and expect the Right
322 * Thing to happen. Defined objects of type iostate are:
323 * - badbit
324 * - eofbit
325 * - failbit
326 * - goodbit
328 typedef _Ios_Iostate iostate;
330 /// Indicates a loss of integrity in an input or output sequence (such
331 /// as an irrecoverable read error from a file).
332 static const iostate badbit = iostate(__ios_flags::_S_badbit);
334 /// Indicates that an input operation reached the end of an input sequence.
335 static const iostate eofbit = iostate(__ios_flags::_S_eofbit);
337 /// Indicates that an input operation failed to read the expected
338 /// characters, or that an output operation failed to generate the
339 /// desired characters.
340 static const iostate failbit = iostate(__ios_flags::_S_failbit);
342 /// Indicates all is well.
343 static const iostate goodbit = iostate(0);
345 // 27.4.2.1.4 Type ios_base::openmode
347 * @brief This is a bitmask type.
349 * @c "_Ios_Openmode" is implementation-defined, but it is valid to
350 * perform bitwise operations on these values and expect the Right
351 * Thing to happen. Defined objects of type openmode are:
352 * - app
353 * - ate
354 * - binary
355 * - in
356 * - out
357 * - trunc
359 typedef _Ios_Openmode openmode;
361 /// Seek to end before each write.
362 static const openmode app = openmode(__ios_flags::_S_app);
364 /// Open and seek to end immediately after opening.
365 static const openmode ate = openmode(__ios_flags::_S_ate);
367 /// Perform input and output in binary mode (as opposed to text mode).
368 /// This is probably not what you think it is; see
369 /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and
370 /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.
371 static const openmode binary = openmode(__ios_flags::_S_bin);
373 /// Open for input. Default for @c ifstream and fstream.
374 static const openmode in = openmode(__ios_flags::_S_in);
376 /// Open for output. Default for @c ofstream and fstream.
377 static const openmode out = openmode(__ios_flags::_S_out);
379 /// Open for input. Default for @c ofstream.
380 static const openmode trunc = openmode(__ios_flags::_S_trunc);
382 // 27.4.2.1.5 Type ios_base::seekdir
384 * @brief This is an enumerated type.
386 * @c "_Ios_Seekdir" is implementation-defined. Defined values
387 * of type seekdir are:
388 * - beg
389 * - cur, equivalent to @c SEEK_CUR in the C standard library.
390 * - end, equivalent to @c SEEK_END in the C standard library.
392 typedef _Ios_Seekdir seekdir;
394 /// Request a seek relative to the beginning of the stream.
395 static const seekdir beg = seekdir(0);
397 /// Request a seek relative to the current position within the sequence.
398 static const seekdir cur = seekdir(SEEK_CUR);
400 /// Request a seek relative to the current end of the sequence.
401 static const seekdir end = seekdir(SEEK_END);
403 // Annex D.6
404 typedef int io_state;
405 typedef int open_mode;
406 typedef int seek_dir;
408 typedef std::streampos streampos;
409 typedef std::streamoff streamoff;
411 // Callbacks;
413 * @brief The set of events that may be passed to an event callback.
415 * erase_event is used during ~ios() and copyfmt(). imbue_event is used
416 * during imbue(). copyfmt_event is used during copyfmt().
418 enum event
420 erase_event,
421 imbue_event,
422 copyfmt_event
426 * @brief The type of an event callback function.
427 * @param event One of the members of the event enum.
428 * @param ios_base Reference to the ios_base object.
429 * @param int The integer provided when the callback was registered.
431 * Event callbacks are user defined functions that get called during
432 * several ios_base and basic_ios functions, specifically imbue(),
433 * copyfmt(), and ~ios().
435 typedef void (*event_callback) (event, ios_base&, int);
438 * @brief Add the callback __fn with parameter __index.
439 * @param __fn The function to add.
440 * @param __index The integer to pass to the function when invoked.
442 * Registers a function as an event callback with an integer parameter to
443 * be passed to the function when invoked. Multiple copies of the
444 * function are allowed. If there are multiple callbacks, they are
445 * invoked in the order they were registered.
447 void
448 register_callback(event_callback __fn, int __index);
450 protected:
451 //@{
453 * @if maint
454 * ios_base data members (doc me)
455 * @endif
457 streamsize _M_precision;
458 streamsize _M_width;
459 fmtflags _M_flags;
460 iostate _M_exception;
461 iostate _M_streambuf_state;
462 //@}
464 // 27.4.2.6 Members for callbacks
465 // 27.4.2.6 ios_base callbacks
466 struct _Callback_list
468 // Data Members
469 _Callback_list* _M_next;
470 ios_base::event_callback _M_fn;
471 int _M_index;
472 _Atomic_word _M_refcount; // 0 means one reference.
474 _Callback_list(ios_base::event_callback __fn, int __index,
475 _Callback_list* __cb)
476 : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
478 void
479 _M_add_reference() { __gnu_cxx::__atomic_add(&_M_refcount, 1); }
481 // 0 => OK to delete.
483 _M_remove_reference()
484 { return __gnu_cxx::__exchange_and_add(&_M_refcount, -1); }
487 _Callback_list* _M_callbacks;
489 void
490 _M_call_callbacks(event __ev) throw();
492 void
493 _M_dispose_callbacks(void);
495 // 27.4.2.5 Members for iword/pword storage
496 struct _Words
498 void* _M_pword;
499 long _M_iword;
500 _Words() : _M_pword(0), _M_iword(0) { }
503 // Only for failed iword/pword calls.
504 _Words _M_word_zero;
506 // Guaranteed storage.
507 // The first 5 iword and pword slots are reserved for internal use.
508 static const int _S_local_word_size = 8;
509 _Words _M_local_word[_S_local_word_size];
511 // Allocated storage.
512 int _M_word_size;
513 _Words* _M_word;
515 _Words&
516 _M_grow_words(int __index, bool __iword);
518 // Members for locale and locale caching.
519 locale _M_ios_locale;
521 void
522 _M_init();
524 public:
526 // 27.4.2.1.6 Class ios_base::Init
527 // Used to initialize standard streams. In theory, g++ could use
528 // -finit-priority to order this stuff correctly without going
529 // through these machinations.
530 class Init
532 friend class ios_base;
533 public:
534 Init();
535 ~Init();
537 private:
538 static _Atomic_word _S_refcount;
539 static bool _S_synced_with_stdio;
542 // [27.4.2.2] fmtflags state functions
544 * @brief Access to format flags.
545 * @return The format control flags for both input and output.
547 inline fmtflags
548 flags() const { return _M_flags; }
551 * @brief Setting new format flags all at once.
552 * @param fmtfl The new flags to set.
553 * @return The previous format control flags.
555 * This function overwrites all the format flags with @a fmtfl.
557 inline fmtflags
558 flags(fmtflags __fmtfl)
560 fmtflags __old = _M_flags;
561 _M_flags = __fmtfl;
562 return __old;
566 * @brief Setting new format flags.
567 * @param fmtfl Additional flags to set.
568 * @return The previous format control flags.
570 * This function sets additional flags in format control. Flags that
571 * were previously set remain set.
573 inline fmtflags
574 setf(fmtflags __fmtfl)
576 fmtflags __old = _M_flags;
577 _M_flags |= __fmtfl;
578 return __old;
582 * @brief Setting new format flags.
583 * @param fmtfl Additional flags to set.
584 * @param mask The flags mask for @a fmtfl.
585 * @return The previous format control flags.
587 * This function clears @a mask in the format flags, then sets
588 * @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield.
590 inline fmtflags
591 setf(fmtflags __fmtfl, fmtflags __mask)
593 fmtflags __old = _M_flags;
594 _M_flags &= ~__mask;
595 _M_flags |= (__fmtfl & __mask);
596 return __old;
600 * @brief Clearing format flags.
601 * @param mask The flags to unset.
603 * This function clears @a mask in the format flags.
605 inline void
606 unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
609 * @brief Flags access.
610 * @return The precision to generate on certain output operations.
612 * @if maint
613 * Be careful if you try to give a definition of "precision" here; see
614 * DR 189.
615 * @endif
617 inline streamsize
618 precision() const { return _M_precision; }
621 * @brief Changing flags.
622 * @param prec The new precision value.
623 * @return The previous value of precision().
625 inline streamsize
626 precision(streamsize __prec)
628 streamsize __old = _M_precision;
629 _M_precision = __prec;
630 return __old;
634 * @brief Flags access.
635 * @return The minimum field width to generate on output operations.
637 * "Minimum field width" refers to the number of characters.
639 inline streamsize
640 width() const { return _M_width; }
643 * @brief Changing flags.
644 * @param wide The new width value.
645 * @return The previous value of width().
647 inline streamsize
648 width(streamsize __wide)
650 streamsize __old = _M_width;
651 _M_width = __wide;
652 return __old;
655 // [27.4.2.4] ios_base static members
657 * @brief Interaction with the standard C I/O objects.
658 * @param sync Whether to synchronize or not.
659 * @return True if the standard streams were previously synchronized.
661 * The synchronization referred to is @e only that between the standard
662 * C facilities (e.g., stdout) and the standard C++ objects (e.g.,
663 * cout). User-declared streams are unaffected. See
664 * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for more.
666 static bool
667 sync_with_stdio(bool __sync = true);
669 // [27.4.2.3] ios_base locale functions
671 * @brief Setting a new locale.
672 * @param loc The new locale.
673 * @return The previous locale.
675 * Sets the new locale for this stream, and then invokes each callback
676 * with imbue_event.
678 locale
679 imbue(const locale& __loc);
682 * @brief Locale access
683 * @return A copy of the current locale.
685 * If @c imbue(loc) has previously been called, then this function
686 * returns @c loc. Otherwise, it returns a copy of @c std::locale(),
687 * the global C++ locale.
689 inline locale
690 getloc() const { return _M_ios_locale; }
693 * @brief Locale access
694 * @return A reference to the current locale.
696 * Like getloc above, but returns a reference instead of
697 * generating a copy.
699 inline const locale&
700 _M_getloc() const { return _M_ios_locale; }
702 // [27.4.2.5] ios_base storage functions
704 * @brief Access to unique indices.
705 * @return An integer different from all previous calls.
707 * This function returns a unique integer every time it is called. It
708 * can be used for any purpose, but is primarily intended to be a unique
709 * index for the iword and pword functions. The expectation is that an
710 * application calls xalloc in order to obtain an index in the iword and
711 * pword arrays that can be used without fear of conflict.
713 * The implementation maintains a static variable that is incremented and
714 * returned on each invocation. xalloc is guaranteed to return an index
715 * that is safe to use in the iword and pword arrays.
717 static int
718 xalloc() throw();
721 * @brief Access to integer array.
722 * @param __ix Index into the array.
723 * @return A reference to an integer associated with the index.
725 * The iword function provides access to an array of integers that can be
726 * used for any purpose. The array grows as required to hold the
727 * supplied index. All integers in the array are initialized to 0.
729 * The implementation reserves several indices. You should use xalloc to
730 * obtain an index that is safe to use. Also note that since the array
731 * can grow dynamically, it is not safe to hold onto the reference.
733 inline long&
734 iword(int __ix)
736 _Words& __word = (__ix < _M_word_size)
737 ? _M_word[__ix] : _M_grow_words(__ix, true);
738 return __word._M_iword;
742 * @brief Access to void pointer array.
743 * @param __ix Index into the array.
744 * @return A reference to a void* associated with the index.
746 * The pword function provides access to an array of pointers that can be
747 * used for any purpose. The array grows as required to hold the
748 * supplied index. All pointers in the array are initialized to 0.
750 * The implementation reserves several indices. You should use xalloc to
751 * obtain an index that is safe to use. Also note that since the array
752 * can grow dynamically, it is not safe to hold onto the reference.
754 inline void*&
755 pword(int __ix)
757 _Words& __word = (__ix < _M_word_size)
758 ? _M_word[__ix] : _M_grow_words(__ix, false);
759 return __word._M_pword;
762 // Destructor
764 * Invokes each callback with erase_event. Destroys local storage.
766 * Note that the ios_base object for the standard streams never gets
767 * destroyed. As a result, any callbacks registered with the standard
768 * streams will not get invoked with erase_event (unless copyfmt is
769 * used).
771 virtual ~ios_base();
773 protected:
774 ios_base();
776 // _GLIBCXX_RESOLVE_LIB_DEFECTS
777 // 50. Copy constructor and assignment operator of ios_base
778 private:
779 ios_base(const ios_base&);
781 ios_base&
782 operator=(const ios_base&);
785 // [27.4.5.1] fmtflags manipulators
786 /// Calls base.setf(ios_base::boolalpha).
787 inline ios_base&
788 boolalpha(ios_base& __base)
790 __base.setf(ios_base::boolalpha);
791 return __base;
794 /// Calls base.unsetf(ios_base::boolalpha).
795 inline ios_base&
796 noboolalpha(ios_base& __base)
798 __base.unsetf(ios_base::boolalpha);
799 return __base;
802 /// Calls base.setf(ios_base::showbase).
803 inline ios_base&
804 showbase(ios_base& __base)
806 __base.setf(ios_base::showbase);
807 return __base;
810 /// Calls base.unsetf(ios_base::showbase).
811 inline ios_base&
812 noshowbase(ios_base& __base)
814 __base.unsetf(ios_base::showbase);
815 return __base;
818 /// Calls base.setf(ios_base::showpoint).
819 inline ios_base&
820 showpoint(ios_base& __base)
822 __base.setf(ios_base::showpoint);
823 return __base;
826 /// Calls base.unsetf(ios_base::showpoint).
827 inline ios_base&
828 noshowpoint(ios_base& __base)
830 __base.unsetf(ios_base::showpoint);
831 return __base;
834 /// Calls base.setf(ios_base::showpos).
835 inline ios_base&
836 showpos(ios_base& __base)
838 __base.setf(ios_base::showpos);
839 return __base;
842 /// Calls base.unsetf(ios_base::showpos).
843 inline ios_base&
844 noshowpos(ios_base& __base)
846 __base.unsetf(ios_base::showpos);
847 return __base;
850 /// Calls base.setf(ios_base::skipws).
851 inline ios_base&
852 skipws(ios_base& __base)
854 __base.setf(ios_base::skipws);
855 return __base;
858 /// Calls base.unsetf(ios_base::skipws).
859 inline ios_base&
860 noskipws(ios_base& __base)
862 __base.unsetf(ios_base::skipws);
863 return __base;
866 /// Calls base.setf(ios_base::uppercase).
867 inline ios_base&
868 uppercase(ios_base& __base)
870 __base.setf(ios_base::uppercase);
871 return __base;
874 /// Calls base.unsetf(ios_base::uppercase).
875 inline ios_base&
876 nouppercase(ios_base& __base)
878 __base.unsetf(ios_base::uppercase);
879 return __base;
882 /// Calls base.setf(ios_base::unitbuf).
883 inline ios_base&
884 unitbuf(ios_base& __base)
886 __base.setf(ios_base::unitbuf);
887 return __base;
890 /// Calls base.unsetf(ios_base::unitbuf).
891 inline ios_base&
892 nounitbuf(ios_base& __base)
894 __base.unsetf(ios_base::unitbuf);
895 return __base;
898 // [27.4.5.2] adjustfield anipulators
899 /// Calls base.setf(ios_base::internal, ios_base::adjustfield).
900 inline ios_base&
901 internal(ios_base& __base)
903 __base.setf(ios_base::internal, ios_base::adjustfield);
904 return __base;
907 /// Calls base.setf(ios_base::left, ios_base::adjustfield).
908 inline ios_base&
909 left(ios_base& __base)
911 __base.setf(ios_base::left, ios_base::adjustfield);
912 return __base;
915 /// Calls base.setf(ios_base::right, ios_base::adjustfield).
916 inline ios_base&
917 right(ios_base& __base)
919 __base.setf(ios_base::right, ios_base::adjustfield);
920 return __base;
923 // [27.4.5.3] basefield anipulators
924 /// Calls base.setf(ios_base::dec, ios_base::basefield).
925 inline ios_base&
926 dec(ios_base& __base)
928 __base.setf(ios_base::dec, ios_base::basefield);
929 return __base;
932 /// Calls base.setf(ios_base::hex, ios_base::basefield).
933 inline ios_base&
934 hex(ios_base& __base)
936 __base.setf(ios_base::hex, ios_base::basefield);
937 return __base;
940 /// Calls base.setf(ios_base::oct, ios_base::basefield).
941 inline ios_base&
942 oct(ios_base& __base)
944 __base.setf(ios_base::oct, ios_base::basefield);
945 return __base;
948 // [27.4.5.4] floatfield anipulators
949 /// Calls base.setf(ios_base::fixed, ios_base::floatfield).
950 inline ios_base&
951 fixed(ios_base& __base)
953 __base.setf(ios_base::fixed, ios_base::floatfield);
954 return __base;
957 /// Calls base.setf(ios_base::scientific, ios_base::floatfield).
958 inline ios_base&
959 scientific(ios_base& __base)
961 __base.setf(ios_base::scientific, ios_base::floatfield);
962 return __base;
964 } // namespace std
966 #endif /* _IOS_BASE_H */