xref: /netbsd-src/external/gpl3/gcc.old/dist/libstdc++-v3/include/bits/basic_ios.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg // Iostreams base classes -*- C++ -*-
21debfc3dSmrg 
3*8feb0f0bSmrg // Copyright (C) 1997-2020 Free Software Foundation, Inc.
41debfc3dSmrg //
51debfc3dSmrg // This file is part of the GNU ISO C++ Library.  This library is free
61debfc3dSmrg // software; you can redistribute it and/or modify it under the
71debfc3dSmrg // terms of the GNU General Public License as published by the
81debfc3dSmrg // Free Software Foundation; either version 3, or (at your option)
91debfc3dSmrg // any later version.
101debfc3dSmrg 
111debfc3dSmrg // This library is distributed in the hope that it will be useful,
121debfc3dSmrg // but WITHOUT ANY WARRANTY; without even the implied warranty of
131debfc3dSmrg // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
141debfc3dSmrg // GNU General Public License for more details.
151debfc3dSmrg 
161debfc3dSmrg // Under Section 7 of GPL version 3, you are granted additional
171debfc3dSmrg // permissions described in the GCC Runtime Library Exception, version
181debfc3dSmrg // 3.1, as published by the Free Software Foundation.
191debfc3dSmrg 
201debfc3dSmrg // You should have received a copy of the GNU General Public License and
211debfc3dSmrg // a copy of the GCC Runtime Library Exception along with this program;
221debfc3dSmrg // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
231debfc3dSmrg // <http://www.gnu.org/licenses/>.
241debfc3dSmrg 
251debfc3dSmrg /** @file bits/basic_ios.h
261debfc3dSmrg  *  This is an internal header file, included by other library headers.
271debfc3dSmrg  *  Do not attempt to use it directly. @headername{ios}
281debfc3dSmrg  */
291debfc3dSmrg 
301debfc3dSmrg #ifndef _BASIC_IOS_H
311debfc3dSmrg #define _BASIC_IOS_H 1
321debfc3dSmrg 
331debfc3dSmrg #pragma GCC system_header
341debfc3dSmrg 
351debfc3dSmrg #include <bits/localefwd.h>
361debfc3dSmrg #include <bits/locale_classes.h>
371debfc3dSmrg #include <bits/locale_facets.h>
381debfc3dSmrg #include <bits/streambuf_iterator.h>
391debfc3dSmrg #include <bits/move.h>
401debfc3dSmrg 
_GLIBCXX_VISIBILITY(default)411debfc3dSmrg namespace std _GLIBCXX_VISIBILITY(default)
421debfc3dSmrg {
431debfc3dSmrg _GLIBCXX_BEGIN_NAMESPACE_VERSION
441debfc3dSmrg 
451debfc3dSmrg   template<typename _Facet>
461debfc3dSmrg     inline const _Facet&
471debfc3dSmrg     __check_facet(const _Facet* __f)
481debfc3dSmrg     {
491debfc3dSmrg       if (!__f)
501debfc3dSmrg 	__throw_bad_cast();
511debfc3dSmrg       return *__f;
521debfc3dSmrg     }
531debfc3dSmrg 
541debfc3dSmrg   /**
551debfc3dSmrg    *  @brief Template class basic_ios, virtual base class for all
561debfc3dSmrg    *  stream classes.
571debfc3dSmrg    *  @ingroup io
581debfc3dSmrg    *
591debfc3dSmrg    *  @tparam _CharT  Type of character stream.
601debfc3dSmrg    *  @tparam _Traits  Traits for character type, defaults to
611debfc3dSmrg    *                   char_traits<_CharT>.
621debfc3dSmrg    *
631debfc3dSmrg    *  Most of the member functions called dispatched on stream objects
641debfc3dSmrg    *  (e.g., @c std::cout.foo(bar);) are consolidated in this class.
651debfc3dSmrg   */
661debfc3dSmrg   template<typename _CharT, typename _Traits>
671debfc3dSmrg     class basic_ios : public ios_base
681debfc3dSmrg     {
691debfc3dSmrg     public:
70*8feb0f0bSmrg       ///@{
711debfc3dSmrg       /**
721debfc3dSmrg        *  These are standard types.  They permit a standardized way of
731debfc3dSmrg        *  referring to names of (or names dependent on) the template
741debfc3dSmrg        *  parameters, which are specific to the implementation.
751debfc3dSmrg       */
761debfc3dSmrg       typedef _CharT                                 char_type;
771debfc3dSmrg       typedef typename _Traits::int_type             int_type;
781debfc3dSmrg       typedef typename _Traits::pos_type             pos_type;
791debfc3dSmrg       typedef typename _Traits::off_type             off_type;
801debfc3dSmrg       typedef _Traits                                traits_type;
81*8feb0f0bSmrg       ///@}
821debfc3dSmrg 
83*8feb0f0bSmrg       ///@{
841debfc3dSmrg       /**
851debfc3dSmrg        *  These are non-standard types.
861debfc3dSmrg       */
871debfc3dSmrg       typedef ctype<_CharT>                          __ctype_type;
881debfc3dSmrg       typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
891debfc3dSmrg 						     __num_put_type;
901debfc3dSmrg       typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
911debfc3dSmrg 						     __num_get_type;
92*8feb0f0bSmrg       ///@}
931debfc3dSmrg 
941debfc3dSmrg       // Data members:
951debfc3dSmrg     protected:
961debfc3dSmrg       basic_ostream<_CharT, _Traits>*                _M_tie;
971debfc3dSmrg       mutable char_type                              _M_fill;
981debfc3dSmrg       mutable bool                                   _M_fill_init;
991debfc3dSmrg       basic_streambuf<_CharT, _Traits>*              _M_streambuf;
1001debfc3dSmrg 
1011debfc3dSmrg       // Cached use_facet<ctype>, which is based on the current locale info.
1021debfc3dSmrg       const __ctype_type*                            _M_ctype;
1031debfc3dSmrg       // For ostream.
1041debfc3dSmrg       const __num_put_type*                          _M_num_put;
1051debfc3dSmrg       // For istream.
1061debfc3dSmrg       const __num_get_type*                          _M_num_get;
1071debfc3dSmrg 
1081debfc3dSmrg     public:
109*8feb0f0bSmrg       ///@{
1101debfc3dSmrg       /**
1111debfc3dSmrg        *  @brief  The quick-and-easy status check.
1121debfc3dSmrg        *
1131debfc3dSmrg        *  This allows you to write constructs such as
1141debfc3dSmrg        *  <code>if (!a_stream) ...</code> and <code>while (a_stream) ...</code>
1151debfc3dSmrg       */
1161debfc3dSmrg #if __cplusplus >= 201103L
1171debfc3dSmrg       explicit operator bool() const
1181debfc3dSmrg       { return !this->fail(); }
1191debfc3dSmrg #else
1201debfc3dSmrg       operator void*() const
1211debfc3dSmrg       { return this->fail() ? 0 : const_cast<basic_ios*>(this); }
1221debfc3dSmrg #endif
1231debfc3dSmrg 
1241debfc3dSmrg       bool
1251debfc3dSmrg       operator!() const
1261debfc3dSmrg       { return this->fail(); }
127*8feb0f0bSmrg       ///@}
1281debfc3dSmrg 
1291debfc3dSmrg       /**
1301debfc3dSmrg        *  @brief  Returns the error state of the stream buffer.
1311debfc3dSmrg        *  @return  A bit pattern (well, isn't everything?)
1321debfc3dSmrg        *
1331debfc3dSmrg        *  See std::ios_base::iostate for the possible bit values.  Most
1341debfc3dSmrg        *  users will call one of the interpreting wrappers, e.g., good().
1351debfc3dSmrg       */
1361debfc3dSmrg       iostate
1371debfc3dSmrg       rdstate() const
1381debfc3dSmrg       { return _M_streambuf_state; }
1391debfc3dSmrg 
1401debfc3dSmrg       /**
1411debfc3dSmrg        *  @brief  [Re]sets the error state.
1421debfc3dSmrg        *  @param  __state  The new state flag(s) to set.
1431debfc3dSmrg        *
1441debfc3dSmrg        *  See std::ios_base::iostate for the possible bit values.  Most
1451debfc3dSmrg        *  users will not need to pass an argument.
1461debfc3dSmrg       */
1471debfc3dSmrg       void
1481debfc3dSmrg       clear(iostate __state = goodbit);
1491debfc3dSmrg 
1501debfc3dSmrg       /**
1511debfc3dSmrg        *  @brief  Sets additional flags in the error state.
1521debfc3dSmrg        *  @param  __state  The additional state flag(s) to set.
1531debfc3dSmrg        *
1541debfc3dSmrg        *  See std::ios_base::iostate for the possible bit values.
1551debfc3dSmrg       */
1561debfc3dSmrg       void
1571debfc3dSmrg       setstate(iostate __state)
1581debfc3dSmrg       { this->clear(this->rdstate() | __state); }
1591debfc3dSmrg 
1601debfc3dSmrg       // Flip the internal state on for the proper state bits, then
1611debfc3dSmrg       // rethrows the propagated exception if bit also set in
1621debfc3dSmrg       // exceptions().
1631debfc3dSmrg       void
1641debfc3dSmrg       _M_setstate(iostate __state)
1651debfc3dSmrg       {
1661debfc3dSmrg 	// 27.6.1.2.1 Common requirements.
1671debfc3dSmrg 	// Turn this on without causing an ios::failure to be thrown.
1681debfc3dSmrg 	_M_streambuf_state |= __state;
1691debfc3dSmrg 	if (this->exceptions() & __state)
1701debfc3dSmrg 	  __throw_exception_again;
1711debfc3dSmrg       }
1721debfc3dSmrg 
1731debfc3dSmrg       /**
1741debfc3dSmrg        *  @brief  Fast error checking.
1751debfc3dSmrg        *  @return  True if no error flags are set.
1761debfc3dSmrg        *
1771debfc3dSmrg        *  A wrapper around rdstate.
1781debfc3dSmrg       */
1791debfc3dSmrg       bool
1801debfc3dSmrg       good() const
1811debfc3dSmrg       { return this->rdstate() == 0; }
1821debfc3dSmrg 
1831debfc3dSmrg       /**
1841debfc3dSmrg        *  @brief  Fast error checking.
1851debfc3dSmrg        *  @return  True if the eofbit is set.
1861debfc3dSmrg        *
1871debfc3dSmrg        *  Note that other iostate flags may also be set.
1881debfc3dSmrg       */
1891debfc3dSmrg       bool
1901debfc3dSmrg       eof() const
1911debfc3dSmrg       { return (this->rdstate() & eofbit) != 0; }
1921debfc3dSmrg 
1931debfc3dSmrg       /**
1941debfc3dSmrg        *  @brief  Fast error checking.
1951debfc3dSmrg        *  @return  True if either the badbit or the failbit is set.
1961debfc3dSmrg        *
1971debfc3dSmrg        *  Checking the badbit in fail() is historical practice.
1981debfc3dSmrg        *  Note that other iostate flags may also be set.
1991debfc3dSmrg       */
2001debfc3dSmrg       bool
2011debfc3dSmrg       fail() const
2021debfc3dSmrg       { return (this->rdstate() & (badbit | failbit)) != 0; }
2031debfc3dSmrg 
2041debfc3dSmrg       /**
2051debfc3dSmrg        *  @brief  Fast error checking.
2061debfc3dSmrg        *  @return  True if the badbit is set.
2071debfc3dSmrg        *
2081debfc3dSmrg        *  Note that other iostate flags may also be set.
2091debfc3dSmrg       */
2101debfc3dSmrg       bool
2111debfc3dSmrg       bad() const
2121debfc3dSmrg       { return (this->rdstate() & badbit) != 0; }
2131debfc3dSmrg 
2141debfc3dSmrg       /**
2151debfc3dSmrg        *  @brief  Throwing exceptions on errors.
2161debfc3dSmrg        *  @return  The current exceptions mask.
2171debfc3dSmrg        *
2181debfc3dSmrg        *  This changes nothing in the stream.  See the one-argument version
2191debfc3dSmrg        *  of exceptions(iostate) for the meaning of the return value.
2201debfc3dSmrg       */
2211debfc3dSmrg       iostate
2221debfc3dSmrg       exceptions() const
2231debfc3dSmrg       { return _M_exception; }
2241debfc3dSmrg 
2251debfc3dSmrg       /**
2261debfc3dSmrg        *  @brief  Throwing exceptions on errors.
2271debfc3dSmrg        *  @param  __except  The new exceptions mask.
2281debfc3dSmrg        *
2291debfc3dSmrg        *  By default, error flags are set silently.  You can set an
2301debfc3dSmrg        *  exceptions mask for each stream; if a bit in the mask becomes set
2311debfc3dSmrg        *  in the error flags, then an exception of type
2321debfc3dSmrg        *  std::ios_base::failure is thrown.
2331debfc3dSmrg        *
2341debfc3dSmrg        *  If the error flag is already set when the exceptions mask is
2351debfc3dSmrg        *  added, the exception is immediately thrown.  Try running the
2361debfc3dSmrg        *  following under GCC 3.1 or later:
2371debfc3dSmrg        *  @code
2381debfc3dSmrg        *  #include <iostream>
2391debfc3dSmrg        *  #include <fstream>
2401debfc3dSmrg        *  #include <exception>
2411debfc3dSmrg        *
2421debfc3dSmrg        *  int main()
2431debfc3dSmrg        *  {
2441debfc3dSmrg        *      std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
2451debfc3dSmrg        *
2461debfc3dSmrg        *      std::ifstream f ("/etc/motd");
2471debfc3dSmrg        *
2481debfc3dSmrg        *      std::cerr << "Setting badbit\n";
2491debfc3dSmrg        *      f.setstate (std::ios_base::badbit);
2501debfc3dSmrg        *
2511debfc3dSmrg        *      std::cerr << "Setting exception mask\n";
2521debfc3dSmrg        *      f.exceptions (std::ios_base::badbit);
2531debfc3dSmrg        *  }
2541debfc3dSmrg        *  @endcode
2551debfc3dSmrg       */
2561debfc3dSmrg       void
2571debfc3dSmrg       exceptions(iostate __except)
2581debfc3dSmrg       {
2591debfc3dSmrg         _M_exception = __except;
2601debfc3dSmrg         this->clear(_M_streambuf_state);
2611debfc3dSmrg       }
2621debfc3dSmrg 
2631debfc3dSmrg       // Constructor/destructor:
2641debfc3dSmrg       /**
2651debfc3dSmrg        *  @brief  Constructor performs initialization.
2661debfc3dSmrg        *
2671debfc3dSmrg        *  The parameter is passed by derived streams.
2681debfc3dSmrg       */
2691debfc3dSmrg       explicit
2701debfc3dSmrg       basic_ios(basic_streambuf<_CharT, _Traits>* __sb)
2711debfc3dSmrg       : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0),
2721debfc3dSmrg 	_M_ctype(0), _M_num_put(0), _M_num_get(0)
2731debfc3dSmrg       { this->init(__sb); }
2741debfc3dSmrg 
2751debfc3dSmrg       /**
2761debfc3dSmrg        *  @brief  Empty.
2771debfc3dSmrg        *
2781debfc3dSmrg        *  The destructor does nothing.  More specifically, it does not
2791debfc3dSmrg        *  destroy the streambuf held by rdbuf().
2801debfc3dSmrg       */
2811debfc3dSmrg       virtual
2821debfc3dSmrg       ~basic_ios() { }
2831debfc3dSmrg 
2841debfc3dSmrg       // Members:
2851debfc3dSmrg       /**
2861debfc3dSmrg        *  @brief  Fetches the current @e tied stream.
2871debfc3dSmrg        *  @return  A pointer to the tied stream, or NULL if the stream is
2881debfc3dSmrg        *           not tied.
2891debfc3dSmrg        *
2901debfc3dSmrg        *  A stream may be @e tied (or synchronized) to a second output
2911debfc3dSmrg        *  stream.  When this stream performs any I/O, the tied stream is
2921debfc3dSmrg        *  first flushed.  For example, @c std::cin is tied to @c std::cout.
2931debfc3dSmrg       */
2941debfc3dSmrg       basic_ostream<_CharT, _Traits>*
2951debfc3dSmrg       tie() const
2961debfc3dSmrg       { return _M_tie; }
2971debfc3dSmrg 
2981debfc3dSmrg       /**
2991debfc3dSmrg        *  @brief  Ties this stream to an output stream.
3001debfc3dSmrg        *  @param  __tiestr  The output stream.
3011debfc3dSmrg        *  @return  The previously tied output stream, or NULL if the stream
3021debfc3dSmrg        *           was not tied.
3031debfc3dSmrg        *
3041debfc3dSmrg        *  This sets up a new tie; see tie() for more.
3051debfc3dSmrg       */
3061debfc3dSmrg       basic_ostream<_CharT, _Traits>*
3071debfc3dSmrg       tie(basic_ostream<_CharT, _Traits>* __tiestr)
3081debfc3dSmrg       {
3091debfc3dSmrg         basic_ostream<_CharT, _Traits>* __old = _M_tie;
3101debfc3dSmrg         _M_tie = __tiestr;
3111debfc3dSmrg         return __old;
3121debfc3dSmrg       }
3131debfc3dSmrg 
3141debfc3dSmrg       /**
3151debfc3dSmrg        *  @brief  Accessing the underlying buffer.
3161debfc3dSmrg        *  @return  The current stream buffer.
3171debfc3dSmrg        *
3181debfc3dSmrg        *  This does not change the state of the stream.
3191debfc3dSmrg       */
3201debfc3dSmrg       basic_streambuf<_CharT, _Traits>*
3211debfc3dSmrg       rdbuf() const
3221debfc3dSmrg       { return _M_streambuf; }
3231debfc3dSmrg 
3241debfc3dSmrg       /**
3251debfc3dSmrg        *  @brief  Changing the underlying buffer.
3261debfc3dSmrg        *  @param  __sb  The new stream buffer.
3271debfc3dSmrg        *  @return  The previous stream buffer.
3281debfc3dSmrg        *
3291debfc3dSmrg        *  Associates a new buffer with the current stream, and clears the
3301debfc3dSmrg        *  error state.
3311debfc3dSmrg        *
3321debfc3dSmrg        *  Due to historical accidents which the LWG refuses to correct, the
3331debfc3dSmrg        *  I/O library suffers from a design error:  this function is hidden
3341debfc3dSmrg        *  in derived classes by overrides of the zero-argument @c rdbuf(),
3351debfc3dSmrg        *  which is non-virtual for hysterical raisins.  As a result, you
3361debfc3dSmrg        *  must use explicit qualifications to access this function via any
3371debfc3dSmrg        *  derived class.  For example:
3381debfc3dSmrg        *
3391debfc3dSmrg        *  @code
3401debfc3dSmrg        *  std::fstream     foo;         // or some other derived type
3411debfc3dSmrg        *  std::streambuf*  p = .....;
3421debfc3dSmrg        *
3431debfc3dSmrg        *  foo.ios::rdbuf(p);            // ios == basic_ios<char>
3441debfc3dSmrg        *  @endcode
3451debfc3dSmrg       */
3461debfc3dSmrg       basic_streambuf<_CharT, _Traits>*
3471debfc3dSmrg       rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
3481debfc3dSmrg 
3491debfc3dSmrg       /**
3501debfc3dSmrg        *  @brief  Copies fields of __rhs into this.
3511debfc3dSmrg        *  @param  __rhs  The source values for the copies.
3521debfc3dSmrg        *  @return  Reference to this object.
3531debfc3dSmrg        *
3541debfc3dSmrg        *  All fields of __rhs are copied into this object except that rdbuf()
3551debfc3dSmrg        *  and rdstate() remain unchanged.  All values in the pword and iword
3561debfc3dSmrg        *  arrays are copied.  Before copying, each callback is invoked with
3571debfc3dSmrg        *  erase_event.  After copying, each (new) callback is invoked with
3581debfc3dSmrg        *  copyfmt_event.  The final step is to copy exceptions().
3591debfc3dSmrg       */
3601debfc3dSmrg       basic_ios&
3611debfc3dSmrg       copyfmt(const basic_ios& __rhs);
3621debfc3dSmrg 
3631debfc3dSmrg       /**
3641debfc3dSmrg        *  @brief  Retrieves the @a empty character.
3651debfc3dSmrg        *  @return  The current fill character.
3661debfc3dSmrg        *
3671debfc3dSmrg        *  It defaults to a space (' ') in the current locale.
3681debfc3dSmrg       */
3691debfc3dSmrg       char_type
3701debfc3dSmrg       fill() const
3711debfc3dSmrg       {
3721debfc3dSmrg 	if (!_M_fill_init)
3731debfc3dSmrg 	  {
3741debfc3dSmrg 	    _M_fill = this->widen(' ');
3751debfc3dSmrg 	    _M_fill_init = true;
3761debfc3dSmrg 	  }
3771debfc3dSmrg 	return _M_fill;
3781debfc3dSmrg       }
3791debfc3dSmrg 
3801debfc3dSmrg       /**
3811debfc3dSmrg        *  @brief  Sets a new @a empty character.
3821debfc3dSmrg        *  @param  __ch  The new character.
3831debfc3dSmrg        *  @return  The previous fill character.
3841debfc3dSmrg        *
3851debfc3dSmrg        *  The fill character is used to fill out space when P+ characters
3861debfc3dSmrg        *  have been requested (e.g., via setw), Q characters are actually
3871debfc3dSmrg        *  used, and Q<P.  It defaults to a space (' ') in the current locale.
3881debfc3dSmrg       */
3891debfc3dSmrg       char_type
3901debfc3dSmrg       fill(char_type __ch)
3911debfc3dSmrg       {
3921debfc3dSmrg 	char_type __old = this->fill();
3931debfc3dSmrg 	_M_fill = __ch;
3941debfc3dSmrg 	return __old;
3951debfc3dSmrg       }
3961debfc3dSmrg 
3971debfc3dSmrg       // Locales:
3981debfc3dSmrg       /**
3991debfc3dSmrg        *  @brief  Moves to a new locale.
4001debfc3dSmrg        *  @param  __loc  The new locale.
4011debfc3dSmrg        *  @return  The previous locale.
4021debfc3dSmrg        *
4031debfc3dSmrg        *  Calls @c ios_base::imbue(loc), and if a stream buffer is associated
4041debfc3dSmrg        *  with this stream, calls that buffer's @c pubimbue(loc).
4051debfc3dSmrg        *
4061debfc3dSmrg        *  Additional l10n notes are at
4071debfc3dSmrg        *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
4081debfc3dSmrg       */
4091debfc3dSmrg       locale
4101debfc3dSmrg       imbue(const locale& __loc);
4111debfc3dSmrg 
4121debfc3dSmrg       /**
4131debfc3dSmrg        *  @brief  Squeezes characters.
4141debfc3dSmrg        *  @param  __c  The character to narrow.
4151debfc3dSmrg        *  @param  __dfault  The character to narrow.
4161debfc3dSmrg        *  @return  The narrowed character.
4171debfc3dSmrg        *
4181debfc3dSmrg        *  Maps a character of @c char_type to a character of @c char,
4191debfc3dSmrg        *  if possible.
4201debfc3dSmrg        *
4211debfc3dSmrg        *  Returns the result of
4221debfc3dSmrg        *  @code
4231debfc3dSmrg        *    std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
4241debfc3dSmrg        *  @endcode
4251debfc3dSmrg        *
4261debfc3dSmrg        *  Additional l10n notes are at
4271debfc3dSmrg        *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
4281debfc3dSmrg       */
4291debfc3dSmrg       char
4301debfc3dSmrg       narrow(char_type __c, char __dfault) const
4311debfc3dSmrg       { return __check_facet(_M_ctype).narrow(__c, __dfault); }
4321debfc3dSmrg 
4331debfc3dSmrg       /**
4341debfc3dSmrg        *  @brief  Widens characters.
4351debfc3dSmrg        *  @param  __c  The character to widen.
4361debfc3dSmrg        *  @return  The widened character.
4371debfc3dSmrg        *
4381debfc3dSmrg        *  Maps a character of @c char to a character of @c char_type.
4391debfc3dSmrg        *
4401debfc3dSmrg        *  Returns the result of
4411debfc3dSmrg        *  @code
4421debfc3dSmrg        *    std::use_facet<ctype<char_type> >(getloc()).widen(c)
4431debfc3dSmrg        *  @endcode
4441debfc3dSmrg        *
4451debfc3dSmrg        *  Additional l10n notes are at
4461debfc3dSmrg        *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
4471debfc3dSmrg       */
4481debfc3dSmrg       char_type
4491debfc3dSmrg       widen(char __c) const
4501debfc3dSmrg       { return __check_facet(_M_ctype).widen(__c); }
4511debfc3dSmrg 
4521debfc3dSmrg     protected:
4531debfc3dSmrg       // 27.4.5.1  basic_ios constructors
4541debfc3dSmrg       /**
4551debfc3dSmrg        *  @brief  Empty.
4561debfc3dSmrg        *
4571debfc3dSmrg        *  The default constructor does nothing and is not normally
4581debfc3dSmrg        *  accessible to users.
4591debfc3dSmrg       */
4601debfc3dSmrg       basic_ios()
4611debfc3dSmrg       : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false),
4621debfc3dSmrg 	_M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
4631debfc3dSmrg       { }
4641debfc3dSmrg 
4651debfc3dSmrg       /**
4661debfc3dSmrg        *  @brief  All setup is performed here.
4671debfc3dSmrg        *
4681debfc3dSmrg        *  This is called from the public constructor.  It is not virtual and
4691debfc3dSmrg        *  cannot be redefined.
4701debfc3dSmrg       */
4711debfc3dSmrg       void
4721debfc3dSmrg       init(basic_streambuf<_CharT, _Traits>* __sb);
4731debfc3dSmrg 
4741debfc3dSmrg #if __cplusplus >= 201103L
4751debfc3dSmrg       basic_ios(const basic_ios&) = delete;
4761debfc3dSmrg       basic_ios& operator=(const basic_ios&) = delete;
4771debfc3dSmrg 
4781debfc3dSmrg       void
4791debfc3dSmrg       move(basic_ios& __rhs)
4801debfc3dSmrg       {
4811debfc3dSmrg 	ios_base::_M_move(__rhs);
4821debfc3dSmrg 	_M_cache_locale(_M_ios_locale);
4831debfc3dSmrg 	this->tie(__rhs.tie(nullptr));
4841debfc3dSmrg 	_M_fill = __rhs._M_fill;
4851debfc3dSmrg 	_M_fill_init = __rhs._M_fill_init;
4861debfc3dSmrg 	_M_streambuf = nullptr;
4871debfc3dSmrg       }
4881debfc3dSmrg 
4891debfc3dSmrg       void
4901debfc3dSmrg       move(basic_ios&& __rhs)
4911debfc3dSmrg       { this->move(__rhs); }
4921debfc3dSmrg 
4931debfc3dSmrg       void
4941debfc3dSmrg       swap(basic_ios& __rhs) noexcept
4951debfc3dSmrg       {
4961debfc3dSmrg 	ios_base::_M_swap(__rhs);
4971debfc3dSmrg 	_M_cache_locale(_M_ios_locale);
4981debfc3dSmrg 	__rhs._M_cache_locale(__rhs._M_ios_locale);
4991debfc3dSmrg 	std::swap(_M_tie, __rhs._M_tie);
5001debfc3dSmrg 	std::swap(_M_fill, __rhs._M_fill);
5011debfc3dSmrg 	std::swap(_M_fill_init, __rhs._M_fill_init);
5021debfc3dSmrg       }
5031debfc3dSmrg 
5041debfc3dSmrg       void
5051debfc3dSmrg       set_rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
5061debfc3dSmrg       { _M_streambuf = __sb; }
5071debfc3dSmrg #endif
5081debfc3dSmrg 
5091debfc3dSmrg       void
5101debfc3dSmrg       _M_cache_locale(const locale& __loc);
5111debfc3dSmrg     };
5121debfc3dSmrg 
5131debfc3dSmrg _GLIBCXX_END_NAMESPACE_VERSION
5141debfc3dSmrg } // namespace
5151debfc3dSmrg 
5161debfc3dSmrg #include <bits/basic_ios.tcc>
5171debfc3dSmrg 
5181debfc3dSmrg #endif /* _BASIC_IOS_H */
519