ios_base.h

Go to the documentation of this file.
00001 // Iostreams base classes -*- C++ -*-
00002 
00003 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
00004 // Free Software Foundation, Inc.
00005 //
00006 // This file is part of the GNU ISO C++ Library.  This library is free
00007 // software; you can redistribute it and/or modify it under the
00008 // terms of the GNU General Public License as published by the
00009 // Free Software Foundation; either version 2, or (at your option)
00010 // any later version.
00011 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 
00017 // You should have received a copy of the GNU General Public License along
00018 // with this library; see the file COPYING.  If not, write to the Free
00019 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00020 // USA.
00021 
00022 // As a special exception, you may use this file as part of a free software
00023 // library without restriction.  Specifically, if other files instantiate
00024 // templates or use macros or inline functions from this file, or you compile
00025 // this file and link it with other files to produce an executable, this
00026 // file does not by itself cause the resulting executable to be covered by
00027 // the GNU General Public License.  This exception does not however
00028 // invalidate any other reasons why the executable file might be covered by
00029 // the GNU General Public License.
00030 
00031 //
00032 // ISO C++ 14882: 27.8  File-based streams
00033 //
00034 
00035 /** @file ios_base.h
00036  *  This is an internal header file, included by other library headers.
00037  *  You should not attempt to use it directly.
00038  */
00039 
00040 #ifndef _CPP_BITS_IOSBASE_H
00041 #define _CPP_BITS_IOSBASE_H 1
00042 
00043 #pragma GCC system_header
00044 
00045 #include <bits/atomicity.h>
00046 #include <bits/localefwd.h>
00047 #include <bits/locale_classes.h>
00048 
00049 namespace std
00050 {
00051   // The following definitions of bitmask types are enums, not ints,
00052   // as permitted (but not required) in the standard, in order to provide
00053   // better type safety in iostream calls.  A side effect is that
00054   // expressions involving them are no longer compile-time constants.
00055   enum _Ios_Fmtflags { _M_ios_fmtflags_end = 1L << 16 };
00056 
00057   inline _Ios_Fmtflags 
00058   operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
00059   { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
00060 
00061   inline _Ios_Fmtflags 
00062   operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
00063   { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
00064 
00065   inline _Ios_Fmtflags 
00066   operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
00067   { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
00068 
00069   inline _Ios_Fmtflags 
00070   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
00071   { return __a = __a | __b; }
00072 
00073   inline _Ios_Fmtflags 
00074   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
00075   { return __a = __a & __b; }
00076 
00077   inline _Ios_Fmtflags 
00078   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
00079   { return __a = __a ^ __b; }
00080 
00081   inline _Ios_Fmtflags 
00082   operator~(_Ios_Fmtflags __a)
00083   { return _Ios_Fmtflags(~static_cast<int>(__a)); }
00084 
00085 
00086   enum _Ios_Openmode { _M_ios_openmode_end = 1L << 16 };
00087 
00088   inline _Ios_Openmode 
00089   operator&(_Ios_Openmode __a, _Ios_Openmode __b)
00090   { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
00091 
00092   inline _Ios_Openmode 
00093   operator|(_Ios_Openmode __a, _Ios_Openmode __b)
00094   { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
00095 
00096   inline _Ios_Openmode 
00097   operator^(_Ios_Openmode __a, _Ios_Openmode __b)
00098   { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
00099 
00100   inline _Ios_Openmode 
00101   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
00102   { return __a = __a | __b; }
00103 
00104   inline _Ios_Openmode 
00105   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
00106   { return __a = __a & __b; }
00107 
00108   inline _Ios_Openmode 
00109   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
00110   { return __a = __a ^ __b; }
00111 
00112   inline _Ios_Openmode 
00113   operator~(_Ios_Openmode __a)
00114   { return _Ios_Openmode(~static_cast<int>(__a)); }
00115 
00116 
00117   enum _Ios_Iostate { _M_ios_iostate_end = 1L << 16 };
00118 
00119   inline _Ios_Iostate 
00120   operator&(_Ios_Iostate __a, _Ios_Iostate __b)
00121   { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
00122 
00123   inline _Ios_Iostate 
00124   operator|(_Ios_Iostate __a, _Ios_Iostate __b)
00125   { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
00126 
00127   inline _Ios_Iostate 
00128   operator^(_Ios_Iostate __a, _Ios_Iostate __b)
00129   { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
00130 
00131   inline _Ios_Iostate 
00132   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
00133   { return __a = __a | __b; }
00134 
00135   inline _Ios_Iostate 
00136   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
00137   { return __a = __a & __b; }
00138 
00139   inline _Ios_Iostate 
00140   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
00141   { return __a = __a ^ __b; }
00142 
00143   inline _Ios_Iostate 
00144   operator~(_Ios_Iostate __a)
00145   { return _Ios_Iostate(~static_cast<int>(__a)); }
00146 
00147   enum _Ios_Seekdir { _M_ios_seekdir_end = 1L << 16 };
00148 
00149   // 27.4.2  Class ios_base
00150   /**
00151    *  @brief  The very top of the I/O class hierarchy.
00152    *
00153    *  This class defines everything that can be defined about I/O that does
00154    *  not depend on the type of characters being input or output.  Most
00155    *  people will only see @c ios_base when they need to specify the full
00156    *  name of the various I/O flags (e.g., the openmodes).
00157   */
00158   class ios_base
00159   {
00160   public:
00161     
00162     // 27.4.2.1.1  Class ios_base::failure
00163     /// These are thrown to indicate problems.  Doc me.
00164     class failure : public exception
00165     {
00166     public:
00167 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00168       //48.  Use of non-existent exception constructor
00169       explicit 
00170       failure(const string& __str) throw();
00171 
00172       // This declaration is not useless:
00173       // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
00174       virtual 
00175       ~failure() throw();
00176 
00177       virtual const char*
00178       what() const throw();
00179       
00180     private:
00181       enum { _M_bufsize = 256 };
00182       char _M_name[_M_bufsize];
00183 #endif
00184     };
00185 
00186     // 27.4.2.1.2  Type ios_base::fmtflags
00187     /**
00188      *  @brief This is a bitmask type.
00189      *
00190      *  @c "_Ios_Fmtflags" is implementation-defined, but it is valid to
00191      *  perform bitwise operations on these values and expect the Right
00192      *  Thing to happen.  Defined objects of type fmtflags are:
00193      *  - boolalpha
00194      *  - dec
00195      *  - fixed
00196      *  - hex
00197      *  - internal
00198      *  - left
00199      *  - oct
00200      *  - right
00201      *  - scientific
00202      *  - showbase
00203      *  - showpoint
00204      *  - showpos
00205      *  - skipws
00206      *  - unitbuf
00207      *  - uppercase
00208      *  - adjustfield
00209      *  - basefield
00210      *  - floatfield
00211     */
00212     typedef _Ios_Fmtflags fmtflags;
00213     /// Insert/extract @c bool in alphabetic rather than numeric format.
00214     static const fmtflags boolalpha =   fmtflags(__ios_flags::_S_boolalpha);
00215     /// Converts integer input or generates integer output in decimal base.
00216     static const fmtflags dec =         fmtflags(__ios_flags::_S_dec);
00217     /// Generate floating-point output in fixed-point notation.
00218     static const fmtflags fixed =       fmtflags(__ios_flags::_S_fixed);
00219     /// Converts integer input or generates integer output in hexadecimal base.
00220     static const fmtflags hex =         fmtflags(__ios_flags::_S_hex);
00221     /// Adds fill characters at a designated internal point in certain
00222     /// generated output, or identical to @c right if no such point is
00223     /// designated.
00224     static const fmtflags internal =    fmtflags(__ios_flags::_S_internal);
00225     /// Adds fill characters on the right (final positions) of certain
00226     /// generated output.  (I.e., the thing you print is flush left.)
00227     static const fmtflags left =        fmtflags(__ios_flags::_S_left);
00228     /// Converts integer input or generates integer output in octal base.
00229     static const fmtflags oct =         fmtflags(__ios_flags::_S_oct);
00230     /// Adds fill characters on the left (initial positions) of certain
00231     /// generated output.  (I.e., the thing you print is flush right.)
00232     static const fmtflags right =       fmtflags(__ios_flags::_S_right);
00233     /// Generates floating-point output in scientific notation.
00234     static const fmtflags scientific =  fmtflags(__ios_flags::_S_scientific);
00235     /// Generates a prefix indicating the numeric base of generated integer
00236     /// output.
00237     static const fmtflags showbase =    fmtflags(__ios_flags::_S_showbase);
00238     /// Generates a decimal-point character unconditionally in generated
00239     /// floating-point output.
00240     static const fmtflags showpoint =   fmtflags(__ios_flags::_S_showpoint);
00241     /// Generates a + sign in non-negative generated numeric output.
00242     static const fmtflags showpos =     fmtflags(__ios_flags::_S_showpos);
00243     /// Skips leading white space before certain input operations.
00244     static const fmtflags skipws =      fmtflags(__ios_flags::_S_skipws);
00245     /// Flushes output after each output operation.
00246     static const fmtflags unitbuf =     fmtflags(__ios_flags::_S_unitbuf);
00247     /// Replaces certain lowercase letters with their uppercase equivalents
00248     /// in generated output.
00249     static const fmtflags uppercase =   fmtflags(__ios_flags::_S_uppercase);
00250     /// A mask of left|right|internal.  Useful for the 2-arg form of @c setf.
00251     static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
00252     /// A mask of dec|oct|hex.  Useful for the 2-arg form of @c setf.
00253     static const fmtflags basefield =   fmtflags(__ios_flags::_S_basefield);
00254     /// A mask of scientific|fixed.  Useful for the 2-arg form of @c setf.
00255     static const fmtflags floatfield =  fmtflags(__ios_flags::_S_floatfield);
00256 
00257     // 27.4.2.1.3  Type ios_base::iostate
00258     /**
00259      *  @brief This is a bitmask type.
00260      *
00261      *  @c "_Ios_Iostate" is implementation-defined, but it is valid to
00262      *  perform bitwise operations on these values and expect the Right
00263      *  Thing to happen.  Defined objects of type iostate are:
00264      *  - badbit
00265      *  - eofbit
00266      *  - failbit
00267      *  - goodbit
00268     */
00269     typedef _Ios_Iostate iostate;
00270     /// Indicates a loss of integrity in an input or output sequence (such
00271     /// as an irrecoverable read error from a file).
00272     static const iostate badbit =   iostate(__ios_flags::_S_badbit);
00273     /// Indicates that an input operation reached the end of an input sequence.
00274     static const iostate eofbit =   iostate(__ios_flags::_S_eofbit);
00275     /// Indicates that an input operation failed to read the expected
00276     /// characters, or that an output operation failed to generate the
00277     /// desired characters.
00278     static const iostate failbit =  iostate(__ios_flags::_S_failbit);
00279     /// Indicates all is well.
00280     static const iostate goodbit =  iostate(0);
00281 
00282     // 27.4.2.1.4  Type ios_base::openmode
00283     /**
00284      *  @brief This is a bitmask type.
00285      *
00286      *  @c "_Ios_Openmode" is implementation-defined, but it is valid to
00287      *  perform bitwise operations on these values and expect the Right
00288      *  Thing to happen.  Defined objects of type openmode are:
00289      *  - app
00290      *  - ate
00291      *  - binary
00292      *  - in
00293      *  - out
00294      *  - trunc
00295     */
00296     typedef _Ios_Openmode openmode;
00297     /// Seek to end before each write.
00298     static const openmode app =     openmode(__ios_flags::_S_app);
00299     /// Open and seek to end immediately after opening.
00300     static const openmode ate =     openmode(__ios_flags::_S_ate);
00301     /// Perform input and output in binary mode (as opposed to text mode).
00302     /// This is probably not what you think it is; see
00303     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and
00304     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.
00305     static const openmode binary =  openmode(__ios_flags::_S_bin);
00306     /// Open for input.  Default for @c ifstream and fstream.
00307     static const openmode in =      openmode(__ios_flags::_S_in);
00308     /// Open for output.  Default for @c ofstream and fstream.
00309     static const openmode out =     openmode(__ios_flags::_S_out);
00310     /// Open for input.  Default for @c ofstream.
00311     static const openmode trunc =   openmode(__ios_flags::_S_trunc);
00312 
00313     // 27.4.2.1.5  Type ios_base::seekdir
00314     /**
00315      *  @brief This is an enumerated type.
00316      *
00317      *  @c "_Ios_Seekdir" is implementation-defined.  Defined values
00318      *  of type seekdir are:
00319      *  - beg
00320      *  - cur, equivalent to @c SEEK_CUR in the C standard library.
00321      *  - end, equivalent to @c SEEK_END in the C standard library.
00322     */
00323     typedef _Ios_Seekdir seekdir;
00324     /// Request a seek relative to the beginning of the stream.
00325     static const seekdir beg =      seekdir(0);
00326     /// Request a seek relative to the current position within the sequence.
00327     static const seekdir cur =      seekdir(SEEK_CUR);
00328     /// Request a seek relative to the current end of the sequence.
00329     static const seekdir end =      seekdir(SEEK_END);
00330 
00331 #ifdef _GLIBCPP_DEPRECATED
00332     // Annex D.6
00333     typedef int io_state;
00334     typedef int open_mode;
00335     typedef int seek_dir;
00336     
00337     typedef std::streampos streampos;
00338     typedef std::streamoff streamoff;
00339 #endif
00340 
00341     // Callbacks;
00342     /**
00343      *  @doctodo
00344     */
00345     enum event
00346     {
00347       erase_event,
00348       imbue_event,
00349       copyfmt_event
00350     };
00351 
00352     /**
00353      *  @doctodo
00354     */
00355     typedef void (*event_callback) (event, ios_base&, int);
00356 
00357     /**
00358      *  @doctodo
00359     */
00360     void 
00361     register_callback(event_callback __fn, int __index);
00362 
00363   protected:
00364     //@{
00365     /**
00366      *  @if maint
00367      *  ios_base data members (doc me)
00368      *  @endif
00369     */
00370     streamsize      _M_precision;
00371     streamsize      _M_width;
00372     fmtflags        _M_flags;
00373     iostate         _M_exception;
00374     iostate             _M_streambuf_state;
00375     //@}
00376 
00377     // 27.4.2.6  Members for callbacks
00378     // 27.4.2.6  ios_base callbacks
00379     struct _Callback_list
00380     {
00381       // Data Members
00382       _Callback_list*       _M_next;
00383       ios_base::event_callback  _M_fn;
00384       int           _M_index;
00385       _Atomic_word      _M_refcount;  // 0 means one reference.
00386     
00387       _Callback_list(ios_base::event_callback __fn, int __index, 
00388              _Callback_list* __cb)
00389       : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
00390       
00391       void 
00392       _M_add_reference() { __atomic_add(&_M_refcount, 1); }
00393 
00394       // 0 => OK to delete.
00395       int 
00396       _M_remove_reference() { return __exchange_and_add(&_M_refcount, -1); }
00397     };
00398 
00399      _Callback_list*    _M_callbacks;
00400 
00401     void 
00402     _M_call_callbacks(event __ev) throw();
00403 
00404     void 
00405     _M_dispose_callbacks(void);
00406 
00407     // 27.4.2.5  Members for iword/pword storage
00408     struct _Words 
00409     { 
00410       void*     _M_pword; 
00411       long  _M_iword; 
00412       _Words() : _M_pword(0), _M_iword(0) { }
00413     };
00414 
00415     // Only for failed iword/pword calls.
00416     _Words          _M_word_zero;    
00417 
00418     // Guaranteed storage.
00419     // The first 5 iword and pword slots are reserved for internal use.
00420     static const int    _S_local_word_size = 8;
00421     _Words          _M_local_word[_S_local_word_size];  
00422 
00423     // Allocated storage.
00424     int             _M_word_size;
00425     _Words*         _M_word;
00426  
00427     _Words& 
00428     _M_grow_words(int __index);
00429 
00430     // Members for locale and locale caching.
00431     locale      _M_ios_locale;
00432 
00433     void 
00434     _M_init();
00435 
00436   public:
00437 
00438     // 27.4.2.1.6  Class ios_base::Init
00439     // Used to initialize standard streams. In theory, g++ could use
00440     // -finit-priority to order this stuff correctly without going
00441     // through these machinations. 
00442     class Init 
00443     {
00444       friend class ios_base;
00445     public:
00446       Init();
00447       ~Init();
00448       
00449       static void
00450       _S_ios_create(bool __sync);
00451       
00452       static void
00453       _S_ios_destroy();
00454 
00455       // NB: Allows debugger applications use of the standard streams
00456       // from operator new. _S_ios_base_init must be incremented in
00457       // _S_ios_create _after_ initialization is completed.
00458       static bool
00459       _S_initialized() { return _S_ios_base_init; }
00460 
00461     private:
00462       static int    _S_ios_base_init;
00463       static bool   _S_synced_with_stdio;
00464     };
00465 
00466     // [27.4.2.2] fmtflags state functions
00467     /**
00468      *  @brief  Access to format flags.
00469      *  @return  The format control flags for both input and output.
00470     */
00471     inline fmtflags 
00472     flags() const { return _M_flags; }
00473 
00474     /**
00475      *  @brief  Setting new format flags all at once.
00476      *  @param  fmtfl  The new flags to set.
00477      *  @return  The previous format control flags.
00478      *
00479      *  This function overwrites all the format flags with @a fmtfl.
00480     */
00481     inline fmtflags 
00482     flags(fmtflags __fmtfl)
00483     { 
00484       fmtflags __old = _M_flags; 
00485       _M_flags = __fmtfl; 
00486       return __old; 
00487     }
00488 
00489     /**
00490      *  @brief  Setting new format flags.
00491      *  @param  fmtfl  Additional flags to set.
00492      *  @return  The previous format control flags.
00493      *
00494      *  This function sets additional flags in format control.  Flags that
00495      *  were previously set remain set.
00496     */
00497     inline fmtflags 
00498     setf(fmtflags __fmtfl)
00499     { 
00500       fmtflags __old = _M_flags; 
00501       _M_flags |= __fmtfl; 
00502       return __old; 
00503     }
00504 
00505     /**
00506      *  @brief  Setting new format flags.
00507      *  @param  fmtfl  Additional flags to set.
00508      *  @param  mask  The flags mask for @a fmtfl.
00509      *  @return  The previous format control flags.
00510      *
00511      *  This function clears @a mask in the format flags, then sets
00512      *  @a fmtfl @c & @a mask.  An example mask is @c ios_base::adjustfield.
00513     */
00514     inline fmtflags 
00515     setf(fmtflags __fmtfl, fmtflags __mask)
00516     {
00517       fmtflags __old = _M_flags;
00518       _M_flags &= ~__mask;
00519       _M_flags |= (__fmtfl & __mask);
00520       return __old;
00521     }
00522 
00523     /**
00524      *  @brief  Clearing format flags.
00525      *  @param  mask  The flags to unset.
00526      *
00527      *  This function clears @a mask in the format flags.
00528     */
00529     inline void 
00530     unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
00531 
00532     /**
00533      *  @brief  Flags access.
00534      *  @return  The precision to generate on certain output operations.
00535      *
00536      *  @if maint
00537      *  Be careful if you try to give a definition of "precision" here; see
00538      *  DR 189.
00539      *  @endif
00540     */
00541     inline streamsize 
00542     precision() const { return _M_precision; }
00543 
00544     /**
00545      *  @brief  Changing flags.
00546      *  @param  prec  The new precision value.
00547      *  @return  The previous value of precision().
00548     */
00549     inline streamsize 
00550     precision(streamsize __prec)
00551     { 
00552       streamsize __old = _M_precision; 
00553       _M_precision = __prec; 
00554       return __old; 
00555     }
00556 
00557     /**
00558      *  @brief  Flags access.
00559      *  @return  The minimum field width to generate on output operations.
00560      *
00561      *  "Minimum field width" refers to the number of characters.
00562     */
00563     inline streamsize 
00564     width() const { return _M_width; }
00565 
00566     /**
00567      *  @brief  Changing flags.
00568      *  @param  wide  The new width value.
00569      *  @return  The previous value of width().
00570     */
00571     inline streamsize 
00572     width(streamsize __wide)
00573     { 
00574       streamsize __old = _M_width; 
00575       _M_width = __wide; 
00576       return __old; 
00577     }
00578 
00579     // [27.4.2.4] ios_base static members
00580     /**
00581      *  @brief  Interaction with the standard C I/O objects.
00582      *  @param  sync  Whether to synchronize or not.
00583      *  @return  True if the standard streams were previously synchronized.
00584      *
00585      *  The synchronization referred to is @e only that between the standard
00586      *  C facilities (e.g., stdout) and the standard C++ objects (e.g.,
00587      *  cout).  User-declared streams are unaffected.  See
00588      *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for more.
00589     */
00590     static bool 
00591     sync_with_stdio(bool __sync = true);
00592 
00593     // [27.4.2.3] ios_base locale functions
00594     /**
00595      *  @brief  Setting a new locale.
00596      *  @param  loc  The new locale.
00597      *  @return  The previous locale.
00598      *
00599      *  Sets the new locale for this stream, and
00600      *  [XXX does something with callbacks].
00601     */
00602     locale 
00603     imbue(const locale& __loc);
00604 
00605     /**
00606      *  @brief  Locale access
00607      *  @return  A copy of the current locale.
00608      *
00609      *  If @c imbue(loc) has previously been called, then this function
00610      *  returns @c loc.  Otherwise, it returns a copy of @c std::locale(),
00611      *  the global C++ locale.
00612     */
00613     inline locale 
00614     getloc() const { return _M_ios_locale; }
00615 
00616     /**
00617      *  @brief  Locale access
00618      *  @return  A reference to the current locale.
00619      *
00620      *  Like getloc above, but returns a reference instead of
00621      *  generating a copy.
00622     */
00623     inline const locale& 
00624     _M_getloc() const { return _M_ios_locale; }
00625 
00626     // [27.4.2.5] ios_base storage functions
00627     /**
00628      *  @doctodo
00629     */
00630     static int 
00631     xalloc() throw();
00632 
00633     /**
00634      *  @doctodo
00635     */
00636     inline long& 
00637     iword(int __ix)
00638     {
00639       _Words& __word = (__ix < _M_word_size) 
00640             ? _M_word[__ix] : _M_grow_words(__ix);
00641       return __word._M_iword;
00642     }
00643 
00644     /**
00645      *  @doctodo
00646     */
00647     inline void*& 
00648     pword(int __ix)
00649     {
00650       _Words& __word = (__ix < _M_word_size) 
00651             ? _M_word[__ix] : _M_grow_words(__ix);
00652       return __word._M_pword;
00653     }
00654 
00655     // Destructor
00656     /**
00657      *  Destroys local storage and
00658      *  [XXX does something with callbacks].
00659     */
00660     ~ios_base();
00661 
00662   protected:
00663     ios_base();
00664 
00665 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00666   //50.  Copy constructor and assignment operator of ios_base
00667   private:
00668     ios_base(const ios_base&);
00669 
00670     ios_base& 
00671     operator=(const ios_base&);
00672 #endif
00673   };
00674  
00675   // [27.4.5.1] fmtflags manipulators
00676   /// Calls base.setf(ios_base::boolalpha).
00677   inline ios_base& 
00678   boolalpha(ios_base& __base)
00679   {
00680     __base.setf(ios_base::boolalpha);
00681     return __base;
00682   }
00683 
00684   /// Calls base.unsetf(ios_base::boolalpha).
00685   inline ios_base& 
00686   noboolalpha(ios_base& __base)
00687   {
00688     __base.unsetf(ios_base::boolalpha);
00689     return __base;
00690   }
00691 
00692   /// Calls base.setf(ios_base::showbase).
00693   inline ios_base& 
00694   showbase(ios_base& __base)
00695   {
00696     __base.setf(ios_base::showbase);
00697     return __base;
00698   }
00699 
00700   /// Calls base.unsetf(ios_base::showbase).
00701   inline ios_base& 
00702   noshowbase(ios_base& __base)
00703   {
00704     __base.unsetf(ios_base::showbase);
00705     return __base;
00706   }
00707 
00708   /// Calls base.setf(ios_base::showpoint).
00709   inline ios_base& 
00710   showpoint(ios_base& __base)
00711   {
00712     __base.setf(ios_base::showpoint);
00713     return __base;
00714   }
00715 
00716   /// Calls base.unsetf(ios_base::showpoint).
00717   inline ios_base& 
00718   noshowpoint(ios_base& __base)
00719   {
00720     __base.unsetf(ios_base::showpoint);
00721     return __base;
00722   }
00723 
00724   /// Calls base.setf(ios_base::showpos).
00725   inline ios_base& 
00726   showpos(ios_base& __base)
00727   {
00728     __base.setf(ios_base::showpos);
00729     return __base;
00730   }
00731 
00732   /// Calls base.unsetf(ios_base::showpos).
00733   inline ios_base& 
00734   noshowpos(ios_base& __base)
00735   {
00736     __base.unsetf(ios_base::showpos);
00737     return __base;
00738   }
00739 
00740   /// Calls base.setf(ios_base::skipws).
00741   inline ios_base& 
00742   skipws(ios_base& __base)
00743   {
00744     __base.setf(ios_base::skipws);
00745     return __base;
00746   }
00747   
00748   /// Calls base.unsetf(ios_base::skipws).
00749   inline ios_base& 
00750   noskipws(ios_base& __base)
00751   {
00752     __base.unsetf(ios_base::skipws);
00753     return __base;
00754   }
00755 
00756   /// Calls base.setf(ios_base::uppercase).
00757   inline ios_base& 
00758   uppercase(ios_base& __base)
00759   {
00760     __base.setf(ios_base::uppercase);
00761     return __base;
00762   }
00763 
00764   /// Calls base.unsetf(ios_base::uppercase).
00765   inline ios_base& 
00766   nouppercase(ios_base& __base)
00767   {
00768     __base.unsetf(ios_base::uppercase);
00769     return __base;
00770   }
00771 
00772   /// Calls base.setf(ios_base::unitbuf).
00773   inline ios_base& 
00774   unitbuf(ios_base& __base)
00775   {
00776      __base.setf(ios_base::unitbuf);      
00777      return __base;
00778   }
00779 
00780   /// Calls base.unsetf(ios_base::unitbuf).
00781   inline ios_base& 
00782   nounitbuf(ios_base& __base)
00783   {
00784      __base.unsetf(ios_base::unitbuf);
00785      return __base;    
00786   }
00787 
00788   // [27.4.5.2] adjustfield anipulators
00789   /// Calls base.setf(ios_base::internal, ios_base::adjustfield).
00790   inline ios_base& 
00791   internal(ios_base& __base)
00792   {
00793      __base.setf(ios_base::internal, ios_base::adjustfield);
00794      return __base;    
00795   }
00796 
00797   /// Calls base.setf(ios_base::left, ios_base::adjustfield).
00798   inline ios_base& 
00799   left(ios_base& __base)
00800   {
00801     __base.setf(ios_base::left, ios_base::adjustfield);
00802     return __base;
00803   }
00804   
00805   /// Calls base.setf(ios_base::right, ios_base::adjustfield).
00806   inline ios_base& 
00807   right(ios_base& __base)
00808   {
00809     __base.setf(ios_base::right, ios_base::adjustfield);
00810     return __base;
00811   }
00812   
00813   // [27.4.5.3] basefield anipulators
00814   /// Calls base.setf(ios_base::dec, ios_base::basefield).
00815   inline ios_base& 
00816   dec(ios_base& __base)
00817   {
00818     __base.setf(ios_base::dec, ios_base::basefield);
00819     return __base;
00820   }
00821   
00822   /// Calls base.setf(ios_base::hex, ios_base::basefield).
00823   inline ios_base& 
00824   hex(ios_base& __base)
00825   {
00826     __base.setf(ios_base::hex, ios_base::basefield);
00827     return __base;
00828   }
00829 
00830   /// Calls base.setf(ios_base::oct, ios_base::basefield).
00831   inline ios_base& 
00832   oct(ios_base& __base)
00833   {
00834     __base.setf(ios_base::oct, ios_base::basefield);
00835     return __base;
00836   }
00837   
00838   // [27.4.5.4] floatfield anipulators
00839   /// Calls base.setf(ios_base::fixed, ios_base::floatfield).
00840   inline ios_base& 
00841   fixed(ios_base& __base)
00842   {
00843     __base.setf(ios_base::fixed, ios_base::floatfield);
00844     return __base;
00845   }
00846 
00847   /// Calls base.setf(ios_base::scientific, ios_base::floatfield).
00848   inline ios_base& 
00849   scientific(ios_base& __base)
00850   {
00851     __base.setf(ios_base::scientific, ios_base::floatfield);
00852     return __base;
00853   }
00854 
00855 } // namespace std
00856 
00857 #endif /* _CPP_BITS_IOSBASE_H */
00858 

Generated on Thu Feb 10 23:22:55 2005 for libstdc++-v3 Source by  doxygen 1.4.0