33 #ifndef _GLIBCXX_IOMANIP
34 #define _GLIBCXX_IOMANIP 1
36 #pragma GCC system_header
42 #if __cplusplus >= 201103L
46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
64 {
return { __mask }; }
66 template<
typename _CharT,
typename _Traits>
67 inline basic_istream<_CharT, _Traits>&
68 operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
74 template<
typename _CharT,
typename _Traits>
75 inline basic_ostream<_CharT, _Traits>&
76 operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
94 {
return { __mask }; }
96 template<
typename _CharT,
typename _Traits>
97 inline basic_istream<_CharT, _Traits>&
98 operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
100 __is.setf(__f._M_mask);
104 template<
typename _CharT,
typename _Traits>
105 inline basic_ostream<_CharT, _Traits>&
106 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
108 __os.setf(__f._M_mask);
113 struct _Setbase {
int _M_base; };
125 {
return { __base }; }
127 template<
typename _CharT,
typename _Traits>
128 inline basic_istream<_CharT, _Traits>&
129 operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
138 template<
typename _CharT,
typename _Traits>
139 inline basic_ostream<_CharT, _Traits>&
140 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f)
150 template<
typename _CharT>
151 struct _Setfill { _CharT _M_c; };
160 template<
typename _CharT>
161 inline _Setfill<_CharT>
165 template<
typename _CharT,
typename _Traits>
166 inline basic_istream<_CharT, _Traits>&
167 operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
173 template<
typename _CharT,
typename _Traits>
174 inline basic_ostream<_CharT, _Traits>&
175 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f)
182 struct _Setprecision {
int _M_n; };
195 template<
typename _CharT,
typename _Traits>
196 inline basic_istream<_CharT, _Traits>&
197 operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
199 __is.precision(__f._M_n);
203 template<
typename _CharT,
typename _Traits>
204 inline basic_ostream<_CharT, _Traits>&
205 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f)
207 __os.precision(__f._M_n);
212 struct _Setw {
int _M_n; };
225 template<
typename _CharT,
typename _Traits>
226 inline basic_istream<_CharT, _Traits>&
227 operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
229 __is.width(__f._M_n);
233 template<
typename _CharT,
typename _Traits>
234 inline basic_ostream<_CharT, _Traits>&
235 operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f)
237 __os.width(__f._M_n);
241 #if __cplusplus >= 201103L
243 template<
typename _MoneyT>
244 struct _Get_money { _MoneyT& _M_mon;
bool _M_intl; };
254 template<
typename _MoneyT>
255 inline _Get_money<_MoneyT>
257 {
return { __mon, __intl }; }
259 template<
typename _CharT,
typename _Traits,
typename _MoneyT>
260 basic_istream<_CharT, _Traits>&
261 operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)
263 typename basic_istream<_CharT, _Traits>::sentry __cerb(__is,
false);
269 typedef istreambuf_iterator<_CharT, _Traits> _Iter;
270 typedef money_get<_CharT, _Iter> _MoneyGet;
272 const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
273 __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
274 __is, __err, __f._M_mon);
279 __throw_exception_again;
284 __is.setstate(__err);
290 template<
typename _MoneyT>
291 struct _Put_money {
const _MoneyT& _M_mon;
bool _M_intl; };
301 template<
typename _MoneyT>
302 inline _Put_money<_MoneyT>
304 {
return { __mon, __intl }; }
306 template<
typename _CharT,
typename _Traits,
typename _MoneyT>
307 basic_ostream<_CharT, _Traits>&
308 operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f)
310 typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os);
316 typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
317 typedef money_put<_CharT, _Iter> _MoneyPut;
319 const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
320 if (__mp.put(_Iter(__os.rdbuf()), __f._M_intl, __os,
321 __os.fill(), __f._M_mon).failed())
327 __throw_exception_again;
332 __os.setstate(__err);
337 #if __cplusplus > 201103L
339 _GLIBCXX_END_NAMESPACE_VERSION
341 _GLIBCXX_BEGIN_NAMESPACE_VERSION
347 template<
typename _String,
typename _CharT>
348 struct _Quoted_string
350 static_assert(is_reference<_String>::value
351 || is_pointer<_String>::value,
352 "String type must be pointer or reference");
354 _Quoted_string(_String __str, _CharT __del, _CharT __esc)
355 : _M_string(__str), _M_delim{__del}, _M_escape{__esc}
359 operator=(_Quoted_string&) =
delete;
370 template<
typename _CharT,
typename _Traits>
372 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
373 const _Quoted_string<const _CharT*, _CharT>& __str)
375 __os << __str._M_delim;
376 for (
const _CharT* __c = __str._M_string; *__c; ++__c)
378 if (*__c == __str._M_delim || *__c == __str._M_escape)
379 __os << __str._M_escape;
382 __os << __str._M_delim;
391 template<
typename _CharT,
typename _Traits,
typename _String>
393 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
394 const _Quoted_string<_String, _CharT>& __str)
396 __os << __str._M_delim;
397 for (
auto& __c : __str._M_string)
399 if (__c == __str._M_delim || __c == __str._M_escape)
400 __os << __str._M_escape;
403 __os << __str._M_delim;
412 template<
typename _CharT,
typename _Traits,
typename _Alloc>
415 const _Quoted_string<basic_string<_CharT, _Traits, _Alloc>&,
418 __str._M_string.clear();
424 if (__c != __str._M_delim)
427 __is >> __str._M_string;
430 std::ios_base::fmtflags __flags
437 if (__c == __str._M_escape)
443 else if (__c == __str._M_delim)
445 __str._M_string += __c;
452 _GLIBCXX_END_NAMESPACE_VERSION
454 _GLIBCXX_BEGIN_NAMESPACE_VERSION
462 template<
typename _CharT>
464 quoted(
const _CharT* __string,
465 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
467 return __detail::_Quoted_string<const _CharT*, _CharT>(__string, __delim,
471 template<
typename _CharT,
typename _Traits,
typename _Alloc>
473 quoted(
const basic_string<_CharT, _Traits, _Alloc>& __string,
474 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
476 return __detail::_Quoted_string<
477 const basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
478 __string, __delim, __escape);
481 template<
typename _CharT,
typename _Traits,
typename _Alloc>
483 quoted(basic_string<_CharT, _Traits, _Alloc>& __string,
484 _CharT __delim = _CharT(
'"'), _CharT __escape = _CharT(
'\\'))
486 return __detail::_Quoted_string<
487 basic_string<_CharT, _Traits, _Alloc>&, _CharT>(
488 __string, __delim, __escape);
491 #endif // __cplusplus > 201103L
493 #endif // __cplusplus >= 201103L
498 #if _GLIBCXX_EXTERN_TEMPLATE
499 extern template ostream& operator<<(ostream&, _Setfill<char>);
512 #ifdef _GLIBCXX_USE_WCHAR_T
513 extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
528 _GLIBCXX_END_NAMESPACE_VERSION
_Resetiosflags resetiosflags(ios_base::fmtflags __mask)
Manipulator for setf.
static const fmtflags oct
Converts integer input or generates integer output in octal base.
fmtflags flags() const
Access to format flags.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
basic_ostream< char > ostream
Base class for char output streams.
_Ios_Iostate iostate
This is a bitmask type.
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
basic_istream< char > istream
Base class for char input streams.
bitset< _Nb > operator<<(size_t __position) const noexcept
Self-explanatory.
bool good() const
Fast error checking.
_Get_money< _MoneyT > get_money(_MoneyT &__mon, bool __intl=false)
Extended manipulator for extracting money.
_Setbase setbase(int __base)
Manipulator for setf.
_Setiosflags setiosflags(ios_base::fmtflags __mask)
Manipulator for setf.
basic_istream< wchar_t > wistream
Base class for wchar_t input streams.
_Setw setw(int __n)
Manipulator for width.
fmtflags setf(fmtflags __fmtfl)
Setting new format flags.
Thrown as part of forced unwinding.A magic placeholder class that can be caught by reference to recog...
bitset< _Nb > operator>>(size_t __position) const noexcept
Self-explanatory.
static const fmtflags dec
Converts integer input or generates integer output in decimal base.
_Setfill< _CharT > setfill(_CharT __c)
Manipulator for fill.
static const iostate goodbit
Indicates all is well.
_Setprecision setprecision(int __n)
Manipulator for precision.
static const fmtflags basefield
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
_Ios_Fmtflags fmtflags
This is a bitmask type.
static const fmtflags hex
Converts integer input or generates integer output in hexadecimal base.
Template class basic_istream.
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.
__istream_type & unget()
Unextracting the previous character.
_Put_money< _MoneyT > put_money(const _MoneyT &__mon, bool __intl=false)
Extended manipulator for inserting money.