1*38fd1498Szrj // Iostreams base classes -*- C++ -*-
2*38fd1498Szrj
3*38fd1498Szrj // Copyright (C) 1997-2018 Free Software Foundation, Inc.
4*38fd1498Szrj //
5*38fd1498Szrj // This file is part of the GNU ISO C++ Library. This library is free
6*38fd1498Szrj // software; you can redistribute it and/or modify it under the
7*38fd1498Szrj // terms of the GNU General Public License as published by the
8*38fd1498Szrj // Free Software Foundation; either version 3, or (at your option)
9*38fd1498Szrj // any later version.
10*38fd1498Szrj
11*38fd1498Szrj // This library is distributed in the hope that it will be useful,
12*38fd1498Szrj // but WITHOUT ANY WARRANTY; without even the implied warranty of
13*38fd1498Szrj // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*38fd1498Szrj // GNU General Public License for more details.
15*38fd1498Szrj
16*38fd1498Szrj // Under Section 7 of GPL version 3, you are granted additional
17*38fd1498Szrj // permissions described in the GCC Runtime Library Exception, version
18*38fd1498Szrj // 3.1, as published by the Free Software Foundation.
19*38fd1498Szrj
20*38fd1498Szrj // You should have received a copy of the GNU General Public License and
21*38fd1498Szrj // a copy of the GCC Runtime Library Exception along with this program;
22*38fd1498Szrj // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23*38fd1498Szrj // <http://www.gnu.org/licenses/>.
24*38fd1498Szrj
25*38fd1498Szrj /** @file bits/basic_ios.h
26*38fd1498Szrj * This is an internal header file, included by other library headers.
27*38fd1498Szrj * Do not attempt to use it directly. @headername{ios}
28*38fd1498Szrj */
29*38fd1498Szrj
30*38fd1498Szrj #ifndef _BASIC_IOS_H
31*38fd1498Szrj #define _BASIC_IOS_H 1
32*38fd1498Szrj
33*38fd1498Szrj #pragma GCC system_header
34*38fd1498Szrj
35*38fd1498Szrj #include <bits/localefwd.h>
36*38fd1498Szrj #include <bits/locale_classes.h>
37*38fd1498Szrj #include <bits/locale_facets.h>
38*38fd1498Szrj #include <bits/streambuf_iterator.h>
39*38fd1498Szrj #include <bits/move.h>
40*38fd1498Szrj
_GLIBCXX_VISIBILITY(default)41*38fd1498Szrj namespace std _GLIBCXX_VISIBILITY(default)
42*38fd1498Szrj {
43*38fd1498Szrj _GLIBCXX_BEGIN_NAMESPACE_VERSION
44*38fd1498Szrj
45*38fd1498Szrj template<typename _Facet>
46*38fd1498Szrj inline const _Facet&
47*38fd1498Szrj __check_facet(const _Facet* __f)
48*38fd1498Szrj {
49*38fd1498Szrj if (!__f)
50*38fd1498Szrj __throw_bad_cast();
51*38fd1498Szrj return *__f;
52*38fd1498Szrj }
53*38fd1498Szrj
54*38fd1498Szrj /**
55*38fd1498Szrj * @brief Template class basic_ios, virtual base class for all
56*38fd1498Szrj * stream classes.
57*38fd1498Szrj * @ingroup io
58*38fd1498Szrj *
59*38fd1498Szrj * @tparam _CharT Type of character stream.
60*38fd1498Szrj * @tparam _Traits Traits for character type, defaults to
61*38fd1498Szrj * char_traits<_CharT>.
62*38fd1498Szrj *
63*38fd1498Szrj * Most of the member functions called dispatched on stream objects
64*38fd1498Szrj * (e.g., @c std::cout.foo(bar);) are consolidated in this class.
65*38fd1498Szrj */
66*38fd1498Szrj template<typename _CharT, typename _Traits>
67*38fd1498Szrj class basic_ios : public ios_base
68*38fd1498Szrj {
69*38fd1498Szrj public:
70*38fd1498Szrj //@{
71*38fd1498Szrj /**
72*38fd1498Szrj * These are standard types. They permit a standardized way of
73*38fd1498Szrj * referring to names of (or names dependent on) the template
74*38fd1498Szrj * parameters, which are specific to the implementation.
75*38fd1498Szrj */
76*38fd1498Szrj typedef _CharT char_type;
77*38fd1498Szrj typedef typename _Traits::int_type int_type;
78*38fd1498Szrj typedef typename _Traits::pos_type pos_type;
79*38fd1498Szrj typedef typename _Traits::off_type off_type;
80*38fd1498Szrj typedef _Traits traits_type;
81*38fd1498Szrj //@}
82*38fd1498Szrj
83*38fd1498Szrj //@{
84*38fd1498Szrj /**
85*38fd1498Szrj * These are non-standard types.
86*38fd1498Szrj */
87*38fd1498Szrj typedef ctype<_CharT> __ctype_type;
88*38fd1498Szrj typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
89*38fd1498Szrj __num_put_type;
90*38fd1498Szrj typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
91*38fd1498Szrj __num_get_type;
92*38fd1498Szrj //@}
93*38fd1498Szrj
94*38fd1498Szrj // Data members:
95*38fd1498Szrj protected:
96*38fd1498Szrj basic_ostream<_CharT, _Traits>* _M_tie;
97*38fd1498Szrj mutable char_type _M_fill;
98*38fd1498Szrj mutable bool _M_fill_init;
99*38fd1498Szrj basic_streambuf<_CharT, _Traits>* _M_streambuf;
100*38fd1498Szrj
101*38fd1498Szrj // Cached use_facet<ctype>, which is based on the current locale info.
102*38fd1498Szrj const __ctype_type* _M_ctype;
103*38fd1498Szrj // For ostream.
104*38fd1498Szrj const __num_put_type* _M_num_put;
105*38fd1498Szrj // For istream.
106*38fd1498Szrj const __num_get_type* _M_num_get;
107*38fd1498Szrj
108*38fd1498Szrj public:
109*38fd1498Szrj //@{
110*38fd1498Szrj /**
111*38fd1498Szrj * @brief The quick-and-easy status check.
112*38fd1498Szrj *
113*38fd1498Szrj * This allows you to write constructs such as
114*38fd1498Szrj * <code>if (!a_stream) ...</code> and <code>while (a_stream) ...</code>
115*38fd1498Szrj */
116*38fd1498Szrj #if __cplusplus >= 201103L
117*38fd1498Szrj explicit operator bool() const
118*38fd1498Szrj { return !this->fail(); }
119*38fd1498Szrj #else
120*38fd1498Szrj operator void*() const
121*38fd1498Szrj { return this->fail() ? 0 : const_cast<basic_ios*>(this); }
122*38fd1498Szrj #endif
123*38fd1498Szrj
124*38fd1498Szrj bool
125*38fd1498Szrj operator!() const
126*38fd1498Szrj { return this->fail(); }
127*38fd1498Szrj //@}
128*38fd1498Szrj
129*38fd1498Szrj /**
130*38fd1498Szrj * @brief Returns the error state of the stream buffer.
131*38fd1498Szrj * @return A bit pattern (well, isn't everything?)
132*38fd1498Szrj *
133*38fd1498Szrj * See std::ios_base::iostate for the possible bit values. Most
134*38fd1498Szrj * users will call one of the interpreting wrappers, e.g., good().
135*38fd1498Szrj */
136*38fd1498Szrj iostate
137*38fd1498Szrj rdstate() const
138*38fd1498Szrj { return _M_streambuf_state; }
139*38fd1498Szrj
140*38fd1498Szrj /**
141*38fd1498Szrj * @brief [Re]sets the error state.
142*38fd1498Szrj * @param __state The new state flag(s) to set.
143*38fd1498Szrj *
144*38fd1498Szrj * See std::ios_base::iostate for the possible bit values. Most
145*38fd1498Szrj * users will not need to pass an argument.
146*38fd1498Szrj */
147*38fd1498Szrj void
148*38fd1498Szrj clear(iostate __state = goodbit);
149*38fd1498Szrj
150*38fd1498Szrj /**
151*38fd1498Szrj * @brief Sets additional flags in the error state.
152*38fd1498Szrj * @param __state The additional state flag(s) to set.
153*38fd1498Szrj *
154*38fd1498Szrj * See std::ios_base::iostate for the possible bit values.
155*38fd1498Szrj */
156*38fd1498Szrj void
157*38fd1498Szrj setstate(iostate __state)
158*38fd1498Szrj { this->clear(this->rdstate() | __state); }
159*38fd1498Szrj
160*38fd1498Szrj // Flip the internal state on for the proper state bits, then
161*38fd1498Szrj // rethrows the propagated exception if bit also set in
162*38fd1498Szrj // exceptions().
163*38fd1498Szrj void
164*38fd1498Szrj _M_setstate(iostate __state)
165*38fd1498Szrj {
166*38fd1498Szrj // 27.6.1.2.1 Common requirements.
167*38fd1498Szrj // Turn this on without causing an ios::failure to be thrown.
168*38fd1498Szrj _M_streambuf_state |= __state;
169*38fd1498Szrj if (this->exceptions() & __state)
170*38fd1498Szrj __throw_exception_again;
171*38fd1498Szrj }
172*38fd1498Szrj
173*38fd1498Szrj /**
174*38fd1498Szrj * @brief Fast error checking.
175*38fd1498Szrj * @return True if no error flags are set.
176*38fd1498Szrj *
177*38fd1498Szrj * A wrapper around rdstate.
178*38fd1498Szrj */
179*38fd1498Szrj bool
180*38fd1498Szrj good() const
181*38fd1498Szrj { return this->rdstate() == 0; }
182*38fd1498Szrj
183*38fd1498Szrj /**
184*38fd1498Szrj * @brief Fast error checking.
185*38fd1498Szrj * @return True if the eofbit is set.
186*38fd1498Szrj *
187*38fd1498Szrj * Note that other iostate flags may also be set.
188*38fd1498Szrj */
189*38fd1498Szrj bool
190*38fd1498Szrj eof() const
191*38fd1498Szrj { return (this->rdstate() & eofbit) != 0; }
192*38fd1498Szrj
193*38fd1498Szrj /**
194*38fd1498Szrj * @brief Fast error checking.
195*38fd1498Szrj * @return True if either the badbit or the failbit is set.
196*38fd1498Szrj *
197*38fd1498Szrj * Checking the badbit in fail() is historical practice.
198*38fd1498Szrj * Note that other iostate flags may also be set.
199*38fd1498Szrj */
200*38fd1498Szrj bool
201*38fd1498Szrj fail() const
202*38fd1498Szrj { return (this->rdstate() & (badbit | failbit)) != 0; }
203*38fd1498Szrj
204*38fd1498Szrj /**
205*38fd1498Szrj * @brief Fast error checking.
206*38fd1498Szrj * @return True if the badbit is set.
207*38fd1498Szrj *
208*38fd1498Szrj * Note that other iostate flags may also be set.
209*38fd1498Szrj */
210*38fd1498Szrj bool
211*38fd1498Szrj bad() const
212*38fd1498Szrj { return (this->rdstate() & badbit) != 0; }
213*38fd1498Szrj
214*38fd1498Szrj /**
215*38fd1498Szrj * @brief Throwing exceptions on errors.
216*38fd1498Szrj * @return The current exceptions mask.
217*38fd1498Szrj *
218*38fd1498Szrj * This changes nothing in the stream. See the one-argument version
219*38fd1498Szrj * of exceptions(iostate) for the meaning of the return value.
220*38fd1498Szrj */
221*38fd1498Szrj iostate
222*38fd1498Szrj exceptions() const
223*38fd1498Szrj { return _M_exception; }
224*38fd1498Szrj
225*38fd1498Szrj /**
226*38fd1498Szrj * @brief Throwing exceptions on errors.
227*38fd1498Szrj * @param __except The new exceptions mask.
228*38fd1498Szrj *
229*38fd1498Szrj * By default, error flags are set silently. You can set an
230*38fd1498Szrj * exceptions mask for each stream; if a bit in the mask becomes set
231*38fd1498Szrj * in the error flags, then an exception of type
232*38fd1498Szrj * std::ios_base::failure is thrown.
233*38fd1498Szrj *
234*38fd1498Szrj * If the error flag is already set when the exceptions mask is
235*38fd1498Szrj * added, the exception is immediately thrown. Try running the
236*38fd1498Szrj * following under GCC 3.1 or later:
237*38fd1498Szrj * @code
238*38fd1498Szrj * #include <iostream>
239*38fd1498Szrj * #include <fstream>
240*38fd1498Szrj * #include <exception>
241*38fd1498Szrj *
242*38fd1498Szrj * int main()
243*38fd1498Szrj * {
244*38fd1498Szrj * std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
245*38fd1498Szrj *
246*38fd1498Szrj * std::ifstream f ("/etc/motd");
247*38fd1498Szrj *
248*38fd1498Szrj * std::cerr << "Setting badbit\n";
249*38fd1498Szrj * f.setstate (std::ios_base::badbit);
250*38fd1498Szrj *
251*38fd1498Szrj * std::cerr << "Setting exception mask\n";
252*38fd1498Szrj * f.exceptions (std::ios_base::badbit);
253*38fd1498Szrj * }
254*38fd1498Szrj * @endcode
255*38fd1498Szrj */
256*38fd1498Szrj void
257*38fd1498Szrj exceptions(iostate __except)
258*38fd1498Szrj {
259*38fd1498Szrj _M_exception = __except;
260*38fd1498Szrj this->clear(_M_streambuf_state);
261*38fd1498Szrj }
262*38fd1498Szrj
263*38fd1498Szrj // Constructor/destructor:
264*38fd1498Szrj /**
265*38fd1498Szrj * @brief Constructor performs initialization.
266*38fd1498Szrj *
267*38fd1498Szrj * The parameter is passed by derived streams.
268*38fd1498Szrj */
269*38fd1498Szrj explicit
270*38fd1498Szrj basic_ios(basic_streambuf<_CharT, _Traits>* __sb)
271*38fd1498Szrj : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0),
272*38fd1498Szrj _M_ctype(0), _M_num_put(0), _M_num_get(0)
273*38fd1498Szrj { this->init(__sb); }
274*38fd1498Szrj
275*38fd1498Szrj /**
276*38fd1498Szrj * @brief Empty.
277*38fd1498Szrj *
278*38fd1498Szrj * The destructor does nothing. More specifically, it does not
279*38fd1498Szrj * destroy the streambuf held by rdbuf().
280*38fd1498Szrj */
281*38fd1498Szrj virtual
282*38fd1498Szrj ~basic_ios() { }
283*38fd1498Szrj
284*38fd1498Szrj // Members:
285*38fd1498Szrj /**
286*38fd1498Szrj * @brief Fetches the current @e tied stream.
287*38fd1498Szrj * @return A pointer to the tied stream, or NULL if the stream is
288*38fd1498Szrj * not tied.
289*38fd1498Szrj *
290*38fd1498Szrj * A stream may be @e tied (or synchronized) to a second output
291*38fd1498Szrj * stream. When this stream performs any I/O, the tied stream is
292*38fd1498Szrj * first flushed. For example, @c std::cin is tied to @c std::cout.
293*38fd1498Szrj */
294*38fd1498Szrj basic_ostream<_CharT, _Traits>*
295*38fd1498Szrj tie() const
296*38fd1498Szrj { return _M_tie; }
297*38fd1498Szrj
298*38fd1498Szrj /**
299*38fd1498Szrj * @brief Ties this stream to an output stream.
300*38fd1498Szrj * @param __tiestr The output stream.
301*38fd1498Szrj * @return The previously tied output stream, or NULL if the stream
302*38fd1498Szrj * was not tied.
303*38fd1498Szrj *
304*38fd1498Szrj * This sets up a new tie; see tie() for more.
305*38fd1498Szrj */
306*38fd1498Szrj basic_ostream<_CharT, _Traits>*
307*38fd1498Szrj tie(basic_ostream<_CharT, _Traits>* __tiestr)
308*38fd1498Szrj {
309*38fd1498Szrj basic_ostream<_CharT, _Traits>* __old = _M_tie;
310*38fd1498Szrj _M_tie = __tiestr;
311*38fd1498Szrj return __old;
312*38fd1498Szrj }
313*38fd1498Szrj
314*38fd1498Szrj /**
315*38fd1498Szrj * @brief Accessing the underlying buffer.
316*38fd1498Szrj * @return The current stream buffer.
317*38fd1498Szrj *
318*38fd1498Szrj * This does not change the state of the stream.
319*38fd1498Szrj */
320*38fd1498Szrj basic_streambuf<_CharT, _Traits>*
321*38fd1498Szrj rdbuf() const
322*38fd1498Szrj { return _M_streambuf; }
323*38fd1498Szrj
324*38fd1498Szrj /**
325*38fd1498Szrj * @brief Changing the underlying buffer.
326*38fd1498Szrj * @param __sb The new stream buffer.
327*38fd1498Szrj * @return The previous stream buffer.
328*38fd1498Szrj *
329*38fd1498Szrj * Associates a new buffer with the current stream, and clears the
330*38fd1498Szrj * error state.
331*38fd1498Szrj *
332*38fd1498Szrj * Due to historical accidents which the LWG refuses to correct, the
333*38fd1498Szrj * I/O library suffers from a design error: this function is hidden
334*38fd1498Szrj * in derived classes by overrides of the zero-argument @c rdbuf(),
335*38fd1498Szrj * which is non-virtual for hysterical raisins. As a result, you
336*38fd1498Szrj * must use explicit qualifications to access this function via any
337*38fd1498Szrj * derived class. For example:
338*38fd1498Szrj *
339*38fd1498Szrj * @code
340*38fd1498Szrj * std::fstream foo; // or some other derived type
341*38fd1498Szrj * std::streambuf* p = .....;
342*38fd1498Szrj *
343*38fd1498Szrj * foo.ios::rdbuf(p); // ios == basic_ios<char>
344*38fd1498Szrj * @endcode
345*38fd1498Szrj */
346*38fd1498Szrj basic_streambuf<_CharT, _Traits>*
347*38fd1498Szrj rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
348*38fd1498Szrj
349*38fd1498Szrj /**
350*38fd1498Szrj * @brief Copies fields of __rhs into this.
351*38fd1498Szrj * @param __rhs The source values for the copies.
352*38fd1498Szrj * @return Reference to this object.
353*38fd1498Szrj *
354*38fd1498Szrj * All fields of __rhs are copied into this object except that rdbuf()
355*38fd1498Szrj * and rdstate() remain unchanged. All values in the pword and iword
356*38fd1498Szrj * arrays are copied. Before copying, each callback is invoked with
357*38fd1498Szrj * erase_event. After copying, each (new) callback is invoked with
358*38fd1498Szrj * copyfmt_event. The final step is to copy exceptions().
359*38fd1498Szrj */
360*38fd1498Szrj basic_ios&
361*38fd1498Szrj copyfmt(const basic_ios& __rhs);
362*38fd1498Szrj
363*38fd1498Szrj /**
364*38fd1498Szrj * @brief Retrieves the @a empty character.
365*38fd1498Szrj * @return The current fill character.
366*38fd1498Szrj *
367*38fd1498Szrj * It defaults to a space (' ') in the current locale.
368*38fd1498Szrj */
369*38fd1498Szrj char_type
370*38fd1498Szrj fill() const
371*38fd1498Szrj {
372*38fd1498Szrj if (!_M_fill_init)
373*38fd1498Szrj {
374*38fd1498Szrj _M_fill = this->widen(' ');
375*38fd1498Szrj _M_fill_init = true;
376*38fd1498Szrj }
377*38fd1498Szrj return _M_fill;
378*38fd1498Szrj }
379*38fd1498Szrj
380*38fd1498Szrj /**
381*38fd1498Szrj * @brief Sets a new @a empty character.
382*38fd1498Szrj * @param __ch The new character.
383*38fd1498Szrj * @return The previous fill character.
384*38fd1498Szrj *
385*38fd1498Szrj * The fill character is used to fill out space when P+ characters
386*38fd1498Szrj * have been requested (e.g., via setw), Q characters are actually
387*38fd1498Szrj * used, and Q<P. It defaults to a space (' ') in the current locale.
388*38fd1498Szrj */
389*38fd1498Szrj char_type
390*38fd1498Szrj fill(char_type __ch)
391*38fd1498Szrj {
392*38fd1498Szrj char_type __old = this->fill();
393*38fd1498Szrj _M_fill = __ch;
394*38fd1498Szrj return __old;
395*38fd1498Szrj }
396*38fd1498Szrj
397*38fd1498Szrj // Locales:
398*38fd1498Szrj /**
399*38fd1498Szrj * @brief Moves to a new locale.
400*38fd1498Szrj * @param __loc The new locale.
401*38fd1498Szrj * @return The previous locale.
402*38fd1498Szrj *
403*38fd1498Szrj * Calls @c ios_base::imbue(loc), and if a stream buffer is associated
404*38fd1498Szrj * with this stream, calls that buffer's @c pubimbue(loc).
405*38fd1498Szrj *
406*38fd1498Szrj * Additional l10n notes are at
407*38fd1498Szrj * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
408*38fd1498Szrj */
409*38fd1498Szrj locale
410*38fd1498Szrj imbue(const locale& __loc);
411*38fd1498Szrj
412*38fd1498Szrj /**
413*38fd1498Szrj * @brief Squeezes characters.
414*38fd1498Szrj * @param __c The character to narrow.
415*38fd1498Szrj * @param __dfault The character to narrow.
416*38fd1498Szrj * @return The narrowed character.
417*38fd1498Szrj *
418*38fd1498Szrj * Maps a character of @c char_type to a character of @c char,
419*38fd1498Szrj * if possible.
420*38fd1498Szrj *
421*38fd1498Szrj * Returns the result of
422*38fd1498Szrj * @code
423*38fd1498Szrj * std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
424*38fd1498Szrj * @endcode
425*38fd1498Szrj *
426*38fd1498Szrj * Additional l10n notes are at
427*38fd1498Szrj * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
428*38fd1498Szrj */
429*38fd1498Szrj char
430*38fd1498Szrj narrow(char_type __c, char __dfault) const
431*38fd1498Szrj { return __check_facet(_M_ctype).narrow(__c, __dfault); }
432*38fd1498Szrj
433*38fd1498Szrj /**
434*38fd1498Szrj * @brief Widens characters.
435*38fd1498Szrj * @param __c The character to widen.
436*38fd1498Szrj * @return The widened character.
437*38fd1498Szrj *
438*38fd1498Szrj * Maps a character of @c char to a character of @c char_type.
439*38fd1498Szrj *
440*38fd1498Szrj * Returns the result of
441*38fd1498Szrj * @code
442*38fd1498Szrj * std::use_facet<ctype<char_type> >(getloc()).widen(c)
443*38fd1498Szrj * @endcode
444*38fd1498Szrj *
445*38fd1498Szrj * Additional l10n notes are at
446*38fd1498Szrj * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
447*38fd1498Szrj */
448*38fd1498Szrj char_type
449*38fd1498Szrj widen(char __c) const
450*38fd1498Szrj { return __check_facet(_M_ctype).widen(__c); }
451*38fd1498Szrj
452*38fd1498Szrj protected:
453*38fd1498Szrj // 27.4.5.1 basic_ios constructors
454*38fd1498Szrj /**
455*38fd1498Szrj * @brief Empty.
456*38fd1498Szrj *
457*38fd1498Szrj * The default constructor does nothing and is not normally
458*38fd1498Szrj * accessible to users.
459*38fd1498Szrj */
460*38fd1498Szrj basic_ios()
461*38fd1498Szrj : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false),
462*38fd1498Szrj _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
463*38fd1498Szrj { }
464*38fd1498Szrj
465*38fd1498Szrj /**
466*38fd1498Szrj * @brief All setup is performed here.
467*38fd1498Szrj *
468*38fd1498Szrj * This is called from the public constructor. It is not virtual and
469*38fd1498Szrj * cannot be redefined.
470*38fd1498Szrj */
471*38fd1498Szrj void
472*38fd1498Szrj init(basic_streambuf<_CharT, _Traits>* __sb);
473*38fd1498Szrj
474*38fd1498Szrj #if __cplusplus >= 201103L
475*38fd1498Szrj basic_ios(const basic_ios&) = delete;
476*38fd1498Szrj basic_ios& operator=(const basic_ios&) = delete;
477*38fd1498Szrj
478*38fd1498Szrj void
479*38fd1498Szrj move(basic_ios& __rhs)
480*38fd1498Szrj {
481*38fd1498Szrj ios_base::_M_move(__rhs);
482*38fd1498Szrj _M_cache_locale(_M_ios_locale);
483*38fd1498Szrj this->tie(__rhs.tie(nullptr));
484*38fd1498Szrj _M_fill = __rhs._M_fill;
485*38fd1498Szrj _M_fill_init = __rhs._M_fill_init;
486*38fd1498Szrj _M_streambuf = nullptr;
487*38fd1498Szrj }
488*38fd1498Szrj
489*38fd1498Szrj void
490*38fd1498Szrj move(basic_ios&& __rhs)
491*38fd1498Szrj { this->move(__rhs); }
492*38fd1498Szrj
493*38fd1498Szrj void
494*38fd1498Szrj swap(basic_ios& __rhs) noexcept
495*38fd1498Szrj {
496*38fd1498Szrj ios_base::_M_swap(__rhs);
497*38fd1498Szrj _M_cache_locale(_M_ios_locale);
498*38fd1498Szrj __rhs._M_cache_locale(__rhs._M_ios_locale);
499*38fd1498Szrj std::swap(_M_tie, __rhs._M_tie);
500*38fd1498Szrj std::swap(_M_fill, __rhs._M_fill);
501*38fd1498Szrj std::swap(_M_fill_init, __rhs._M_fill_init);
502*38fd1498Szrj }
503*38fd1498Szrj
504*38fd1498Szrj void
505*38fd1498Szrj set_rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
506*38fd1498Szrj { _M_streambuf = __sb; }
507*38fd1498Szrj #endif
508*38fd1498Szrj
509*38fd1498Szrj void
510*38fd1498Szrj _M_cache_locale(const locale& __loc);
511*38fd1498Szrj };
512*38fd1498Szrj
513*38fd1498Szrj _GLIBCXX_END_NAMESPACE_VERSION
514*38fd1498Szrj } // namespace
515*38fd1498Szrj
516*38fd1498Szrj #include <bits/basic_ios.tcc>
517*38fd1498Szrj
518*38fd1498Szrj #endif /* _BASIC_IOS_H */
519