aboutsummaryrefslogtreecommitdiff
path: root/contrib/libstdc++/include/bits/ios_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libstdc++/include/bits/ios_base.h')
-rw-r--r--contrib/libstdc++/include/bits/ios_base.h440
1 files changed, 254 insertions, 186 deletions
diff --git a/contrib/libstdc++/include/bits/ios_base.h b/contrib/libstdc++/include/bits/ios_base.h
index 3437f847c4a8..694785df1f55 100644
--- a/contrib/libstdc++/include/bits/ios_base.h
+++ b/contrib/libstdc++/include/bits/ios_base.h
@@ -1,6 +1,6 @@
// Iostreams base classes -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -29,7 +29,7 @@
// the GNU General Public License.
//
-// ISO C++ 14882: 27.8 File-based streams
+// ISO C++ 14882: 27.4 Iostreams base classes
//
/** @file ios_base.h
@@ -37,8 +37,8 @@
* You should not attempt to use it directly.
*/
-#ifndef _CPP_BITS_IOSBASE_H
-#define _CPP_BITS_IOSBASE_H 1
+#ifndef _IOS_BASE_H
+#define _IOS_BASE_H 1
#pragma GCC system_header
@@ -52,99 +52,99 @@ namespace std
// as permitted (but not required) in the standard, in order to provide
// better type safety in iostream calls. A side effect is that
// expressions involving them are no longer compile-time constants.
- enum _Ios_Fmtflags { _M_ios_fmtflags_end = 1L << 16 };
+ enum _Ios_Fmtflags { _S_ios_fmtflags_end = 1L << 16 };
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags
operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags
operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags
operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a | __b; }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a & __b; }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a ^ __b; }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags
operator~(_Ios_Fmtflags __a)
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
- enum _Ios_Openmode { _M_ios_openmode_end = 1L << 16 };
+ enum _Ios_Openmode { _S_ios_openmode_end = 1L << 16 };
- inline _Ios_Openmode
+ inline _Ios_Openmode
operator&(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _Ios_Openmode
+ inline _Ios_Openmode
operator|(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _Ios_Openmode
+ inline _Ios_Openmode
operator^(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Openmode
+ inline _Ios_Openmode
operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a | __b; }
- inline _Ios_Openmode
+ inline _Ios_Openmode
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a & __b; }
- inline _Ios_Openmode
+ inline _Ios_Openmode
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a ^ __b; }
- inline _Ios_Openmode
+ inline _Ios_Openmode
operator~(_Ios_Openmode __a)
{ return _Ios_Openmode(~static_cast<int>(__a)); }
- enum _Ios_Iostate { _M_ios_iostate_end = 1L << 16 };
+ enum _Ios_Iostate { _S_ios_iostate_end = 1L << 16 };
- inline _Ios_Iostate
+ inline _Ios_Iostate
operator&(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _Ios_Iostate
+ inline _Ios_Iostate
operator|(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _Ios_Iostate
+ inline _Ios_Iostate
operator^(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Iostate
+ inline _Ios_Iostate
operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a | __b; }
- inline _Ios_Iostate
+ inline _Ios_Iostate
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a & __b; }
- inline _Ios_Iostate
+ inline _Ios_Iostate
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a ^ __b; }
- inline _Ios_Iostate
+ inline _Ios_Iostate
operator~(_Ios_Iostate __a)
{ return _Ios_Iostate(~static_cast<int>(__a)); }
- enum _Ios_Seekdir { _M_ios_seekdir_end = 1L << 16 };
+ enum _Ios_Seekdir { _S_ios_seekdir_end = 1L << 16 };
// 27.4.2 Class ios_base
/**
@@ -158,29 +158,27 @@ namespace std
class ios_base
{
public:
-
+
// 27.4.2.1.1 Class ios_base::failure
/// These are thrown to indicate problems. Doc me.
class failure : public exception
{
public:
-#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
- //48. Use of non-existent exception constructor
- explicit
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 48. Use of non-existent exception constructor
+ explicit
failure(const string& __str) throw();
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
- virtual
+ virtual
~failure() throw();
virtual const char*
what() const throw();
-
+
private:
- enum { _M_bufsize = 256 };
- char _M_name[_M_bufsize];
-#endif
+ string _M_msg;
};
// 27.4.2.1.2 Type ios_base::fmtflags
@@ -210,47 +208,65 @@ namespace std
* - floatfield
*/
typedef _Ios_Fmtflags fmtflags;
+
/// Insert/extract @c bool in alphabetic rather than numeric format.
static const fmtflags boolalpha = fmtflags(__ios_flags::_S_boolalpha);
+
/// Converts integer input or generates integer output in decimal base.
static const fmtflags dec = fmtflags(__ios_flags::_S_dec);
+
/// Generate floating-point output in fixed-point notation.
static const fmtflags fixed = fmtflags(__ios_flags::_S_fixed);
+
/// Converts integer input or generates integer output in hexadecimal base.
static const fmtflags hex = fmtflags(__ios_flags::_S_hex);
+
/// Adds fill characters at a designated internal point in certain
/// generated output, or identical to @c right if no such point is
/// designated.
static const fmtflags internal = fmtflags(__ios_flags::_S_internal);
+
/// Adds fill characters on the right (final positions) of certain
/// generated output. (I.e., the thing you print is flush left.)
static const fmtflags left = fmtflags(__ios_flags::_S_left);
+
/// Converts integer input or generates integer output in octal base.
static const fmtflags oct = fmtflags(__ios_flags::_S_oct);
+
/// Adds fill characters on the left (initial positions) of certain
/// generated output. (I.e., the thing you print is flush right.)
static const fmtflags right = fmtflags(__ios_flags::_S_right);
+
/// Generates floating-point output in scientific notation.
static const fmtflags scientific = fmtflags(__ios_flags::_S_scientific);
+
/// Generates a prefix indicating the numeric base of generated integer
/// output.
static const fmtflags showbase = fmtflags(__ios_flags::_S_showbase);
+
/// Generates a decimal-point character unconditionally in generated
/// floating-point output.
static const fmtflags showpoint = fmtflags(__ios_flags::_S_showpoint);
+
/// Generates a + sign in non-negative generated numeric output.
static const fmtflags showpos = fmtflags(__ios_flags::_S_showpos);
+
/// Skips leading white space before certain input operations.
static const fmtflags skipws = fmtflags(__ios_flags::_S_skipws);
+
/// Flushes output after each output operation.
static const fmtflags unitbuf = fmtflags(__ios_flags::_S_unitbuf);
+
/// Replaces certain lowercase letters with their uppercase equivalents
/// in generated output.
static const fmtflags uppercase = fmtflags(__ios_flags::_S_uppercase);
+
/// A mask of left|right|internal. Useful for the 2-arg form of @c setf.
static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
+
/// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf.
static const fmtflags basefield = fmtflags(__ios_flags::_S_basefield);
+
/// A mask of scientific|fixed. Useful for the 2-arg form of @c setf.
static const fmtflags floatfield = fmtflags(__ios_flags::_S_floatfield);
@@ -267,17 +283,21 @@ namespace std
* - goodbit
*/
typedef _Ios_Iostate iostate;
+
/// Indicates a loss of integrity in an input or output sequence (such
/// as an irrecoverable read error from a file).
- static const iostate badbit = iostate(__ios_flags::_S_badbit);
+ static const iostate badbit = iostate(__ios_flags::_S_badbit);
+
/// Indicates that an input operation reached the end of an input sequence.
- static const iostate eofbit = iostate(__ios_flags::_S_eofbit);
+ static const iostate eofbit = iostate(__ios_flags::_S_eofbit);
+
/// Indicates that an input operation failed to read the expected
/// characters, or that an output operation failed to generate the
/// desired characters.
- static const iostate failbit = iostate(__ios_flags::_S_failbit);
+ static const iostate failbit = iostate(__ios_flags::_S_failbit);
+
/// Indicates all is well.
- static const iostate goodbit = iostate(0);
+ static const iostate goodbit = iostate(0);
// 27.4.2.1.4 Type ios_base::openmode
/**
@@ -294,21 +314,27 @@ namespace std
* - trunc
*/
typedef _Ios_Openmode openmode;
+
/// Seek to end before each write.
- static const openmode app = openmode(__ios_flags::_S_app);
+ static const openmode app = openmode(__ios_flags::_S_app);
+
/// Open and seek to end immediately after opening.
- static const openmode ate = openmode(__ios_flags::_S_ate);
+ static const openmode ate = openmode(__ios_flags::_S_ate);
+
/// Perform input and output in binary mode (as opposed to text mode).
/// This is probably not what you think it is; see
/// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and
/// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.
- static const openmode binary = openmode(__ios_flags::_S_bin);
+ static const openmode binary = openmode(__ios_flags::_S_bin);
+
/// Open for input. Default for @c ifstream and fstream.
- static const openmode in = openmode(__ios_flags::_S_in);
+ static const openmode in = openmode(__ios_flags::_S_in);
+
/// Open for output. Default for @c ofstream and fstream.
- static const openmode out = openmode(__ios_flags::_S_out);
+ static const openmode out = openmode(__ios_flags::_S_out);
+
/// Open for input. Default for @c ofstream.
- static const openmode trunc = openmode(__ios_flags::_S_trunc);
+ static const openmode trunc = openmode(__ios_flags::_S_trunc);
// 27.4.2.1.5 Type ios_base::seekdir
/**
@@ -321,26 +347,32 @@ namespace std
* - end, equivalent to @c SEEK_END in the C standard library.
*/
typedef _Ios_Seekdir seekdir;
+
/// Request a seek relative to the beginning of the stream.
- static const seekdir beg = seekdir(0);
+ static const seekdir beg = seekdir(0);
+
/// Request a seek relative to the current position within the sequence.
- static const seekdir cur = seekdir(SEEK_CUR);
+ static const seekdir cur = seekdir(SEEK_CUR);
+
/// Request a seek relative to the current end of the sequence.
- static const seekdir end = seekdir(SEEK_END);
+ static const seekdir end = seekdir(SEEK_END);
-#ifdef _GLIBCPP_DEPRECATED
+#ifdef _GLIBCXX_DEPRECATED
// Annex D.6
typedef int io_state;
typedef int open_mode;
typedef int seek_dir;
-
+
typedef std::streampos streampos;
typedef std::streamoff streamoff;
#endif
// Callbacks;
/**
- * @doctodo
+ * @brief The set of events that may be passed to an event callback.
+ *
+ * erase_event is used during ~ios() and copyfmt(). imbue_event is used
+ * during imbue(). copyfmt_event is used during copyfmt().
*/
enum event
{
@@ -350,14 +382,28 @@ namespace std
};
/**
- * @doctodo
+ * @brief The type of an event callback function.
+ * @param event One of the members of the event enum.
+ * @param ios_base Reference to the ios_base object.
+ * @param int The integer provided when the callback was registered.
+ *
+ * Event callbacks are user defined functions that get called during
+ * several ios_base and basic_ios functions, specifically imbue(),
+ * copyfmt(), and ~ios().
*/
typedef void (*event_callback) (event, ios_base&, int);
/**
- * @doctodo
+ * @brief Add the callback __fn with parameter __index.
+ * @param __fn The function to add.
+ * @param __index The integer to pass to the function when invoked.
+ *
+ * Registers a function as an event callback with an integer parameter to
+ * be passed to the function when invoked. Multiple copies of the
+ * function are allowed. If there are multiple callbacks, they are
+ * invoked in the order they were registered.
*/
- void
+ void
register_callback(event_callback __fn, int __index);
protected:
@@ -367,11 +413,11 @@ namespace std
* ios_base data members (doc me)
* @endif
*/
- streamsize _M_precision;
- streamsize _M_width;
- fmtflags _M_flags;
- iostate _M_exception;
- iostate _M_streambuf_state;
+ streamsize _M_precision;
+ streamsize _M_width;
+ fmtflags _M_flags;
+ iostate _M_exception;
+ iostate _M_streambuf_state;
//@}
// 27.4.2.6 Members for callbacks
@@ -379,58 +425,59 @@ namespace std
struct _Callback_list
{
// Data Members
- _Callback_list* _M_next;
- ios_base::event_callback _M_fn;
- int _M_index;
+ _Callback_list* _M_next;
+ ios_base::event_callback _M_fn;
+ int _M_index;
_Atomic_word _M_refcount; // 0 means one reference.
-
- _Callback_list(ios_base::event_callback __fn, int __index,
+
+ _Callback_list(ios_base::event_callback __fn, int __index,
_Callback_list* __cb)
: _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
-
- void
- _M_add_reference() { __atomic_add(&_M_refcount, 1); }
+
+ void
+ _M_add_reference() { __gnu_cxx::__atomic_add(&_M_refcount, 1); }
// 0 => OK to delete.
- int
- _M_remove_reference() { return __exchange_and_add(&_M_refcount, -1); }
+ int
+ _M_remove_reference()
+ { return __gnu_cxx::__exchange_and_add(&_M_refcount, -1); }
};
- _Callback_list* _M_callbacks;
+ _Callback_list* _M_callbacks;
- void
+ void
_M_call_callbacks(event __ev) throw();
- void
+ void
_M_dispose_callbacks(void);
// 27.4.2.5 Members for iword/pword storage
- struct _Words
- {
- void* _M_pword;
- long _M_iword;
+ struct _Words
+ {
+ void* _M_pword;
+ long _M_iword;
_Words() : _M_pword(0), _M_iword(0) { }
};
// Only for failed iword/pword calls.
- _Words _M_word_zero;
+ _Words _M_word_zero;
// Guaranteed storage.
// The first 5 iword and pword slots are reserved for internal use.
- static const int _S_local_word_size = 8;
- _Words _M_local_word[_S_local_word_size];
+ static const int _S_local_word_size = 8;
+ _Words _M_local_word[_S_local_word_size];
// Allocated storage.
- int _M_word_size;
- _Words* _M_word;
-
- _Words&
- _M_grow_words(int __index);
+ int _M_word_size;
+ _Words* _M_word;
+
+ _Words&
+ _M_grow_words(int __index, bool __iword);
// Members for locale and locale caching.
- locale _M_ios_locale;
+ locale _M_ios_locale;
- void
+ void
_M_init();
public:
@@ -438,29 +485,17 @@ namespace std
// 27.4.2.1.6 Class ios_base::Init
// Used to initialize standard streams. In theory, g++ could use
// -finit-priority to order this stuff correctly without going
- // through these machinations.
- class Init
+ // through these machinations.
+ class Init
{
friend class ios_base;
public:
Init();
~Init();
-
- static void
- _S_ios_create(bool __sync);
-
- static void
- _S_ios_destroy();
-
- // NB: Allows debugger applications use of the standard streams
- // from operator new. _S_ios_base_init must be incremented in
- // _S_ios_create _after_ initialization is completed.
- static bool
- _S_initialized() { return _S_ios_base_init; }
private:
- static int _S_ios_base_init;
- static bool _S_synced_with_stdio;
+ static _Atomic_word _S_refcount;
+ static bool _S_synced_with_stdio;
};
// [27.4.2.2] fmtflags state functions
@@ -468,7 +503,7 @@ namespace std
* @brief Access to format flags.
* @return The format control flags for both input and output.
*/
- inline fmtflags
+ inline fmtflags
flags() const { return _M_flags; }
/**
@@ -478,12 +513,12 @@ namespace std
*
* This function overwrites all the format flags with @a fmtfl.
*/
- inline fmtflags
+ inline fmtflags
flags(fmtflags __fmtfl)
- {
- fmtflags __old = _M_flags;
- _M_flags = __fmtfl;
- return __old;
+ {
+ fmtflags __old = _M_flags;
+ _M_flags = __fmtfl;
+ return __old;
}
/**
@@ -494,12 +529,12 @@ namespace std
* This function sets additional flags in format control. Flags that
* were previously set remain set.
*/
- inline fmtflags
+ inline fmtflags
setf(fmtflags __fmtfl)
- {
- fmtflags __old = _M_flags;
- _M_flags |= __fmtfl;
- return __old;
+ {
+ fmtflags __old = _M_flags;
+ _M_flags |= __fmtfl;
+ return __old;
}
/**
@@ -511,7 +546,7 @@ namespace std
* This function clears @a mask in the format flags, then sets
* @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield.
*/
- inline fmtflags
+ inline fmtflags
setf(fmtflags __fmtfl, fmtflags __mask)
{
fmtflags __old = _M_flags;
@@ -526,7 +561,7 @@ namespace std
*
* This function clears @a mask in the format flags.
*/
- inline void
+ inline void
unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
/**
@@ -538,7 +573,7 @@ namespace std
* DR 189.
* @endif
*/
- inline streamsize
+ inline streamsize
precision() const { return _M_precision; }
/**
@@ -546,12 +581,12 @@ namespace std
* @param prec The new precision value.
* @return The previous value of precision().
*/
- inline streamsize
+ inline streamsize
precision(streamsize __prec)
- {
- streamsize __old = _M_precision;
- _M_precision = __prec;
- return __old;
+ {
+ streamsize __old = _M_precision;
+ _M_precision = __prec;
+ return __old;
}
/**
@@ -560,7 +595,7 @@ namespace std
*
* "Minimum field width" refers to the number of characters.
*/
- inline streamsize
+ inline streamsize
width() const { return _M_width; }
/**
@@ -568,12 +603,12 @@ namespace std
* @param wide The new width value.
* @return The previous value of width().
*/
- inline streamsize
+ inline streamsize
width(streamsize __wide)
- {
- streamsize __old = _M_width;
- _M_width = __wide;
- return __old;
+ {
+ streamsize __old = _M_width;
+ _M_width = __wide;
+ return __old;
}
// [27.4.2.4] ios_base static members
@@ -587,7 +622,7 @@ namespace std
* cout). User-declared streams are unaffected. See
* http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for more.
*/
- static bool
+ static bool
sync_with_stdio(bool __sync = true);
// [27.4.2.3] ios_base locale functions
@@ -596,10 +631,10 @@ namespace std
* @param loc The new locale.
* @return The previous locale.
*
- * Sets the new locale for this stream, and
- * [XXX does something with callbacks].
+ * Sets the new locale for this stream, and then invokes each callback
+ * with imbue_event.
*/
- locale
+ locale
imbue(const locale& __loc);
/**
@@ -610,7 +645,7 @@ namespace std
* returns @c loc. Otherwise, it returns a copy of @c std::locale(),
* the global C++ locale.
*/
- inline locale
+ inline locale
getloc() const { return _M_ios_locale; }
/**
@@ -620,61 +655,95 @@ namespace std
* Like getloc above, but returns a reference instead of
* generating a copy.
*/
- inline const locale&
+ inline const locale&
_M_getloc() const { return _M_ios_locale; }
// [27.4.2.5] ios_base storage functions
/**
- * @doctodo
+ * @brief Access to unique indices.
+ * @return An integer different from all previous calls.
+ *
+ * This function returns a unique integer every time it is called. It
+ * can be used for any purpose, but is primarily intended to be a unique
+ * index for the iword and pword functions. The expectation is that an
+ * application calls xalloc in order to obtain an index in the iword and
+ * pword arrays that can be used without fear of conflict.
+ *
+ * The implementation maintains a static variable that is incremented and
+ * returned on each invocation. xalloc is guaranteed to return an index
+ * that is safe to use in the iword and pword arrays.
*/
- static int
+ static int
xalloc() throw();
/**
- * @doctodo
+ * @brief Access to integer array.
+ * @param __ix Index into the array.
+ * @return A reference to an integer associated with the index.
+ *
+ * The iword function provides access to an array of integers that can be
+ * used for any purpose. The array grows as required to hold the
+ * supplied index. All integers in the array are initialized to 0.
+ *
+ * The implementation reserves several indices. You should use xalloc to
+ * obtain an index that is safe to use. Also note that since the array
+ * can grow dynamically, it is not safe to hold onto the reference.
*/
- inline long&
+ inline long&
iword(int __ix)
{
- _Words& __word = (__ix < _M_word_size)
- ? _M_word[__ix] : _M_grow_words(__ix);
+ _Words& __word = (__ix < _M_word_size)
+ ? _M_word[__ix] : _M_grow_words(__ix, true);
return __word._M_iword;
}
/**
- * @doctodo
+ * @brief Access to void pointer array.
+ * @param __ix Index into the array.
+ * @return A reference to a void* associated with the index.
+ *
+ * The pword function provides access to an array of pointers that can be
+ * used for any purpose. The array grows as required to hold the
+ * supplied index. All pointers in the array are initialized to 0.
+ *
+ * The implementation reserves several indices. You should use xalloc to
+ * obtain an index that is safe to use. Also note that since the array
+ * can grow dynamically, it is not safe to hold onto the reference.
*/
- inline void*&
+ inline void*&
pword(int __ix)
{
- _Words& __word = (__ix < _M_word_size)
- ? _M_word[__ix] : _M_grow_words(__ix);
+ _Words& __word = (__ix < _M_word_size)
+ ? _M_word[__ix] : _M_grow_words(__ix, false);
return __word._M_pword;
}
// Destructor
/**
- * Destroys local storage and
- * [XXX does something with callbacks].
+ * Invokes each callback with erase_event. Destroys local storage.
+ *
+ * Note that the ios_base object for the standard streams never gets
+ * destroyed. As a result, any callbacks registered with the standard
+ * streams will not get invoked with erase_event (unless copyfmt is
+ * used).
*/
- ~ios_base();
+ virtual ~ios_base();
protected:
ios_base();
-#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
- //50. Copy constructor and assignment operator of ios_base
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 50. Copy constructor and assignment operator of ios_base
private:
ios_base(const ios_base&);
- ios_base&
+ ios_base&
operator=(const ios_base&);
-#endif
};
-
+
// [27.4.5.1] fmtflags manipulators
/// Calls base.setf(ios_base::boolalpha).
- inline ios_base&
+ inline ios_base&
boolalpha(ios_base& __base)
{
__base.setf(ios_base::boolalpha);
@@ -682,7 +751,7 @@ namespace std
}
/// Calls base.unsetf(ios_base::boolalpha).
- inline ios_base&
+ inline ios_base&
noboolalpha(ios_base& __base)
{
__base.unsetf(ios_base::boolalpha);
@@ -690,7 +759,7 @@ namespace std
}
/// Calls base.setf(ios_base::showbase).
- inline ios_base&
+ inline ios_base&
showbase(ios_base& __base)
{
__base.setf(ios_base::showbase);
@@ -698,7 +767,7 @@ namespace std
}
/// Calls base.unsetf(ios_base::showbase).
- inline ios_base&
+ inline ios_base&
noshowbase(ios_base& __base)
{
__base.unsetf(ios_base::showbase);
@@ -706,7 +775,7 @@ namespace std
}
/// Calls base.setf(ios_base::showpoint).
- inline ios_base&
+ inline ios_base&
showpoint(ios_base& __base)
{
__base.setf(ios_base::showpoint);
@@ -714,7 +783,7 @@ namespace std
}
/// Calls base.unsetf(ios_base::showpoint).
- inline ios_base&
+ inline ios_base&
noshowpoint(ios_base& __base)
{
__base.unsetf(ios_base::showpoint);
@@ -722,7 +791,7 @@ namespace std
}
/// Calls base.setf(ios_base::showpos).
- inline ios_base&
+ inline ios_base&
showpos(ios_base& __base)
{
__base.setf(ios_base::showpos);
@@ -730,7 +799,7 @@ namespace std
}
/// Calls base.unsetf(ios_base::showpos).
- inline ios_base&
+ inline ios_base&
noshowpos(ios_base& __base)
{
__base.unsetf(ios_base::showpos);
@@ -738,15 +807,15 @@ namespace std
}
/// Calls base.setf(ios_base::skipws).
- inline ios_base&
+ inline ios_base&
skipws(ios_base& __base)
{
__base.setf(ios_base::skipws);
return __base;
}
-
+
/// Calls base.unsetf(ios_base::skipws).
- inline ios_base&
+ inline ios_base&
noskipws(ios_base& __base)
{
__base.unsetf(ios_base::skipws);
@@ -754,7 +823,7 @@ namespace std
}
/// Calls base.setf(ios_base::uppercase).
- inline ios_base&
+ inline ios_base&
uppercase(ios_base& __base)
{
__base.setf(ios_base::uppercase);
@@ -762,7 +831,7 @@ namespace std
}
/// Calls base.unsetf(ios_base::uppercase).
- inline ios_base&
+ inline ios_base&
nouppercase(ios_base& __base)
{
__base.unsetf(ios_base::uppercase);
@@ -770,57 +839,57 @@ namespace std
}
/// Calls base.setf(ios_base::unitbuf).
- inline ios_base&
+ inline ios_base&
unitbuf(ios_base& __base)
{
- __base.setf(ios_base::unitbuf);
+ __base.setf(ios_base::unitbuf);
return __base;
}
/// Calls base.unsetf(ios_base::unitbuf).
- inline ios_base&
+ inline ios_base&
nounitbuf(ios_base& __base)
{
__base.unsetf(ios_base::unitbuf);
- return __base;
+ return __base;
}
// [27.4.5.2] adjustfield anipulators
/// Calls base.setf(ios_base::internal, ios_base::adjustfield).
- inline ios_base&
+ inline ios_base&
internal(ios_base& __base)
{
__base.setf(ios_base::internal, ios_base::adjustfield);
- return __base;
+ return __base;
}
/// Calls base.setf(ios_base::left, ios_base::adjustfield).
- inline ios_base&
+ inline ios_base&
left(ios_base& __base)
{
__base.setf(ios_base::left, ios_base::adjustfield);
return __base;
}
-
+
/// Calls base.setf(ios_base::right, ios_base::adjustfield).
- inline ios_base&
+ inline ios_base&
right(ios_base& __base)
{
__base.setf(ios_base::right, ios_base::adjustfield);
return __base;
}
-
+
// [27.4.5.3] basefield anipulators
/// Calls base.setf(ios_base::dec, ios_base::basefield).
- inline ios_base&
+ inline ios_base&
dec(ios_base& __base)
{
__base.setf(ios_base::dec, ios_base::basefield);
return __base;
}
-
+
/// Calls base.setf(ios_base::hex, ios_base::basefield).
- inline ios_base&
+ inline ios_base&
hex(ios_base& __base)
{
__base.setf(ios_base::hex, ios_base::basefield);
@@ -828,16 +897,16 @@ namespace std
}
/// Calls base.setf(ios_base::oct, ios_base::basefield).
- inline ios_base&
+ inline ios_base&
oct(ios_base& __base)
{
__base.setf(ios_base::oct, ios_base::basefield);
return __base;
}
-
+
// [27.4.5.4] floatfield anipulators
/// Calls base.setf(ios_base::fixed, ios_base::floatfield).
- inline ios_base&
+ inline ios_base&
fixed(ios_base& __base)
{
__base.setf(ios_base::fixed, ios_base::floatfield);
@@ -845,14 +914,13 @@ namespace std
}
/// Calls base.setf(ios_base::scientific, ios_base::floatfield).
- inline ios_base&
+ inline ios_base&
scientific(ios_base& __base)
{
__base.setf(ios_base::scientific, ios_base::floatfield);
return __base;
}
-
} // namespace std
-#endif /* _CPP_BITS_IOSBASE_H */
+#endif /* _IOS_BASE_H */