33 #ifndef _GLIBCXX_IOMANIP
34 #define _GLIBCXX_IOMANIP 1
36 #pragma GCC system_header
42 #if __cplusplus >= 201103L
44 #if __cplusplus > 201103L
49 namespace std _GLIBCXX_VISIBILITY(default)
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
67 {
return { __mask }; }
69 template<
typename _CharT,
typename _Traits>
70 inline basic_istream<_CharT, _Traits>&
71 operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
77 template<
typename _CharT,
typename _Traits>
78 inline basic_ostream<_CharT, _Traits>&
79 operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
97 {
return { __mask }; }
99 template<
typename _CharT,
typename _Traits>
100 inline basic_istream<_CharT, _Traits>&
101 operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
103 __is.setf(__f._M_mask);
107 template<
typename _CharT,
typename _Traits>
108 inline basic_ostream<_CharT, _Traits>&
109 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
111 __os.setf(__f._M_mask);
116 struct _Setbase {
int _M_base; };
128 {
return { __base }; }
130 template<
typename _CharT,
typename _Traits>
131 inline basic_istream<_CharT, _Traits>&
132 operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
141 template<
typename _CharT,
typename _Traits>
142 inline basic_ostream<_CharT, _Traits>&
143 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f)
153 template<
typename _CharT>
154 struct _Setfill { _CharT _M_c; };
163 template<
typename _CharT>
164 inline _Setfill<_CharT>
168 template<
typename _CharT,
typename _Traits>
169 inline basic_istream<_CharT, _Traits>&
170 operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
176 template<
typename _CharT,
typename _Traits>
177 inline basic_ostream<_CharT, _Traits>&
178 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f)
185 struct _Setprecision {
int _M_n; };
198 template<
typename _CharT,
typename _Traits>
199 inline basic_istream<_CharT, _Traits>&
200 operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
202 __is.precision(__f._M_n);
206 template<
typename _CharT,
typename _Traits>
207 inline basic_ostream<_CharT, _Traits>&
208 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f)
210 __os.precision(__f._M_n);
215 struct _Setw {
int _M_n; };
228 template<
typename _CharT,
typename _Traits>
229 inline basic_istream<_CharT, _Traits>&
230 operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
232 __is.width(__f._M_n);
236 template<
typename _CharT,
typename _Traits>
237 inline basic_ostream<_CharT, _Traits>&
238 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f)
240 __os.width(__f._M_n);
244 #if __cplusplus >= 201103L
246 template<
typename _MoneyT>
247 struct _Get_money { _MoneyT& _M_mon;
bool _M_intl; };
257 template<
typename _MoneyT>
258 inline _Get_money<_MoneyT>
260 {
return { __mon, __intl }; }
262 template<
typename _CharT,
typename _Traits,
typename _MoneyT>
263 basic_istream<_CharT, _Traits>&
264 operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)
266 typename basic_istream<_CharT, _Traits>::sentry __cerb(__is,
false);
272 typedef istreambuf_iterator<_CharT, _Traits> _Iter;
273 typedef money_get<_CharT, _Iter> _MoneyGet;
275 const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
276 __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
277 __is, __err, __f._M_mon);
282 __throw_exception_again;
287 __is.setstate(__err);
293 template<
typename _MoneyT>
294 struct _Put_money {
const _MoneyT& _M_mon;
bool _M_intl; };
304 template<
typename _MoneyT>
305 inline _Put_money<_MoneyT>
307 {
return { __mon, __intl }; }
309 template<
typename _CharT,
typename _Traits,
typename _MoneyT>
310 basic_ostream<_CharT, _Traits>&
311 operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f)
313 typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os);
319 typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
320 typedef money_put<_CharT, _Iter> _MoneyPut;
322 const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
323 if (__mp.put(_Iter(__os.rdbuf()), __f._M_intl, __os,
324 __os.fill(), __f._M_mon).failed())
330 __throw_exception_again;
335 __os.setstate(__err);
340 #if __cplusplus > 201103L
342 _GLIBCXX_END_NAMESPACE_VERSION
344 _GLIBCXX_BEGIN_NAMESPACE_VERSION
349 template<
typename _String,
typename _CharT>
350 struct _Quoted_string
352 static_assert(is_reference<_String>::value
353 || is_pointer<_String>::value,
354 "String type must be pointer or reference");
356 _Quoted_string(_String __str, _CharT __del, _CharT __esc)
357 : _M_string(__str), _M_delim{__del}, _M_escape{__esc}
361 operator=(_Quoted_string&) =
delete;
374 template<
typename _CharT,
typename _Traits>
376 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
377 const _Quoted_string<const _CharT*, _CharT>& __str)
380 __ostr << __str._M_delim;
381 for (
const _CharT* __c = __str._M_string; *__c; ++__c)
383 if (*__c == __str._M_delim || *__c == __str._M_escape)
384 __ostr << __str._M_escape;
387 __ostr << __str._M_delim;
389 return __os << __ostr.
str();
398 template<
typename _CharT,
typename _Traits,
typename _String>
400 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
401 const _Quoted_string<_String, _CharT>& __str)
404 __ostr << __str._M_delim;
405 for (
auto& __c : __str._M_string)
407 if (__c == __str._M_delim || __c == __str._M_escape)
408 __ostr << __str._M_escape;
411 __ostr << __str._M_delim;
413 return __os << __ostr.
str();
420 template<
typename _CharT,
typename _Traits,
typename _Alloc>
423 const _Quoted_string<basic_string<_CharT, _Traits, _Alloc>&,
430 if (__c != __str._M_delim)
433 __is >> __str._M_string;
436 __str._M_string.
clear();
437 std::ios_base::fmtflags __flags
444 if (__c == __str._M_escape)
450 else if (__c == __str._M_delim)
452 __str._M_string += __c;
459 _GLIBCXX_END_NAMESPACE_VERSION
461 _GLIBCXX_BEGIN_NAMESPACE_VERSION
469 template<
typename _CharT>
471 quoted(
const _CharT* __string,
472 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
474 return __detail::_Quoted_string<const _CharT*, _CharT>(__string, __delim,
478 template<
typename _CharT,
typename _Traits,
typename _Alloc>
480 quoted(
const basic_string<_CharT, _Traits, _Alloc>& __string,
481 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
483 return __detail::_Quoted_string<
484 const basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
485 __string, __delim, __escape);
488 template<
typename _CharT,
typename _Traits,
typename _Alloc>
490 quoted(basic_string<_CharT, _Traits, _Alloc>& __string,
491 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
493 return __detail::_Quoted_string<
494 basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
495 __string, __delim, __escape);
498 #endif // __cplusplus > 201103L
500 #endif // __cplusplus >= 201103L
505 #if _GLIBCXX_EXTERN_TEMPLATE
506 extern template ostream& operator<<(ostream&, _Setfill<char>);
519 #ifdef _GLIBCXX_USE_WCHAR_T
520 extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
535 _GLIBCXX_END_NAMESPACE_VERSION
__istream_type & unget()
Unextracting the previous character.
bool good() const
Fast error checking.
_Setbase setbase(int __base)
Manipulator for setf.
fmtflags setf(fmtflags __fmtfl)
Setting new format flags.
static const fmtflags basefield
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
basic_istream< wchar_t > wistream
Base class for wchar_t input streams.
_Ios_Fmtflags fmtflags
This is a bitmask type.
Template class basic_istream.
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.
__string_type str() const
Copying out the string buffer.
_Put_money< _MoneyT > put_money(const _MoneyT &__mon, bool __intl=false)
Extended manipulator for inserting money.
bitset< _Nb > operator<<(size_t __position) const noexcept
Self-explanatory.
_Setfill< _CharT > setfill(_CharT __c)
Manipulator for fill.
basic_istream< char > istream
Base class for char input streams.
static const fmtflags oct
Converts integer input or generates integer output in octal base.
_Setprecision setprecision(int __n)
Manipulator for precision.
void clear(iostate __state=goodbit)
[Re]sets the error state.
_Ios_Iostate iostate
This is a bitmask type.
Controlling output for std::string.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
Thrown as part of forced unwinding.A magic placeholder class that can be caught by reference to recog...
_Resetiosflags resetiosflags(ios_base::fmtflags __mask)
Manipulator for setf.
static const fmtflags hex
Converts integer input or generates integer output in hexadecimal base.
_Get_money< _MoneyT > get_money(_MoneyT &__mon, bool __intl=false)
Extended manipulator for extracting money.
fmtflags flags() const
Access to format flags.
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
_Setw setw(int __n)
Manipulator for width.
basic_ostream< char > ostream
Base class for char output streams.
bitset< _Nb > operator>>(size_t __position) const noexcept
Self-explanatory.
static const fmtflags dec
Converts integer input or generates integer output in decimal base.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
_Setiosflags setiosflags(ios_base::fmtflags __mask)
Manipulator for setf.
static const iostate goodbit
Indicates all is well.