1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | #ifndef _IOS_BASE_H |
35 | #define _IOS_BASE_H 1 |
36 | |
37 | #pragma GCC system_header |
38 | |
39 | #include <ext/atomicity.h> |
40 | #include <bits/localefwd.h> |
41 | #include <bits/locale_classes.h> |
42 | |
43 | #if __cplusplus < 201103L |
44 | # include <stdexcept> |
45 | #else |
46 | # include <system_error> |
47 | #endif |
48 | |
49 | namespace std _GLIBCXX_VISIBILITY(default) |
50 | { |
51 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | enum _Ios_Fmtflags |
58 | { |
59 | _S_boolalpha = 1L << 0, |
60 | _S_dec = 1L << 1, |
61 | _S_fixed = 1L << 2, |
62 | _S_hex = 1L << 3, |
63 | _S_internal = 1L << 4, |
64 | _S_left = 1L << 5, |
65 | _S_oct = 1L << 6, |
66 | _S_right = 1L << 7, |
67 | _S_scientific = 1L << 8, |
68 | _S_showbase = 1L << 9, |
69 | _S_showpoint = 1L << 10, |
70 | _S_showpos = 1L << 11, |
71 | _S_skipws = 1L << 12, |
72 | _S_unitbuf = 1L << 13, |
73 | _S_uppercase = 1L << 14, |
74 | _S_adjustfield = _S_left | _S_right | _S_internal, |
75 | _S_basefield = _S_dec | _S_oct | _S_hex, |
76 | _S_floatfield = _S_scientific | _S_fixed, |
77 | _S_ios_fmtflags_end = 1L << 16, |
78 | _S_ios_fmtflags_max = __INT_MAX__, |
79 | _S_ios_fmtflags_min = ~__INT_MAX__ |
80 | }; |
81 | |
82 | inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags |
83 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) |
84 | { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); } |
85 | |
86 | inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags |
87 | operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) |
88 | { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); } |
89 | |
90 | inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags |
91 | operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) |
92 | { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); } |
93 | |
94 | inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags |
95 | operator~(_Ios_Fmtflags __a) |
96 | { return _Ios_Fmtflags(~static_cast<int>(__a)); } |
97 | |
98 | inline const _Ios_Fmtflags& |
99 | operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) |
100 | { return __a = __a | __b; } |
101 | |
102 | inline const _Ios_Fmtflags& |
103 | operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) |
104 | { return __a = __a & __b; } |
105 | |
106 | inline const _Ios_Fmtflags& |
107 | operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) |
108 | { return __a = __a ^ __b; } |
109 | |
110 | |
111 | enum _Ios_Openmode |
112 | { |
113 | _S_app = 1L << 0, |
114 | _S_ate = 1L << 1, |
115 | _S_bin = 1L << 2, |
116 | _S_in = 1L << 3, |
117 | _S_out = 1L << 4, |
118 | _S_trunc = 1L << 5, |
119 | _S_ios_openmode_end = 1L << 16, |
120 | _S_ios_openmode_max = __INT_MAX__, |
121 | _S_ios_openmode_min = ~__INT_MAX__ |
122 | }; |
123 | |
124 | inline _GLIBCXX_CONSTEXPR _Ios_Openmode |
125 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) |
126 | { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); } |
127 | |
128 | inline _GLIBCXX_CONSTEXPR _Ios_Openmode |
129 | operator|(_Ios_Openmode __a, _Ios_Openmode __b) |
130 | { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); } |
131 | |
132 | inline _GLIBCXX_CONSTEXPR _Ios_Openmode |
133 | operator^(_Ios_Openmode __a, _Ios_Openmode __b) |
134 | { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); } |
135 | |
136 | inline _GLIBCXX_CONSTEXPR _Ios_Openmode |
137 | operator~(_Ios_Openmode __a) |
138 | { return _Ios_Openmode(~static_cast<int>(__a)); } |
139 | |
140 | inline const _Ios_Openmode& |
141 | operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) |
142 | { return __a = __a | __b; } |
143 | |
144 | inline const _Ios_Openmode& |
145 | operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) |
146 | { return __a = __a & __b; } |
147 | |
148 | inline const _Ios_Openmode& |
149 | operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) |
150 | { return __a = __a ^ __b; } |
151 | |
152 | |
153 | enum _Ios_Iostate |
154 | { |
155 | _S_goodbit = 0, |
156 | _S_badbit = 1L << 0, |
157 | _S_eofbit = 1L << 1, |
158 | _S_failbit = 1L << 2, |
159 | _S_ios_iostate_end = 1L << 16, |
160 | _S_ios_iostate_max = __INT_MAX__, |
161 | _S_ios_iostate_min = ~__INT_MAX__ |
162 | }; |
163 | |
164 | inline _GLIBCXX_CONSTEXPR _Ios_Iostate |
165 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) |
166 | { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); } |
167 | |
168 | inline _GLIBCXX_CONSTEXPR _Ios_Iostate |
169 | operator|(_Ios_Iostate __a, _Ios_Iostate __b) |
170 | { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); } |
171 | |
172 | inline _GLIBCXX_CONSTEXPR _Ios_Iostate |
173 | operator^(_Ios_Iostate __a, _Ios_Iostate __b) |
174 | { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); } |
175 | |
176 | inline _GLIBCXX_CONSTEXPR _Ios_Iostate |
177 | operator~(_Ios_Iostate __a) |
178 | { return _Ios_Iostate(~static_cast<int>(__a)); } |
179 | |
180 | inline const _Ios_Iostate& |
181 | operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) |
182 | { return __a = __a | __b; } |
183 | |
184 | inline const _Ios_Iostate& |
185 | operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) |
186 | { return __a = __a & __b; } |
187 | |
188 | inline const _Ios_Iostate& |
189 | operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) |
190 | { return __a = __a ^ __b; } |
191 | |
192 | |
193 | enum _Ios_Seekdir |
194 | { |
195 | _S_beg = 0, |
196 | _S_cur = _GLIBCXX_STDIO_SEEK_CUR, |
197 | _S_end = _GLIBCXX_STDIO_SEEK_END, |
198 | _S_ios_seekdir_end = 1L << 16 |
199 | }; |
200 | |
201 | #if __cplusplus >= 201103L |
202 | |
203 | enum class io_errc { stream = 1 }; |
204 | |
205 | template <> struct is_error_code_enum<io_errc> : public true_type { }; |
206 | |
207 | const error_category& iostream_category() noexcept; |
208 | |
209 | inline error_code |
210 | make_error_code(io_errc __e) noexcept |
211 | { return error_code(static_cast<int>(__e), iostream_category()); } |
212 | |
213 | inline error_condition |
214 | make_error_condition(io_errc __e) noexcept |
215 | { return error_condition(static_cast<int>(__e), iostream_category()); } |
216 | #endif |
217 | |
218 | |
219 | |
220 | |
221 | |
222 | |
223 | |
224 | |
225 | |
226 | |
227 | |
228 | class ios_base |
229 | { |
230 | #if _GLIBCXX_USE_CXX11_ABI |
231 | #if __cplusplus < 201103L |
232 | |
233 | struct system_error : std::runtime_error |
234 | { |
235 | |
236 | struct error_code |
237 | { |
238 | error_code() { } |
239 | private: |
240 | int _M_value; |
241 | const void* _M_cat; |
242 | } _M_code; |
243 | }; |
244 | #endif |
245 | #endif |
246 | public: |
247 | |
248 | |
249 | |
250 | |
251 | |
252 | |
253 | |
254 | #if _GLIBCXX_USE_CXX11_ABI |
255 | class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error |
256 | { |
257 | public: |
258 | explicit |
259 | failure(const string& __str); |
260 | |
261 | #if __cplusplus >= 201103L |
262 | explicit |
263 | failure(const string&, const error_code&); |
264 | |
265 | explicit |
266 | failure(const char*, const error_code& = io_errc::stream); |
267 | #endif |
268 | |
269 | virtual |
270 | ~failure() throw(); |
271 | |
272 | virtual const char* |
273 | what() const throw(); |
274 | }; |
275 | #else |
276 | class failure : public exception |
277 | { |
278 | public: |
279 | |
280 | |
281 | explicit |
282 | failure(const string& __str) throw(); |
283 | |
284 | |
285 | |
286 | virtual |
287 | ~failure() throw(); |
288 | |
289 | virtual const char* |
290 | what() const throw(); |
291 | |
292 | private: |
293 | string _M_msg; |
294 | }; |
295 | #endif |
296 | |
297 | |
298 | |
299 | |
300 | |
301 | |
302 | |
303 | |
304 | |
305 | |
306 | |
307 | |
308 | |
309 | |
310 | |
311 | |
312 | |
313 | |
314 | |
315 | |
316 | |
317 | |
318 | |
319 | |
320 | |
321 | |
322 | |
323 | typedef _Ios_Fmtflags fmtflags; |
324 | |
325 | |
326 | static const fmtflags boolalpha = _S_boolalpha; |
327 | |
328 | |
329 | static const fmtflags dec = _S_dec; |
330 | |
331 | |
332 | static const fmtflags fixed = _S_fixed; |
333 | |
334 | |
335 | static const fmtflags hex = _S_hex; |
336 | |
337 | |
338 | |
339 | |
340 | static const fmtflags internal = _S_internal; |
341 | |
342 | |
343 | |
344 | static const fmtflags left = _S_left; |
345 | |
346 | |
347 | static const fmtflags oct = _S_oct; |
348 | |
349 | |
350 | |
351 | static const fmtflags right = _S_right; |
352 | |
353 | |
354 | static const fmtflags scientific = _S_scientific; |
355 | |
356 | |
357 | |
358 | static const fmtflags showbase = _S_showbase; |
359 | |
360 | |
361 | |
362 | static const fmtflags showpoint = _S_showpoint; |
363 | |
364 | |
365 | static const fmtflags showpos = _S_showpos; |
366 | |
367 | |
368 | static const fmtflags skipws = _S_skipws; |
369 | |
370 | |
371 | static const fmtflags unitbuf = _S_unitbuf; |
372 | |
373 | |
374 | |
375 | static const fmtflags uppercase = _S_uppercase; |
376 | |
377 | |
378 | static const fmtflags adjustfield = _S_adjustfield; |
379 | |
380 | |
381 | static const fmtflags basefield = _S_basefield; |
382 | |
383 | |
384 | static const fmtflags floatfield = _S_floatfield; |
385 | |
386 | |
387 | |
388 | |
389 | |
390 | |
391 | |
392 | |
393 | |
394 | |
395 | |
396 | |
397 | |
398 | typedef _Ios_Iostate iostate; |
399 | |
400 | |
401 | |
402 | static const iostate badbit = _S_badbit; |
403 | |
404 | |
405 | static const iostate eofbit = _S_eofbit; |
406 | |
407 | |
408 | |
409 | |
410 | static const iostate failbit = _S_failbit; |
411 | |
412 | |
413 | static const iostate goodbit = _S_goodbit; |
414 | |
415 | |
416 | |
417 | |
418 | |
419 | |
420 | |
421 | |
422 | |
423 | |
424 | |
425 | |
426 | |
427 | |
428 | |
429 | typedef _Ios_Openmode openmode; |
430 | |
431 | |
432 | static const openmode app = _S_app; |
433 | |
434 | |
435 | static const openmode ate = _S_ate; |
436 | |
437 | |
438 | |
439 | |
440 | static const openmode binary = _S_bin; |
441 | |
442 | |
443 | static const openmode in = _S_in; |
444 | |
445 | |
446 | static const openmode out = _S_out; |
447 | |
448 | |
449 | static const openmode trunc = _S_trunc; |
450 | |
451 | |
452 | |
453 | |
454 | |
455 | |
456 | |
457 | |
458 | |
459 | |
460 | |
461 | typedef _Ios_Seekdir seekdir; |
462 | |
463 | |
464 | static const seekdir beg = _S_beg; |
465 | |
466 | |
467 | static const seekdir cur = _S_cur; |
468 | |
469 | |
470 | static const seekdir end = _S_end; |
471 | |
472 | |
473 | typedef int io_state; |
474 | typedef int open_mode; |
475 | typedef int seek_dir; |
476 | |
477 | typedef std::streampos streampos; |
478 | typedef std::streamoff streamoff; |
479 | |
480 | |
481 | |
482 | |
483 | |
484 | |
485 | |
486 | |
487 | enum event |
488 | { |
489 | erase_event, |
490 | imbue_event, |
491 | copyfmt_event |
492 | }; |
493 | |
494 | |
495 | |
496 | |
497 | |
498 | |
499 | |
500 | |
501 | |
502 | |
503 | |
504 | typedef void (*event_callback) (event __e, ios_base& __b, int __i); |
505 | |
506 | |
507 | |
508 | |
509 | |
510 | |
511 | |
512 | |
513 | |
514 | |
515 | |
516 | void |
517 | register_callback(event_callback __fn, int __index); |
518 | |
519 | protected: |
520 | streamsize _M_precision; |
521 | streamsize _M_width; |
522 | fmtflags _M_flags; |
523 | iostate _M_exception; |
524 | iostate _M_streambuf_state; |
525 | |
526 | |
527 | |
528 | struct _Callback_list |
529 | { |
530 | |
531 | _Callback_list* _M_next; |
532 | ios_base::event_callback _M_fn; |
533 | int _M_index; |
534 | _Atomic_word _M_refcount; |
535 | |
536 | _Callback_list(ios_base::event_callback __fn, int __index, |
537 | _Callback_list* __cb) |
538 | : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } |
539 | |
540 | void |
541 | _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } |
542 | |
543 | |
544 | int |
545 | _M_remove_reference() |
546 | { |
547 | |
548 | _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); |
549 | int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); |
550 | if (__res == 0) |
551 | { |
552 | _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); |
553 | } |
554 | return __res; |
555 | } |
556 | }; |
557 | |
558 | _Callback_list* _M_callbacks; |
559 | |
560 | void |
561 | _M_call_callbacks(event __ev) throw(); |
562 | |
563 | void |
564 | _M_dispose_callbacks(void) throw(); |
565 | |
566 | |
567 | struct _Words |
568 | { |
569 | void* _M_pword; |
570 | long _M_iword; |
571 | _Words() : _M_pword(0), _M_iword(0) { } |
572 | }; |
573 | |
574 | |
575 | _Words _M_word_zero; |
576 | |
577 | |
578 | |
579 | enum { _S_local_word_size = 8 }; |
580 | _Words _M_local_word[_S_local_word_size]; |
581 | |
582 | |
583 | int _M_word_size; |
584 | _Words* _M_word; |
585 | |
586 | _Words& |
587 | _M_grow_words(int __index, bool __iword); |
588 | |
589 | |
590 | locale _M_ios_locale; |
591 | |
592 | void |
593 | _M_init() throw(); |
594 | |
595 | public: |
596 | |
597 | |
598 | |
599 | |
600 | |
601 | class Init |
602 | { |
603 | friend class ios_base; |
604 | public: |
605 | Init(); |
606 | ~Init(); |
607 | |
608 | private: |
609 | static _Atomic_word _S_refcount; |
610 | static bool _S_synced_with_stdio; |
611 | }; |
612 | |
613 | |
614 | |
615 | |
616 | |
617 | |
618 | fmtflags |
619 | flags() const |
620 | { return _M_flags; } |
621 | |
622 | |
623 | |
624 | |
625 | |
626 | |
627 | |
628 | |
629 | fmtflags |
630 | flags(fmtflags __fmtfl) |
631 | { |
632 | fmtflags __old = _M_flags; |
633 | _M_flags = __fmtfl; |
634 | return __old; |
635 | } |
636 | |
637 | |
638 | |
639 | |
640 | |
641 | |
642 | |
643 | |
644 | |
645 | fmtflags |
646 | setf(fmtflags __fmtfl) |
647 | { |
648 | fmtflags __old = _M_flags; |
649 | _M_flags |= __fmtfl; |
650 | return __old; |
651 | } |
652 | |
653 | |
654 | |
655 | |
656 | |
657 | |
658 | |
659 | |
660 | |
661 | |
662 | fmtflags |
663 | setf(fmtflags __fmtfl, fmtflags __mask) |
664 | { |
665 | fmtflags __old = _M_flags; |
666 | _M_flags &= ~__mask; |
667 | _M_flags |= (__fmtfl & __mask); |
668 | return __old; |
669 | } |
670 | |
671 | |
672 | |
673 | |
674 | |
675 | |
676 | |
677 | void |
678 | unsetf(fmtflags __mask) |
679 | { _M_flags &= ~__mask; } |
680 | |
681 | |
682 | |
683 | |
684 | |
685 | |
686 | |
687 | |
688 | streamsize |
689 | precision() const |
690 | { return _M_precision; } |
691 | |
692 | |
693 | |
694 | |
695 | |
696 | |
697 | streamsize |
698 | precision(streamsize __prec) |
699 | { |
700 | streamsize __old = _M_precision; |
701 | _M_precision = __prec; |
702 | return __old; |
703 | } |
704 | |
705 | |
706 | |
707 | |
708 | |
709 | |
710 | |
711 | streamsize |
712 | width() const |
713 | { return _M_width; } |
714 | |
715 | |
716 | |
717 | |
718 | |
719 | |
720 | streamsize |
721 | width(streamsize __wide) |
722 | { |
723 | streamsize __old = _M_width; |
724 | _M_width = __wide; |
725 | return __old; |
726 | } |
727 | |
728 | |
729 | |
730 | |
731 | |
732 | |
733 | |
734 | |
735 | |
736 | |
737 | |
738 | |
739 | static bool |
740 | sync_with_stdio(bool __sync = true); |
741 | |
742 | |
743 | |
744 | |
745 | |
746 | |
747 | |
748 | |
749 | |
750 | |
751 | locale |
752 | imbue(const locale& __loc) throw(); |
753 | |
754 | |
755 | |
756 | |
757 | |
758 | |
759 | |
760 | |
761 | |
762 | locale |
763 | getloc() const |
764 | { return _M_ios_locale; } |
765 | |
766 | |
767 | |
768 | |
769 | |
770 | |
771 | |
772 | |
773 | const locale& |
774 | _M_getloc() const |
775 | { return _M_ios_locale; } |
776 | |
777 | |
778 | |
779 | |
780 | |
781 | |
782 | |
783 | |
784 | |
785 | |
786 | |
787 | |
788 | |
789 | |
790 | |
791 | |
792 | static int |
793 | xalloc() throw(); |
794 | |
795 | |
796 | |
797 | |
798 | |
799 | |
800 | |
801 | |
802 | |
803 | |
804 | |
805 | |
806 | |
807 | |
808 | long& |
809 | iword(int __ix) |
810 | { |
811 | _Words& __word = (__ix < _M_word_size) |
812 | ? _M_word[__ix] : _M_grow_words(__ix, true); |
813 | return __word._M_iword; |
814 | } |
815 | |
816 | |
817 | |
818 | |
819 | |
820 | |
821 | |
822 | |
823 | |
824 | |
825 | |
826 | |
827 | |
828 | |
829 | void*& |
830 | pword(int __ix) |
831 | { |
832 | _Words& __word = (__ix < _M_word_size) |
833 | ? _M_word[__ix] : _M_grow_words(__ix, false); |
834 | return __word._M_pword; |
835 | } |
836 | |
837 | |
838 | |
839 | |
840 | |
841 | |
842 | |
843 | |
844 | |
845 | |
846 | virtual ~ios_base(); |
847 | |
848 | protected: |
849 | ios_base() throw (); |
850 | |
851 | #if __cplusplus < 201103L |
852 | |
853 | |
854 | private: |
855 | ios_base(const ios_base&); |
856 | |
857 | ios_base& |
858 | operator=(const ios_base&); |
859 | #else |
860 | public: |
861 | ios_base(const ios_base&) = delete; |
862 | |
863 | ios_base& |
864 | operator=(const ios_base&) = delete; |
865 | |
866 | protected: |
867 | void |
868 | _M_move(ios_base&) noexcept; |
869 | |
870 | void |
871 | _M_swap(ios_base& __rhs) noexcept; |
872 | #endif |
873 | }; |
874 | |
875 | |
876 | |
877 | inline ios_base& |
878 | boolalpha(ios_base& __base) |
879 | { |
880 | __base.setf(ios_base::boolalpha); |
881 | return __base; |
882 | } |
883 | |
884 | |
885 | inline ios_base& |
886 | noboolalpha(ios_base& __base) |
887 | { |
888 | __base.unsetf(ios_base::boolalpha); |
889 | return __base; |
890 | } |
891 | |
892 | |
893 | inline ios_base& |
894 | showbase(ios_base& __base) |
895 | { |
896 | __base.setf(ios_base::showbase); |
897 | return __base; |
898 | } |
899 | |
900 | |
901 | inline ios_base& |
902 | noshowbase(ios_base& __base) |
903 | { |
904 | __base.unsetf(ios_base::showbase); |
905 | return __base; |
906 | } |
907 | |
908 | |
909 | inline ios_base& |
910 | showpoint(ios_base& __base) |
911 | { |
912 | __base.setf(ios_base::showpoint); |
913 | return __base; |
914 | } |
915 | |
916 | |
917 | inline ios_base& |
918 | noshowpoint(ios_base& __base) |
919 | { |
920 | __base.unsetf(ios_base::showpoint); |
921 | return __base; |
922 | } |
923 | |
924 | |
925 | inline ios_base& |
926 | showpos(ios_base& __base) |
927 | { |
928 | __base.setf(ios_base::showpos); |
929 | return __base; |
930 | } |
931 | |
932 | |
933 | inline ios_base& |
934 | noshowpos(ios_base& __base) |
935 | { |
936 | __base.unsetf(ios_base::showpos); |
937 | return __base; |
938 | } |
939 | |
940 | |
941 | inline ios_base& |
942 | skipws(ios_base& __base) |
943 | { |
944 | __base.setf(ios_base::skipws); |
945 | return __base; |
946 | } |
947 | |
948 | |
949 | inline ios_base& |
950 | noskipws(ios_base& __base) |
951 | { |
952 | __base.unsetf(ios_base::skipws); |
953 | return __base; |
954 | } |
955 | |
956 | |
957 | inline ios_base& |
958 | uppercase(ios_base& __base) |
959 | { |
960 | __base.setf(ios_base::uppercase); |
961 | return __base; |
962 | } |
963 | |
964 | |
965 | inline ios_base& |
966 | nouppercase(ios_base& __base) |
967 | { |
968 | __base.unsetf(ios_base::uppercase); |
969 | return __base; |
970 | } |
971 | |
972 | |
973 | inline ios_base& |
974 | unitbuf(ios_base& __base) |
975 | { |
976 | __base.setf(ios_base::unitbuf); |
977 | return __base; |
978 | } |
979 | |
980 | |
981 | inline ios_base& |
982 | nounitbuf(ios_base& __base) |
983 | { |
984 | __base.unsetf(ios_base::unitbuf); |
985 | return __base; |
986 | } |
987 | |
988 | |
989 | |
990 | inline ios_base& |
991 | internal(ios_base& __base) |
992 | { |
993 | __base.setf(ios_base::internal, ios_base::adjustfield); |
994 | return __base; |
995 | } |
996 | |
997 | |
998 | inline ios_base& |
999 | left(ios_base& __base) |
1000 | { |
1001 | __base.setf(ios_base::left, ios_base::adjustfield); |
1002 | return __base; |
1003 | } |
1004 | |
1005 | |
1006 | inline ios_base& |
1007 | right(ios_base& __base) |
1008 | { |
1009 | __base.setf(ios_base::right, ios_base::adjustfield); |
1010 | return __base; |
1011 | } |
1012 | |
1013 | |
1014 | |
1015 | inline ios_base& |
1016 | dec(ios_base& __base) |
1017 | { |
1018 | __base.setf(ios_base::dec, ios_base::basefield); |
1019 | return __base; |
1020 | } |
1021 | |
1022 | |
1023 | inline ios_base& |
1024 | hex(ios_base& __base) |
1025 | { |
1026 | __base.setf(ios_base::hex, ios_base::basefield); |
1027 | return __base; |
1028 | } |
1029 | |
1030 | |
1031 | inline ios_base& |
1032 | oct(ios_base& __base) |
1033 | { |
1034 | __base.setf(ios_base::oct, ios_base::basefield); |
1035 | return __base; |
1036 | } |
1037 | |
1038 | |
1039 | |
1040 | inline ios_base& |
1041 | fixed(ios_base& __base) |
1042 | { |
1043 | __base.setf(ios_base::fixed, ios_base::floatfield); |
1044 | return __base; |
1045 | } |
1046 | |
1047 | |
1048 | inline ios_base& |
1049 | scientific(ios_base& __base) |
1050 | { |
1051 | __base.setf(ios_base::scientific, ios_base::floatfield); |
1052 | return __base; |
1053 | } |
1054 | |
1055 | #if __cplusplus >= 201103L |
1056 | |
1057 | |
1058 | |
1059 | |
1060 | inline ios_base& |
1061 | hexfloat(ios_base& __base) |
1062 | { |
1063 | __base.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); |
1064 | return __base; |
1065 | } |
1066 | |
1067 | |
1068 | inline ios_base& |
1069 | defaultfloat(ios_base& __base) |
1070 | { |
1071 | __base.unsetf(ios_base::floatfield); |
1072 | return __base; |
1073 | } |
1074 | #endif |
1075 | |
1076 | _GLIBCXX_END_NAMESPACE_VERSION |
1077 | } |
1078 | |
1079 | #endif |
1080 | |