]> CyberLeo.Net >> Repos - FreeBSD/releng/9.1.git/blob - contrib/libc++/include/ios
Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.
[FreeBSD/releng/9.1.git] / contrib / libc++ / include / ios
1 // -*- C++ -*-
2 //===---------------------------- ios -------------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef _LIBCPP_IOS
12 #define _LIBCPP_IOS
13
14 /*
15     ios synopsis
16
17 #include <iosfwd>
18
19 namespace std
20 {
21
22 typedef OFF_T streamoff;
23 typedef SZ_T streamsize;
24 template <class stateT> class fpos;
25
26 class ios_base
27 {
28 public:
29     class failure;
30
31     typedef T1 fmtflags;
32     static const fmtflags boolalpha;
33     static const fmtflags dec;
34     static const fmtflags fixed;
35     static const fmtflags hex;
36     static const fmtflags internal;
37     static const fmtflags left;
38     static const fmtflags oct;
39     static const fmtflags right;
40     static const fmtflags scientific;
41     static const fmtflags showbase;
42     static const fmtflags showpoint;
43     static const fmtflags showpos;
44     static const fmtflags skipws;
45     static const fmtflags unitbuf;
46     static const fmtflags uppercase;
47     static const fmtflags adjustfield;
48     static const fmtflags basefield;
49     static const fmtflags floatfield;
50
51     typedef T2 iostate;
52     static const iostate badbit;
53     static const iostate eofbit;
54     static const iostate failbit;
55     static const iostate goodbit;
56
57     typedef T3 openmode;
58     static const openmode app;
59     static const openmode ate;
60     static const openmode binary;
61     static const openmode in;
62     static const openmode out;
63     static const openmode trunc;
64
65     typedef T4 seekdir;
66     static const seekdir beg;
67     static const seekdir cur;
68     static const seekdir end;
69
70     class Init;
71
72     // 27.5.2.2 fmtflags state:
73     fmtflags flags() const;
74     fmtflags flags(fmtflags fmtfl);
75     fmtflags setf(fmtflags fmtfl);
76     fmtflags setf(fmtflags fmtfl, fmtflags mask);
77     void unsetf(fmtflags mask);
78
79     streamsize precision() const;
80     streamsize precision(streamsize prec);
81     streamsize width() const;
82     streamsize width(streamsize wide);
83
84     // 27.5.2.3 locales:
85     locale imbue(const locale& loc);
86     locale getloc() const;
87
88     // 27.5.2.5 storage:
89     static int xalloc();
90     long& iword(int index);
91     void*& pword(int index);
92
93     // destructor
94     virtual ~ios_base();
95
96     // 27.5.2.6 callbacks;
97     enum event { erase_event, imbue_event, copyfmt_event };
98     typedef void (*event_callback)(event, ios_base&, int index);
99     void register_callback(event_callback fn, int index);
100
101     ios_base(const ios_base&) = delete;
102     ios_base& operator=(const ios_base&) = delete;
103
104     static bool sync_with_stdio(bool sync = true);
105
106 protected:
107     ios_base();
108 };
109
110 template <class charT, class traits = char_traits<charT> >
111 class basic_ios
112     : public ios_base
113 {
114 public:
115     // types:
116     typedef charT char_type;
117     typedef typename traits::int_type int_type;
118     typedef typename traits::pos_type pos_type;
119     typedef typename traits::off_type off_type;
120     typedef traits traits_type;
121
122     operator unspecified-bool-type() const;
123     bool operator!() const;
124     iostate rdstate() const;
125     void clear(iostate state = goodbit);
126     void setstate(iostate state);
127     bool good() const;
128     bool eof() const;
129     bool fail() const;
130     bool bad() const;
131
132     iostate exceptions() const;
133     void exceptions(iostate except);
134
135     // 27.5.4.1 Constructor/destructor:
136     explicit basic_ios(basic_streambuf<charT,traits>* sb);
137     virtual ~basic_ios();
138
139     // 27.5.4.2 Members:
140     basic_ostream<charT,traits>* tie() const;
141     basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
142
143     basic_streambuf<charT,traits>* rdbuf() const;
144     basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
145
146     basic_ios& copyfmt(const basic_ios& rhs);
147
148     char_type fill() const;
149     char_type fill(char_type ch);
150
151     locale imbue(const locale& loc);
152
153     char narrow(char_type c, char dfault) const;
154     char_type widen(char c) const;
155
156     basic_ios(const basic_ios& ) = delete;
157     basic_ios& operator=(const basic_ios&) = delete;
158
159 protected:
160     basic_ios();
161     void init(basic_streambuf<charT,traits>* sb);
162     void move(basic_ios& rhs);
163     void swap(basic_ios& rhs);
164     void set_rdbuf(basic_streambuf<charT, traits>* sb);
165 };
166
167 // 27.5.5, manipulators:
168 ios_base& boolalpha (ios_base& str);
169 ios_base& noboolalpha(ios_base& str);
170 ios_base& showbase (ios_base& str);
171 ios_base& noshowbase (ios_base& str);
172 ios_base& showpoint (ios_base& str);
173 ios_base& noshowpoint(ios_base& str);
174 ios_base& showpos (ios_base& str);
175 ios_base& noshowpos (ios_base& str);
176 ios_base& skipws (ios_base& str);
177 ios_base& noskipws (ios_base& str);
178 ios_base& uppercase (ios_base& str);
179 ios_base& nouppercase(ios_base& str);
180 ios_base& unitbuf (ios_base& str);
181 ios_base& nounitbuf (ios_base& str);
182
183 // 27.5.5.2 adjustfield:
184 ios_base& internal (ios_base& str);
185 ios_base& left (ios_base& str);
186 ios_base& right (ios_base& str);
187
188 // 27.5.5.3 basefield:
189 ios_base& dec (ios_base& str);
190 ios_base& hex (ios_base& str);
191 ios_base& oct (ios_base& str);
192
193 // 27.5.5.4 floatfield:
194 ios_base& fixed (ios_base& str);
195 ios_base& scientific (ios_base& str);
196 ios_base& hexfloat (ios_base& str);
197 ios_base& defaultfloat(ios_base& str);
198
199 // 27.5.5.5 error reporting:
200 enum class io_errc
201 {
202     stream = 1
203 };
204
205 concept_map ErrorCodeEnum<io_errc> { };
206 error_code make_error_code(io_errc e);
207 error_condition make_error_condition(io_errc e);
208 storage-class-specifier const error_category& iostream_category;
209
210 }  // std
211
212 */
213
214 #include <__config>
215 #include <iosfwd>
216 #include <__locale>
217 #include <system_error>
218
219 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
220 #pragma GCC system_header
221 #endif
222
223 _LIBCPP_BEGIN_NAMESPACE_STD
224
225 typedef ptrdiff_t streamsize;
226
227 class _LIBCPP_VISIBLE ios_base
228 {
229 public:
230     class failure;
231
232     typedef unsigned int fmtflags;
233     static const fmtflags boolalpha   = 0x0001;
234     static const fmtflags dec         = 0x0002;
235     static const fmtflags fixed       = 0x0004;
236     static const fmtflags hex         = 0x0008;
237     static const fmtflags internal    = 0x0010;
238     static const fmtflags left        = 0x0020;
239     static const fmtflags oct         = 0x0040;
240     static const fmtflags right       = 0x0080;
241     static const fmtflags scientific  = 0x0100;
242     static const fmtflags showbase    = 0x0200;
243     static const fmtflags showpoint   = 0x0400;
244     static const fmtflags showpos     = 0x0800;
245     static const fmtflags skipws      = 0x1000;
246     static const fmtflags unitbuf     = 0x2000;
247     static const fmtflags uppercase   = 0x4000;
248     static const fmtflags adjustfield = left | right | internal;
249     static const fmtflags basefield   = dec | oct | hex;
250     static const fmtflags floatfield  = scientific | fixed;
251
252     typedef unsigned int iostate;
253     typedef iostate      io_state;
254     static const iostate badbit  = 0x1;
255     static const iostate eofbit  = 0x2;
256     static const iostate failbit = 0x4;
257     static const iostate goodbit = 0x0;
258
259     typedef unsigned int openmode;
260     typedef openmode     open_mode;
261     static const openmode app    = 0x01;
262     static const openmode ate    = 0x02;
263     static const openmode binary = 0x04;
264     static const openmode in     = 0x08;
265     static const openmode out    = 0x10;
266     static const openmode trunc  = 0x20;
267
268     enum seekdir {beg, cur, end};
269     typedef seekdir seek_dir;
270
271     typedef _VSTD::streamoff streamoff;
272     typedef _VSTD::streampos streampos;
273
274     class Init;
275
276     // 27.5.2.2 fmtflags state:
277     _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
278     _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
279     _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
280     _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
281     _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
282
283     _LIBCPP_INLINE_VISIBILITY streamsize precision() const;
284     _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
285     _LIBCPP_INLINE_VISIBILITY streamsize width() const;
286     _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
287
288     // 27.5.2.3 locales:
289     locale imbue(const locale& __loc);
290     locale getloc() const;
291
292     // 27.5.2.5 storage:
293     static int xalloc();
294     long& iword(int __index);
295     void*& pword(int __index);
296
297     // destructor
298     virtual ~ios_base();
299
300     // 27.5.2.6 callbacks;
301     enum event { erase_event, imbue_event, copyfmt_event };
302     typedef void (*event_callback)(event, ios_base&, int __index);
303     void register_callback(event_callback __fn, int __index);
304
305 private:
306     ios_base(const ios_base&); // = delete;
307     ios_base& operator=(const ios_base&); // = delete;
308
309 public:
310     static bool sync_with_stdio(bool __sync = true);
311
312     _LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
313     void clear(iostate __state = goodbit);
314     _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
315
316     _LIBCPP_INLINE_VISIBILITY bool good() const;
317     _LIBCPP_INLINE_VISIBILITY bool eof() const;
318     _LIBCPP_INLINE_VISIBILITY bool fail() const;
319     _LIBCPP_INLINE_VISIBILITY bool bad() const;
320
321     _LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
322     _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
323
324     void __set_badbit_and_consider_rethrow();
325     void __set_failbit_and_consider_rethrow();
326
327 protected:
328     _LIBCPP_INLINE_VISIBILITY
329     ios_base() {// purposefully does no initialization
330                }
331
332     void init(void* __sb);
333     _LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
334
335     _LIBCPP_ALWAYS_INLINE
336     void rdbuf(void* __sb)
337     {
338         __rdbuf_ = __sb;
339         clear();
340     }
341
342     void __call_callbacks(event);
343     void copyfmt(const ios_base&);
344     void move(ios_base&);
345     void swap(ios_base&);
346
347     _LIBCPP_ALWAYS_INLINE
348     void set_rdbuf(void* __sb)
349     {
350         __rdbuf_ = __sb;
351     }
352
353 private:
354     // All data members must be scalars
355     fmtflags        __fmtflags_;
356     streamsize      __precision_;
357     streamsize      __width_;
358     iostate         __rdstate_;
359     iostate         __exceptions_;
360     void*           __rdbuf_;
361     void*           __loc_;
362     event_callback* __fn_;
363     int*            __index_;
364     size_t          __event_size_;
365     size_t          __event_cap_;
366     static int      __xindex_;
367     long*           __iarray_;
368     size_t          __iarray_size_;
369     size_t          __iarray_cap_;
370     void**          __parray_;
371     size_t          __parray_size_;
372     size_t          __parray_cap_;
373 };
374
375 //enum class io_errc
376 _LIBCPP_DECLARE_STRONG_ENUM(io_errc)
377 {
378     stream = 1
379 };
380 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
381
382 template <>
383 struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
384
385 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
386 template <>
387 struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
388 #endif
389
390 _LIBCPP_VISIBLE
391 const error_category& iostream_category();
392
393 inline _LIBCPP_INLINE_VISIBILITY
394 error_code
395 make_error_code(io_errc __e)
396 {
397     return error_code(static_cast<int>(__e), iostream_category());
398 }
399
400 inline _LIBCPP_INLINE_VISIBILITY
401 error_condition
402 make_error_condition(io_errc __e)
403 {
404     return error_condition(static_cast<int>(__e), iostream_category());
405 }
406
407 class _LIBCPP_EXCEPTION_ABI ios_base::failure
408     : public system_error
409 {
410 public:
411     explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
412     explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
413     virtual ~failure() throw();
414 };
415
416 class _LIBCPP_VISIBLE ios_base::Init
417 {
418 public:
419     Init();
420     ~Init();
421 };
422
423 // fmtflags
424
425 inline _LIBCPP_INLINE_VISIBILITY
426 ios_base::fmtflags
427 ios_base::flags() const
428 {
429     return __fmtflags_;
430 }
431
432 inline _LIBCPP_INLINE_VISIBILITY
433 ios_base::fmtflags
434 ios_base::flags(fmtflags __fmtfl)
435 {
436     fmtflags __r = __fmtflags_;
437     __fmtflags_ = __fmtfl;
438     return __r;
439 }
440
441 inline _LIBCPP_INLINE_VISIBILITY
442 ios_base::fmtflags
443 ios_base::setf(fmtflags __fmtfl)
444 {
445     fmtflags __r = __fmtflags_;
446     __fmtflags_ |= __fmtfl;
447     return __r;
448 }
449
450 inline _LIBCPP_INLINE_VISIBILITY
451 void
452 ios_base::unsetf(fmtflags __mask)
453 {
454     __fmtflags_ &= ~__mask;
455 }
456
457 inline _LIBCPP_INLINE_VISIBILITY
458 ios_base::fmtflags
459 ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
460 {
461     fmtflags __r = __fmtflags_;
462     unsetf(__mask);
463     __fmtflags_ |= __fmtfl & __mask;
464     return __r;
465 }
466
467 // precision
468
469 inline _LIBCPP_INLINE_VISIBILITY
470 streamsize
471 ios_base::precision() const
472 {
473     return __precision_;
474 }
475
476 inline _LIBCPP_INLINE_VISIBILITY
477 streamsize
478 ios_base::precision(streamsize __prec)
479 {
480     streamsize __r = __precision_;
481     __precision_ = __prec;
482     return __r;
483 }
484
485 // width
486
487 inline _LIBCPP_INLINE_VISIBILITY
488 streamsize
489 ios_base::width() const
490 {
491     return __width_;
492 }
493
494 inline _LIBCPP_INLINE_VISIBILITY
495 streamsize
496 ios_base::width(streamsize __wide)
497 {
498     streamsize __r = __width_;
499     __width_ = __wide;
500     return __r;
501 }
502
503 // iostate
504
505 inline _LIBCPP_INLINE_VISIBILITY
506 ios_base::iostate
507 ios_base::rdstate() const
508 {
509     return __rdstate_;
510 }
511
512 inline _LIBCPP_INLINE_VISIBILITY
513 void
514 ios_base::setstate(iostate __state)
515 {
516     clear(__rdstate_ | __state);
517 }
518
519 inline _LIBCPP_INLINE_VISIBILITY
520 bool
521 ios_base::good() const
522 {
523     return __rdstate_ == 0;
524 }
525
526 inline _LIBCPP_INLINE_VISIBILITY
527 bool
528 ios_base::eof() const
529 {
530     return __rdstate_ & eofbit;
531 }
532
533 inline _LIBCPP_INLINE_VISIBILITY
534 bool
535 ios_base::fail() const
536 {
537     return __rdstate_ & (failbit | badbit);
538 }
539
540 inline _LIBCPP_INLINE_VISIBILITY
541 bool
542 ios_base::bad() const
543 {
544     return __rdstate_ & badbit;
545 }
546
547 inline _LIBCPP_INLINE_VISIBILITY
548 ios_base::iostate
549 ios_base::exceptions() const
550 {
551     return __exceptions_;
552 }
553
554 inline _LIBCPP_INLINE_VISIBILITY
555 void
556 ios_base::exceptions(iostate __except)
557 {
558     __exceptions_ = __except;
559     clear(__rdstate_);
560 }
561
562 template <class _CharT, class _Traits>
563 class _LIBCPP_VISIBLE basic_ios
564     : public ios_base
565 {
566 public:
567     // types:
568     typedef _CharT char_type;
569     typedef _Traits traits_type;
570
571     typedef typename traits_type::int_type int_type;
572     typedef typename traits_type::pos_type pos_type;
573     typedef typename traits_type::off_type off_type;
574
575     _LIBCPP_ALWAYS_INLINE
576         _LIBCPP_EXPLICIT
577         operator bool() const {return !fail();}
578     _LIBCPP_ALWAYS_INLINE bool operator!() const    {return  fail();}
579     _LIBCPP_ALWAYS_INLINE iostate rdstate() const   {return ios_base::rdstate();}
580     _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
581     _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
582     _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
583     _LIBCPP_ALWAYS_INLINE bool eof() const  {return ios_base::eof();}
584     _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
585     _LIBCPP_ALWAYS_INLINE bool bad() const  {return ios_base::bad();}
586
587     _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
588     _LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
589
590     // 27.5.4.1 Constructor/destructor:
591     _LIBCPP_INLINE_VISIBILITY
592     explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
593     virtual ~basic_ios();
594
595     // 27.5.4.2 Members:
596     _LIBCPP_INLINE_VISIBILITY 
597     basic_ostream<char_type, traits_type>* tie() const;
598     _LIBCPP_INLINE_VISIBILITY 
599     basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
600
601     _LIBCPP_INLINE_VISIBILITY 
602     basic_streambuf<char_type, traits_type>* rdbuf() const;
603     _LIBCPP_INLINE_VISIBILITY 
604     basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
605
606     basic_ios& copyfmt(const basic_ios& __rhs);
607
608     _LIBCPP_INLINE_VISIBILITY 
609     char_type fill() const;
610     _LIBCPP_INLINE_VISIBILITY 
611     char_type fill(char_type __ch);
612
613     _LIBCPP_INLINE_VISIBILITY 
614     locale imbue(const locale& __loc);
615
616     _LIBCPP_INLINE_VISIBILITY 
617     char narrow(char_type __c, char __dfault) const;
618     _LIBCPP_INLINE_VISIBILITY 
619     char_type widen(char __c) const;
620
621 protected:
622     _LIBCPP_ALWAYS_INLINE
623     basic_ios() {// purposefully does no initialization
624                 }
625     _LIBCPP_INLINE_VISIBILITY 
626     void init(basic_streambuf<char_type, traits_type>* __sb);
627
628     _LIBCPP_INLINE_VISIBILITY 
629     void move(basic_ios& __rhs);
630 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
631     _LIBCPP_ALWAYS_INLINE
632     void move(basic_ios&& __rhs) {move(__rhs);}
633 #endif
634     _LIBCPP_INLINE_VISIBILITY 
635     void swap(basic_ios& __rhs);
636     _LIBCPP_INLINE_VISIBILITY 
637     void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
638 private:
639     basic_ostream<char_type, traits_type>* __tie_;
640     char_type __fill_;
641 };
642
643 template <class _CharT, class _Traits>
644 inline _LIBCPP_INLINE_VISIBILITY
645 basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
646 {
647     init(__sb);
648 }
649
650 template <class _CharT, class _Traits>
651 basic_ios<_CharT, _Traits>::~basic_ios()
652 {
653 }
654
655 template <class _CharT, class _Traits>
656 inline _LIBCPP_INLINE_VISIBILITY
657 void
658 basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
659 {
660     ios_base::init(__sb);
661     __tie_ = 0;
662     __fill_ = widen(' ');
663 }
664
665 template <class _CharT, class _Traits>
666 inline _LIBCPP_INLINE_VISIBILITY
667 basic_ostream<_CharT, _Traits>*
668 basic_ios<_CharT, _Traits>::tie() const
669 {
670     return __tie_;
671 }
672
673 template <class _CharT, class _Traits>
674 inline _LIBCPP_INLINE_VISIBILITY
675 basic_ostream<_CharT, _Traits>*
676 basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
677 {
678     basic_ostream<char_type, traits_type>* __r = __tie_;
679     __tie_ = __tiestr;
680     return __r;
681 }
682
683 template <class _CharT, class _Traits>
684 inline _LIBCPP_INLINE_VISIBILITY
685 basic_streambuf<_CharT, _Traits>*
686 basic_ios<_CharT, _Traits>::rdbuf() const
687 {
688     return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
689 }
690
691 template <class _CharT, class _Traits>
692 inline _LIBCPP_INLINE_VISIBILITY
693 basic_streambuf<_CharT, _Traits>*
694 basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
695 {
696     basic_streambuf<char_type, traits_type>* __r = rdbuf();
697     ios_base::rdbuf(__sb);
698     return __r;
699 }
700
701 template <class _CharT, class _Traits>
702 inline _LIBCPP_INLINE_VISIBILITY
703 locale
704 basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
705 {
706     locale __r = getloc();
707     ios_base::imbue(__loc);
708     if (rdbuf())
709         rdbuf()->pubimbue(__loc);
710     return __r;
711 }
712
713 template <class _CharT, class _Traits>
714 inline _LIBCPP_INLINE_VISIBILITY
715 char
716 basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
717 {
718     return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
719 }
720
721 template <class _CharT, class _Traits>
722 inline _LIBCPP_INLINE_VISIBILITY
723 _CharT
724 basic_ios<_CharT, _Traits>::widen(char __c) const
725 {
726     return use_facet<ctype<char_type> >(getloc()).widen(__c);
727 }
728
729 template <class _CharT, class _Traits>
730 inline _LIBCPP_INLINE_VISIBILITY
731 _CharT
732 basic_ios<_CharT, _Traits>::fill() const
733 {
734     return __fill_;
735 }
736
737 template <class _CharT, class _Traits>
738 inline _LIBCPP_INLINE_VISIBILITY
739 _CharT
740 basic_ios<_CharT, _Traits>::fill(char_type __ch)
741 {
742     char_type __r = __fill_;
743     __fill_ = __ch;
744     return __r;
745 }
746
747 template <class _CharT, class _Traits>
748 basic_ios<_CharT, _Traits>&
749 basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
750 {
751     if (this != &__rhs)
752     {
753         __call_callbacks(erase_event);
754         ios_base::copyfmt(__rhs);
755         __tie_ = __rhs.__tie_;
756         __fill_ = __rhs.__fill_;
757         __call_callbacks(copyfmt_event);
758         exceptions(__rhs.exceptions());
759     }
760     return *this;
761 }
762
763 template <class _CharT, class _Traits>
764 inline _LIBCPP_INLINE_VISIBILITY
765 void
766 basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
767 {
768     ios_base::move(__rhs);
769     __tie_ = __rhs.__tie_;
770     __rhs.__tie_ = 0;
771     __fill_ = __rhs.__fill_;
772 }
773
774 template <class _CharT, class _Traits>
775 inline _LIBCPP_INLINE_VISIBILITY
776 void
777 basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
778 {
779     ios_base::swap(__rhs);
780     _VSTD::swap(__tie_, __rhs.__tie_);
781     _VSTD::swap(__fill_, __rhs.__fill_);
782 }
783
784 template <class _CharT, class _Traits>
785 inline _LIBCPP_INLINE_VISIBILITY
786 void
787 basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
788 {
789     ios_base::set_rdbuf(__sb);
790 }
791
792 inline _LIBCPP_INLINE_VISIBILITY
793 ios_base&
794 boolalpha(ios_base& __str)
795 {
796     __str.setf(ios_base::boolalpha);
797     return __str;
798 }
799
800 inline _LIBCPP_INLINE_VISIBILITY
801 ios_base&
802 noboolalpha(ios_base& __str)
803 {
804     __str.unsetf(ios_base::boolalpha);
805     return __str;
806 }
807
808 inline _LIBCPP_INLINE_VISIBILITY
809 ios_base&
810 showbase(ios_base& __str)
811 {
812     __str.setf(ios_base::showbase);
813     return __str;
814 }
815
816 inline _LIBCPP_INLINE_VISIBILITY
817 ios_base&
818 noshowbase(ios_base& __str)
819 {
820     __str.unsetf(ios_base::showbase);
821     return __str;
822 }
823
824 inline _LIBCPP_INLINE_VISIBILITY
825 ios_base&
826 showpoint(ios_base& __str)
827 {
828     __str.setf(ios_base::showpoint);
829     return __str;
830 }
831
832 inline _LIBCPP_INLINE_VISIBILITY
833 ios_base&
834 noshowpoint(ios_base& __str)
835 {
836     __str.unsetf(ios_base::showpoint);
837     return __str;
838 }
839
840 inline _LIBCPP_INLINE_VISIBILITY
841 ios_base&
842 showpos(ios_base& __str)
843 {
844     __str.setf(ios_base::showpos);
845     return __str;
846 }
847
848 inline _LIBCPP_INLINE_VISIBILITY
849 ios_base&
850 noshowpos(ios_base& __str)
851 {
852     __str.unsetf(ios_base::showpos);
853     return __str;
854 }
855
856 inline _LIBCPP_INLINE_VISIBILITY
857 ios_base&
858 skipws(ios_base& __str)
859 {
860     __str.setf(ios_base::skipws);
861     return __str;
862 }
863
864 inline _LIBCPP_INLINE_VISIBILITY
865 ios_base&
866 noskipws(ios_base& __str)
867 {
868     __str.unsetf(ios_base::skipws);
869     return __str;
870 }
871
872 inline _LIBCPP_INLINE_VISIBILITY
873 ios_base&
874 uppercase(ios_base& __str)
875 {
876     __str.setf(ios_base::uppercase);
877     return __str;
878 }
879
880 inline _LIBCPP_INLINE_VISIBILITY
881 ios_base&
882 nouppercase(ios_base& __str)
883 {
884     __str.unsetf(ios_base::uppercase);
885     return __str;
886 }
887
888 inline _LIBCPP_INLINE_VISIBILITY
889 ios_base&
890 unitbuf(ios_base& __str)
891 {
892     __str.setf(ios_base::unitbuf);
893     return __str;
894 }
895
896 inline _LIBCPP_INLINE_VISIBILITY
897 ios_base&
898 nounitbuf(ios_base& __str)
899 {
900     __str.unsetf(ios_base::unitbuf);
901     return __str;
902 }
903
904 inline _LIBCPP_INLINE_VISIBILITY
905 ios_base&
906 internal(ios_base& __str)
907 {
908     __str.setf(ios_base::internal, ios_base::adjustfield);
909     return __str;
910 }
911
912 inline _LIBCPP_INLINE_VISIBILITY
913 ios_base&
914 left(ios_base& __str)
915 {
916     __str.setf(ios_base::left, ios_base::adjustfield);
917     return __str;
918 }
919
920 inline _LIBCPP_INLINE_VISIBILITY
921 ios_base&
922 right(ios_base& __str)
923 {
924     __str.setf(ios_base::right, ios_base::adjustfield);
925     return __str;
926 }
927
928 inline _LIBCPP_INLINE_VISIBILITY
929 ios_base&
930 dec(ios_base& __str)
931 {
932     __str.setf(ios_base::dec, ios_base::basefield);
933     return __str;
934 }
935
936 inline _LIBCPP_INLINE_VISIBILITY
937 ios_base&
938 hex(ios_base& __str)
939 {
940     __str.setf(ios_base::hex, ios_base::basefield);
941     return __str;
942 }
943
944 inline _LIBCPP_INLINE_VISIBILITY
945 ios_base&
946 oct(ios_base& __str)
947 {
948     __str.setf(ios_base::oct, ios_base::basefield);
949     return __str;
950 }
951
952 inline _LIBCPP_INLINE_VISIBILITY
953 ios_base&
954 fixed(ios_base& __str)
955 {
956     __str.setf(ios_base::fixed, ios_base::floatfield);
957     return __str;
958 }
959
960 inline _LIBCPP_INLINE_VISIBILITY
961 ios_base&
962 scientific(ios_base& __str)
963 {
964     __str.setf(ios_base::scientific, ios_base::floatfield);
965     return __str;
966 }
967
968 inline _LIBCPP_INLINE_VISIBILITY
969 ios_base&
970 hexfloat(ios_base& __str)
971 {
972     __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
973     return __str;
974 }
975
976 inline _LIBCPP_INLINE_VISIBILITY
977 ios_base&
978 defaultfloat(ios_base& __str)
979 {
980     __str.unsetf(ios_base::floatfield);
981     return __str;
982 }
983
984 _LIBCPP_END_NAMESPACE_STD
985
986 #endif  // _LIBCPP_IOS