blob: 76439ac2cfe05ba75029948f352670763260fa88 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001// -*- C++ -*-
2//===---------------------------- ios -------------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:01 +00004// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00005//
6// This file is distributed under the University of Illinois Open Source
7// License. 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
19namespace std
20{
21
22typedef OFF_T streamoff;
23typedef SZ_T streamsize;
24template <class stateT> class fpos;
25
26class ios_base
27{
28public:
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
106protected:
107 ios_base();
108};
109
110template <class charT, class traits = char_traits<charT> >
111class basic_ios
112 : public ios_base
113{
114public:
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
159protected:
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:
168ios_base& boolalpha (ios_base& str);
169ios_base& noboolalpha(ios_base& str);
170ios_base& showbase (ios_base& str);
171ios_base& noshowbase (ios_base& str);
172ios_base& showpoint (ios_base& str);
173ios_base& noshowpoint(ios_base& str);
174ios_base& showpos (ios_base& str);
175ios_base& noshowpos (ios_base& str);
176ios_base& skipws (ios_base& str);
177ios_base& noskipws (ios_base& str);
178ios_base& uppercase (ios_base& str);
179ios_base& nouppercase(ios_base& str);
180ios_base& unitbuf (ios_base& str);
181ios_base& nounitbuf (ios_base& str);
182
183// 27.5.5.2 adjustfield:
184ios_base& internal (ios_base& str);
185ios_base& left (ios_base& str);
186ios_base& right (ios_base& str);
187
188// 27.5.5.3 basefield:
189ios_base& dec (ios_base& str);
190ios_base& hex (ios_base& str);
191ios_base& oct (ios_base& str);
192
193// 27.5.5.4 floatfield:
194ios_base& fixed (ios_base& str);
195ios_base& scientific (ios_base& str);
196ios_base& hexfloat (ios_base& str);
197ios_base& defaultfloat(ios_base& str);
198
199// 27.5.5.5 error reporting:
200enum class io_errc
201{
202 stream = 1
203};
204
205concept_map ErrorCodeEnum<io_errc> { };
206error_code make_error_code(io_errc e);
207error_condition make_error_condition(io_errc e);
208storage-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#pragma GCC system_header
220
221_LIBCPP_BEGIN_NAMESPACE_STD
222
223typedef ptrdiff_t streamsize;
224
Howard Hinnant68a8e902010-09-22 15:29:08 +0000225class _LIBCPP_VISIBLE ios_base
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000226{
227public:
228 class failure;
229
230 typedef unsigned int fmtflags;
231 static const fmtflags boolalpha = 0x0001;
232 static const fmtflags dec = 0x0002;
233 static const fmtflags fixed = 0x0004;
234 static const fmtflags hex = 0x0008;
235 static const fmtflags internal = 0x0010;
236 static const fmtflags left = 0x0020;
237 static const fmtflags oct = 0x0040;
238 static const fmtflags right = 0x0080;
239 static const fmtflags scientific = 0x0100;
240 static const fmtflags showbase = 0x0200;
241 static const fmtflags showpoint = 0x0400;
242 static const fmtflags showpos = 0x0800;
243 static const fmtflags skipws = 0x1000;
244 static const fmtflags unitbuf = 0x2000;
245 static const fmtflags uppercase = 0x4000;
246 static const fmtflags adjustfield = left | right | internal;
247 static const fmtflags basefield = dec | oct | hex;
248 static const fmtflags floatfield = scientific | fixed;
249
250 typedef unsigned int iostate;
251 typedef iostate io_state;
252 static const iostate badbit = 0x1;
253 static const iostate eofbit = 0x2;
254 static const iostate failbit = 0x4;
255 static const iostate goodbit = 0x0;
256
257 typedef unsigned int openmode;
258 typedef openmode open_mode;
259 static const openmode app = 0x01;
260 static const openmode ate = 0x02;
261 static const openmode binary = 0x04;
262 static const openmode in = 0x08;
263 static const openmode out = 0x10;
264 static const openmode trunc = 0x20;
265
266 enum seekdir {beg, cur, end};
267 typedef seekdir seek_dir;
268
269 typedef _STD::streamoff streamoff;
270 typedef _STD::streampos streampos;
271
272 class Init;
273
274 // 27.5.2.2 fmtflags state:
275 fmtflags flags() const;
276 fmtflags flags(fmtflags __fmtfl);
277 fmtflags setf(fmtflags __fmtfl);
278 fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
279 void unsetf(fmtflags __mask);
280
281 streamsize precision() const;
282 streamsize precision(streamsize __prec);
283 streamsize width() const;
284 streamsize width(streamsize __wide);
285
286 // 27.5.2.3 locales:
287 locale imbue(const locale& __loc);
288 locale getloc() const;
289
290 // 27.5.2.5 storage:
291 static int xalloc();
292 long& iword(int __index);
293 void*& pword(int __index);
294
295 // destructor
296 virtual ~ios_base();
297
298 // 27.5.2.6 callbacks;
299 enum event { erase_event, imbue_event, copyfmt_event };
300 typedef void (*event_callback)(event, ios_base&, int __index);
301 void register_callback(event_callback __fn, int __index);
302
303private:
304 ios_base(const ios_base&); // = delete;
305 ios_base& operator=(const ios_base&); // = delete;
306
307public:
308 static bool sync_with_stdio(bool __sync = true);
309
310 iostate rdstate() const;
311 void clear(iostate __state = goodbit);
312 void setstate(iostate __state);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000313
Howard Hinnant324bb032010-08-22 00:02:43 +0000314 bool good() const;
315 bool eof() const;
316 bool fail() const;
317 bool bad() const;
318
319 iostate exceptions() const;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000320 void exceptions(iostate __except);
321
322 void __set_badbit_and_consider_rethrow();
323 void __set_failbit_and_consider_rethrow();
324
325protected:
Howard Hinnant68a8e902010-09-22 15:29:08 +0000326 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000327 ios_base() {// purposefully does no initialization
328 }
329
330 void init(void* __sb);
331 _LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
332
333 _LIBCPP_ALWAYS_INLINE
334 void rdbuf(void* __sb)
335 {
336 __rdbuf_ = __sb;
337 clear();
338 }
339
340 void __call_callbacks(event);
341 void copyfmt(const ios_base&);
342 void move(ios_base&);
343 void swap(ios_base&);
344
345 _LIBCPP_ALWAYS_INLINE
346 void set_rdbuf(void* __sb)
347 {
348 __rdbuf_ = __sb;
349 }
350
351private:
352 // All data members must be scalars
353 fmtflags __fmtflags_;
354 streamsize __precision_;
355 streamsize __width_;
356 iostate __rdstate_;
357 iostate __exceptions_;
358 void* __rdbuf_;
359 void* __loc_;
360 event_callback* __fn_;
361 int* __index_;
362 size_t __event_size_;
363 size_t __event_cap_;
364 static int __xindex_;
365 long* __iarray_;
366 size_t __iarray_size_;
367 size_t __iarray_cap_;
368 void** __parray_;
369 size_t __parray_size_;
370 size_t __parray_cap_;
371};
372
373//enum class io_errc
Howard Hinnant68a8e902010-09-22 15:29:08 +0000374struct _LIBCPP_VISIBLE io_errc
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000375{
376enum _ {
377 stream = 1
378};
379 _ __v_;
380
381 _LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
382 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
383};
384
Howard Hinnant68a8e902010-09-22 15:29:08 +0000385template <>
386struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
387template <>
388struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000389
Howard Hinnant68a8e902010-09-22 15:29:08 +0000390_LIBCPP_VISIBLE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000391const error_category& iostream_category();
392
393inline _LIBCPP_INLINE_VISIBILITY
394error_code
395make_error_code(io_errc __e)
396{
397 return error_code(static_cast<int>(__e), iostream_category());
398}
399
400inline _LIBCPP_INLINE_VISIBILITY
401error_condition
402make_error_condition(io_errc __e)
403{
404 return error_condition(static_cast<int>(__e), iostream_category());
405}
406
Howard Hinnant68a8e902010-09-22 15:29:08 +0000407class _LIBCPP_EXCEPTION_ABI ios_base::failure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000408 : public system_error
Howard Hinnant324bb032010-08-22 00:02:43 +0000409{
410public:
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000411 explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
Howard Hinnant324bb032010-08-22 00:02:43 +0000412 explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000413 virtual ~failure() throw();
414};
415
Howard Hinnant68a8e902010-09-22 15:29:08 +0000416class _LIBCPP_VISIBLE ios_base::Init
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000417{
418public:
419 Init();
420 ~Init();
421};
422
423// fmtflags
424
425inline _LIBCPP_INLINE_VISIBILITY
426ios_base::fmtflags
427ios_base::flags() const
428{
429 return __fmtflags_;
430}
431
432inline _LIBCPP_INLINE_VISIBILITY
433ios_base::fmtflags
434ios_base::flags(fmtflags __fmtfl)
435{
436 fmtflags __r = __fmtflags_;
437 __fmtflags_ = __fmtfl;
438 return __r;
439}
440
441inline _LIBCPP_INLINE_VISIBILITY
442ios_base::fmtflags
443ios_base::setf(fmtflags __fmtfl)
444{
445 fmtflags __r = __fmtflags_;
446 __fmtflags_ |= __fmtfl;
447 return __r;
448}
449
450inline _LIBCPP_INLINE_VISIBILITY
451void
452ios_base::unsetf(fmtflags __mask)
453{
454 __fmtflags_ &= ~__mask;
455}
456
457inline _LIBCPP_INLINE_VISIBILITY
458ios_base::fmtflags
459ios_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
469inline _LIBCPP_INLINE_VISIBILITY
470streamsize
471ios_base::precision() const
472{
473 return __precision_;
474}
475
476inline _LIBCPP_INLINE_VISIBILITY
477streamsize
478ios_base::precision(streamsize __prec)
479{
480 streamsize __r = __precision_;
481 __precision_ = __prec;
482 return __r;
483}
484
485// width
486
487inline _LIBCPP_INLINE_VISIBILITY
488streamsize
489ios_base::width() const
490{
491 return __width_;
492}
493
494inline _LIBCPP_INLINE_VISIBILITY
495streamsize
496ios_base::width(streamsize __wide)
497{
498 streamsize __r = __width_;
499 __width_ = __wide;
500 return __r;
501}
502
503// iostate
504
505inline _LIBCPP_INLINE_VISIBILITY
506ios_base::iostate
507ios_base::rdstate() const
508{
509 return __rdstate_;
510}
511
512inline _LIBCPP_INLINE_VISIBILITY
513void
514ios_base::setstate(iostate __state)
515{
516 clear(__rdstate_ | __state);
517}
518
519inline _LIBCPP_INLINE_VISIBILITY
520bool
521ios_base::good() const
522{
523 return __rdstate_ == 0;
524}
525
526inline _LIBCPP_INLINE_VISIBILITY
527bool
528ios_base::eof() const
529{
530 return __rdstate_ & eofbit;
531}
532
533inline _LIBCPP_INLINE_VISIBILITY
534bool
535ios_base::fail() const
536{
537 return __rdstate_ & (failbit | badbit);
538}
539
540inline _LIBCPP_INLINE_VISIBILITY
541bool
542ios_base::bad() const
543{
544 return __rdstate_ & badbit;
545}
546
547inline _LIBCPP_INLINE_VISIBILITY
548ios_base::iostate
549ios_base::exceptions() const
550{
551 return __exceptions_;
552}
553
554inline _LIBCPP_INLINE_VISIBILITY
555void
556ios_base::exceptions(iostate __except)
557{
558 __exceptions_ = __except;
559 clear(__rdstate_);
560}
561
562template <class _CharT, class _Traits>
Howard Hinnant68a8e902010-09-22 15:29:08 +0000563class _LIBCPP_VISIBLE basic_ios
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000564 : public ios_base
565{
566public:
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 // explicit
576 operator bool() const {return !fail();}
577 _LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
578 _LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
579 _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
580 _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
581 _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
582 _LIBCPP_ALWAYS_INLINE bool eof() const {return ios_base::eof();}
583 _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
584 _LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
585
586 _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
587 _LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
588
589 // 27.5.4.1 Constructor/destructor:
590 explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
591 virtual ~basic_ios();
592
593 // 27.5.4.2 Members:
594 basic_ostream<char_type, traits_type>* tie() const;
595 basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
596
597 basic_streambuf<char_type, traits_type>* rdbuf() const;
598 basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
599
600 basic_ios& copyfmt(const basic_ios& __rhs);
601
602 char_type fill() const;
603 char_type fill(char_type __ch);
604
605 locale imbue(const locale& __loc);
606
607 char narrow(char_type __c, char __dfault) const;
608 char_type widen(char __c) const;
609
610protected:
Howard Hinnant68a8e902010-09-22 15:29:08 +0000611 _LIBCPP_ALWAYS_INLINE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000612 basic_ios() {// purposefully does no initialization
613 }
614 void init(basic_streambuf<char_type, traits_type>* __sb);
615
616 void move(basic_ios& __rhs);
Howard Hinnant73d21a42010-09-04 23:28:19 +0000617#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant68a8e902010-09-22 15:29:08 +0000618 _LIBCPP_ALWAYS_INLINE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000619 void move(basic_ios&& __rhs) {move(__rhs);}
620#endif
621 void swap(basic_ios& __rhs);
622 void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
623private:
624 basic_ostream<char_type, traits_type>* __tie_;
625 char_type __fill_;
626};
627
628template <class _CharT, class _Traits>
629inline _LIBCPP_INLINE_VISIBILITY
630basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
631{
632 init(__sb);
633}
634
635template <class _CharT, class _Traits>
636basic_ios<_CharT, _Traits>::~basic_ios()
637{
638}
639
640template <class _CharT, class _Traits>
641inline _LIBCPP_INLINE_VISIBILITY
642void
643basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
644{
645 ios_base::init(__sb);
646 __tie_ = 0;
647 __fill_ = widen(' ');
648}
649
650template <class _CharT, class _Traits>
651inline _LIBCPP_INLINE_VISIBILITY
652basic_ostream<_CharT, _Traits>*
653basic_ios<_CharT, _Traits>::tie() const
654{
655 return __tie_;
656}
657
658template <class _CharT, class _Traits>
659inline _LIBCPP_INLINE_VISIBILITY
660basic_ostream<_CharT, _Traits>*
661basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
662{
663 basic_ostream<char_type, traits_type>* __r = __tie_;
664 __tie_ = __tiestr;
665 return __r;
666}
667
668template <class _CharT, class _Traits>
669inline _LIBCPP_INLINE_VISIBILITY
670basic_streambuf<_CharT, _Traits>*
671basic_ios<_CharT, _Traits>::rdbuf() const
672{
673 return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
674}
675
676template <class _CharT, class _Traits>
677inline _LIBCPP_INLINE_VISIBILITY
678basic_streambuf<_CharT, _Traits>*
679basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
680{
681 basic_streambuf<char_type, traits_type>* __r = rdbuf();
682 ios_base::rdbuf(__sb);
683 return __r;
684}
685
686template <class _CharT, class _Traits>
687inline _LIBCPP_INLINE_VISIBILITY
688locale
689basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
690{
691 locale __r = getloc();
692 ios_base::imbue(__loc);
693 if (rdbuf())
694 rdbuf()->pubimbue(__loc);
695 return __r;
696}
697
698template <class _CharT, class _Traits>
699inline _LIBCPP_INLINE_VISIBILITY
700char
701basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
702{
703 return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
704}
705
706template <class _CharT, class _Traits>
707inline _LIBCPP_INLINE_VISIBILITY
708_CharT
709basic_ios<_CharT, _Traits>::widen(char __c) const
710{
711 return use_facet<ctype<char_type> >(getloc()).widen(__c);
712}
713
714template <class _CharT, class _Traits>
715inline _LIBCPP_INLINE_VISIBILITY
716_CharT
717basic_ios<_CharT, _Traits>::fill() const
718{
719 return __fill_;
720}
721
722template <class _CharT, class _Traits>
723inline _LIBCPP_INLINE_VISIBILITY
724_CharT
725basic_ios<_CharT, _Traits>::fill(char_type __ch)
726{
727 char_type __r = __fill_;
728 __fill_ = __ch;
729 return __r;
730}
731
732template <class _CharT, class _Traits>
733basic_ios<_CharT, _Traits>&
734basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
735{
736 if (this != &__rhs)
737 {
738 __call_callbacks(erase_event);
739 ios_base::copyfmt(__rhs);
740 __tie_ = __rhs.__tie_;
741 __fill_ = __rhs.__fill_;
742 __call_callbacks(copyfmt_event);
743 exceptions(__rhs.exceptions());
744 }
745 return *this;
746}
747
748template <class _CharT, class _Traits>
749inline _LIBCPP_INLINE_VISIBILITY
750void
751basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
752{
753 ios_base::move(__rhs);
754 __tie_ = __rhs.__tie_;
755 __rhs.__tie_ = 0;
756 __fill_ = __rhs.__fill_;
757}
758
759template <class _CharT, class _Traits>
760inline _LIBCPP_INLINE_VISIBILITY
761void
762basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
763{
764 ios_base::swap(__rhs);
765 _STD::swap(__tie_, __rhs.__tie_);
766 _STD::swap(__fill_, __rhs.__fill_);
767}
768
769template <class _CharT, class _Traits>
770inline _LIBCPP_INLINE_VISIBILITY
771void
772basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
773{
774 ios_base::set_rdbuf(__sb);
775}
776
777inline _LIBCPP_INLINE_VISIBILITY
778ios_base&
779boolalpha(ios_base& __str)
780{
781 __str.setf(ios_base::boolalpha);
782 return __str;
783}
784
785inline _LIBCPP_INLINE_VISIBILITY
786ios_base&
787noboolalpha(ios_base& __str)
788{
789 __str.unsetf(ios_base::boolalpha);
790 return __str;
791}
792
793inline _LIBCPP_INLINE_VISIBILITY
794ios_base&
795showbase(ios_base& __str)
796{
797 __str.setf(ios_base::showbase);
798 return __str;
799}
800
801inline _LIBCPP_INLINE_VISIBILITY
802ios_base&
803noshowbase(ios_base& __str)
804{
805 __str.unsetf(ios_base::showbase);
806 return __str;
807}
808
809inline _LIBCPP_INLINE_VISIBILITY
810ios_base&
811showpoint(ios_base& __str)
812{
813 __str.setf(ios_base::showpoint);
814 return __str;
815}
816
817inline _LIBCPP_INLINE_VISIBILITY
818ios_base&
819noshowpoint(ios_base& __str)
820{
821 __str.unsetf(ios_base::showpoint);
822 return __str;
823}
824
825inline _LIBCPP_INLINE_VISIBILITY
826ios_base&
827showpos(ios_base& __str)
828{
829 __str.setf(ios_base::showpos);
830 return __str;
831}
832
833inline _LIBCPP_INLINE_VISIBILITY
834ios_base&
835noshowpos(ios_base& __str)
836{
837 __str.unsetf(ios_base::showpos);
838 return __str;
839}
840
841inline _LIBCPP_INLINE_VISIBILITY
842ios_base&
843skipws(ios_base& __str)
844{
845 __str.setf(ios_base::skipws);
846 return __str;
847}
848
849inline _LIBCPP_INLINE_VISIBILITY
850ios_base&
851noskipws(ios_base& __str)
852{
853 __str.unsetf(ios_base::skipws);
854 return __str;
855}
856
857inline _LIBCPP_INLINE_VISIBILITY
858ios_base&
859uppercase(ios_base& __str)
860{
861 __str.setf(ios_base::uppercase);
862 return __str;
863}
864
865inline _LIBCPP_INLINE_VISIBILITY
866ios_base&
867nouppercase(ios_base& __str)
868{
869 __str.unsetf(ios_base::uppercase);
870 return __str;
871}
872
873inline _LIBCPP_INLINE_VISIBILITY
874ios_base&
875unitbuf(ios_base& __str)
876{
877 __str.setf(ios_base::unitbuf);
878 return __str;
879}
880
881inline _LIBCPP_INLINE_VISIBILITY
882ios_base&
883nounitbuf(ios_base& __str)
884{
885 __str.unsetf(ios_base::unitbuf);
886 return __str;
887}
888
889inline _LIBCPP_INLINE_VISIBILITY
890ios_base&
891internal(ios_base& __str)
892{
893 __str.setf(ios_base::internal, ios_base::adjustfield);
894 return __str;
895}
896
897inline _LIBCPP_INLINE_VISIBILITY
898ios_base&
899left(ios_base& __str)
900{
901 __str.setf(ios_base::left, ios_base::adjustfield);
902 return __str;
903}
904
905inline _LIBCPP_INLINE_VISIBILITY
906ios_base&
907right(ios_base& __str)
908{
909 __str.setf(ios_base::right, ios_base::adjustfield);
910 return __str;
911}
912
913inline _LIBCPP_INLINE_VISIBILITY
914ios_base&
915dec(ios_base& __str)
916{
917 __str.setf(ios_base::dec, ios_base::basefield);
918 return __str;
919}
920
921inline _LIBCPP_INLINE_VISIBILITY
922ios_base&
923hex(ios_base& __str)
924{
925 __str.setf(ios_base::hex, ios_base::basefield);
926 return __str;
927}
928
929inline _LIBCPP_INLINE_VISIBILITY
930ios_base&
931oct(ios_base& __str)
932{
933 __str.setf(ios_base::oct, ios_base::basefield);
934 return __str;
935}
936
937inline _LIBCPP_INLINE_VISIBILITY
938ios_base&
939fixed(ios_base& __str)
940{
941 __str.setf(ios_base::fixed, ios_base::floatfield);
942 return __str;
943}
944
945inline _LIBCPP_INLINE_VISIBILITY
946ios_base&
947scientific(ios_base& __str)
948{
949 __str.setf(ios_base::scientific, ios_base::floatfield);
950 return __str;
951}
952
953inline _LIBCPP_INLINE_VISIBILITY
954ios_base&
955hexfloat(ios_base& __str)
956{
957 __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
958 return __str;
959}
960
961inline _LIBCPP_INLINE_VISIBILITY
962ios_base&
963defaultfloat(ios_base& __str)
964{
965 __str.unsetf(ios_base::floatfield);
966 return __str;
967}
968
969_LIBCPP_END_NAMESPACE_STD
970
971#endif // _LIBCPP_IOS