33 #ifndef _GLIBCXX_IOMANIP
34 #define _GLIBCXX_IOMANIP 1
36 #ifdef _GLIBCXX_SYSHDR
37 #pragma GCC system_header
40 #pragma GCC diagnostic push
41 #pragma GCC diagnostic ignored "-Wc++11-extensions"
49 #define __glibcxx_want_quoted_string_io
52 #if __cplusplus >= 201103L
54 #if __cplusplus > 201103L
59 namespace std _GLIBCXX_VISIBILITY(default)
61 _GLIBCXX_BEGIN_NAMESPACE_VERSION
77 {
return { __mask }; }
79 template<
typename _CharT,
typename _Traits>
80 inline basic_istream<_CharT, _Traits>&
81 operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
87 template<
typename _CharT,
typename _Traits>
88 inline basic_ostream<_CharT, _Traits>&
89 operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
107 {
return { __mask }; }
109 template<
typename _CharT,
typename _Traits>
110 inline basic_istream<_CharT, _Traits>&
111 operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
113 __is.setf(__f._M_mask);
117 template<
typename _CharT,
typename _Traits>
118 inline basic_ostream<_CharT, _Traits>&
119 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
121 __os.setf(__f._M_mask);
126 struct _Setbase {
int _M_base; };
140 template<
typename _CharT,
typename _Traits>
141 inline basic_istream<_CharT, _Traits>&
142 operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
151 template<
typename _CharT,
typename _Traits>
152 inline basic_ostream<_CharT, _Traits>&
153 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f)
163 template<
typename _CharT>
164 struct _Setfill { _CharT _M_c; };
173 template<
typename _CharT>
174 inline _Setfill<_CharT>
178 template<
typename _CharT,
typename _Traits>
179 __attribute__((__deprecated__(
"'std::setfill' should only be used with "
181 inline basic_istream<_CharT, _Traits>&
182 operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
188 template<
typename _CharT,
typename _Traits>
189 inline basic_ostream<_CharT, _Traits>&
190 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f)
197 struct _Setprecision {
int _M_n; };
210 template<
typename _CharT,
typename _Traits>
211 inline basic_istream<_CharT, _Traits>&
212 operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
214 __is.precision(__f._M_n);
218 template<
typename _CharT,
typename _Traits>
219 inline basic_ostream<_CharT, _Traits>&
220 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f)
222 __os.precision(__f._M_n);
227 struct _Setw {
int _M_n; };
240 template<
typename _CharT,
typename _Traits>
241 inline basic_istream<_CharT, _Traits>&
242 operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
244 __is.width(__f._M_n);
248 template<
typename _CharT,
typename _Traits>
249 inline basic_ostream<_CharT, _Traits>&
250 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f)
252 __os.width(__f._M_n);
256 #if __cplusplus >= 201103L
258 template<
typename _MoneyT>
259 struct _Get_money { _MoneyT& _M_mon;
bool _M_intl; };
269 template<
typename _MoneyT>
270 inline _Get_money<_MoneyT>
272 {
return { __mon, __intl }; }
274 template<
typename _CharT,
typename _Traits,
typename _MoneyT>
275 basic_istream<_CharT, _Traits>&
276 operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)
278 typename basic_istream<_CharT, _Traits>::sentry __cerb(__is,
false);
284 typedef istreambuf_iterator<_CharT, _Traits> _Iter;
285 typedef money_get<_CharT, _Iter> _MoneyGet;
287 const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
288 __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
289 __is, __err, __f._M_mon);
294 __throw_exception_again;
299 __is.setstate(__err);
305 template<
typename _MoneyT>
306 struct _Put_money {
const _MoneyT& _M_mon;
bool _M_intl; };
316 template<
typename _MoneyT>
317 inline _Put_money<_MoneyT>
319 {
return { __mon, __intl }; }
321 template<
typename _CharT,
typename _Traits,
typename _MoneyT>
322 basic_ostream<_CharT, _Traits>&
323 operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f)
325 typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os);
331 typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
332 typedef money_put<_CharT, _Iter> _MoneyPut;
334 const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
335 if (__mp.put(_Iter(__os.rdbuf()), __f._M_intl, __os,
336 __os.fill(), __f._M_mon).failed())
342 __throw_exception_again;
347 __os.setstate(__err);
352 template<
typename _CharT>
355 const std::tm* _M_tmb;
356 const _CharT* _M_fmt;
368 template<
typename _CharT>
369 inline _Put_time<_CharT>
370 put_time(
const std::tm* __tmb,
const _CharT* __fmt)
371 {
return { __tmb, __fmt }; }
373 template<
typename _CharT,
typename _Traits>
374 basic_ostream<_CharT, _Traits>&
375 operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_time<_CharT> __f)
377 typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os);
383 typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
384 typedef time_put<_CharT, _Iter> _TimePut;
386 const _CharT*
const __fmt_end = __f._M_fmt +
387 _Traits::length(__f._M_fmt);
389 const _TimePut& __mp = use_facet<_TimePut>(__os.getloc());
390 if (__mp.put(_Iter(__os.rdbuf()), __os, __os.fill(),
391 __f._M_tmb, __f._M_fmt, __fmt_end).failed())
397 __throw_exception_again;
402 __os.setstate(__err);
407 template<
typename _CharT>
411 const _CharT* _M_fmt;
423 template<
typename _CharT>
424 inline _Get_time<_CharT>
426 {
return { __tmb, __fmt }; }
428 template<
typename _CharT,
typename _Traits>
429 basic_istream<_CharT, _Traits>&
430 operator>>(basic_istream<_CharT, _Traits>& __is, _Get_time<_CharT> __f)
432 typename basic_istream<_CharT, _Traits>::sentry __cerb(__is,
false);
438 typedef istreambuf_iterator<_CharT, _Traits> _Iter;
439 typedef time_get<_CharT, _Iter> _TimeGet;
441 const _CharT*
const __fmt_end = __f._M_fmt +
442 _Traits::length(__f._M_fmt);
444 const _TimeGet& __mg = use_facet<_TimeGet>(__is.getloc());
445 __mg.get(_Iter(__is.rdbuf()), _Iter(), __is,
446 __err, __f._M_tmb, __f._M_fmt, __fmt_end);
451 __throw_exception_again;
456 __is.setstate(__err);
461 #ifdef __cpp_lib_quoted_string_io // C++ >= 14 && HOSTED
470 template<
typename _CharT>
472 quoted(
const _CharT* __string,
473 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
475 return __detail::_Quoted_string<const _CharT*, _CharT>(__string, __delim,
479 template<
typename _CharT,
typename _Traits,
typename _Alloc>
481 quoted(
const basic_string<_CharT, _Traits, _Alloc>& __string,
482 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
484 return __detail::_Quoted_string<
485 const basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
486 __string, __delim, __escape);
489 template<
typename _CharT,
typename _Traits,
typename _Alloc>
491 quoted(basic_string<_CharT, _Traits, _Alloc>& __string,
492 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
494 return __detail::_Quoted_string<
495 basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
496 __string, __delim, __escape);
499 #if __cplusplus >= 201703L
502 template<
typename _CharT,
typename _Traits>
504 quoted(basic_string_view<_CharT, _Traits> __sv,
505 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
507 return __detail::_Quoted_string<
508 basic_string_view<_CharT, _Traits>, _CharT>(__sv, __delim, __escape);
511 #endif // __cpp_lib_quoted_string_io
513 #endif // __cplusplus >= 201103L
518 #if _GLIBCXX_EXTERN_TEMPLATE
532 #ifdef _GLIBCXX_USE_WCHAR_T
548 _GLIBCXX_END_NAMESPACE_VERSION
551 #pragma GCC diagnostic pop