The header <iomanip> defines several functions that support extractors and inserters that allow for the parsing and formatting of sequences and values for money and time.
template <class moneyT> unspecified get_money(moneyT& mon, bool intl = false);
Requires: The type moneyT shall be either long double or a specialization of the basic_string template (Clause [strings]).
Effects: The expression in >> get_money(mon, intl) described below behaves as a formatted input function ([istream.formatted.reqmts]).
Returns: An object of unspecified type such that if in is an object of type basic_istream<charT, traits> then the expression in >> get_money(mon, intl) behaves as if it called f(in, mon, intl), where the function f is defined as:
template <class charT, class traits, class moneyT> void f(basic_ios<charT, traits>& str, moneyT& mon, bool intl) { typedef istreambuf_iterator<charT, traits> Iter; typedef money_get<charT, Iter> MoneyGet; ios_base::iostate err = ios_base::goodbit; const MoneyGet &mg = use_facet<MoneyGet>(str.getloc()); mg.get(Iter(str.rdbuf()), Iter(), intl, str, err, mon); if (ios_base::goodbit != err) str.setstate(err); }
The expression in >> get_money(mon, intl) shall have type basic_istream<charT, traits>& and value in.
template <class moneyT> unspecified put_money(const moneyT& mon, bool intl = false);
Requires: The type moneyT shall be either long double or a specialization of the basic_string template (Clause [strings]).
Returns: An object of unspecified type such that if out is an object of type basic_ostream<charT, traits> then the expression out << put_money(mon, intl) behaves as a formatted input function that calls f(out, mon, intl), where the function f is defined as:
template <class charT, class traits, class moneyT> void f(basic_ios<charT, traits>& str, const moneyT& mon, bool intl) { typedef ostreambuf_iterator<charT, traits> Iter; typedef money_put<charT, Iter> MoneyPut; const MoneyPut& mp = use_facet<MoneyPut>(str.getloc()); const Iter end = mp.put(Iter(str.rdbuf()), intl, str, str.fill(), mon); if (end.failed()) str.setstate(ios::badbit); }
The expression out << put_money(mon, intl) shall have type basic_ostream<charT, traits>& and value out.
template <class charT> unspecified get_time(struct tm* tmb, const charT* fmt);
Requires: The argument tmb shall be a valid pointer to an object of type struct tm, and the argument fmt shall be a valid pointer to an array of objects of type charT with char_traits<charT>::length(fmt) elements.
Returns: An object of unspecified type such that if in is an object of type basic_istream<charT, traits> then the expression in >> get_time(tmb, fmt) behaves as if it called f(in, tmb, fmt), where the function f is defined as:
template <class charT, class traits> void f(basic_ios<charT, traits>& str, struct tm* tmb, const charT* fmt) { typedef istreambuf_iterator<charT, traits> Iter; typedef time_get<charT, Iter> TimeGet; ios_base::iostate err = ios_base::goodbit; const TimeGet& tg = use_facet<TimeGet>(str.getloc()); tg.get(Iter(str.rdbuf()), Iter(), str, err, tmb, fmt, fmt + traits::length(fmt)); if (err != ios_base::goodbit) str.setstate(err): }
The expression in >> get_time(tmb, fmt) shall have type basic_istream<charT, traits>& and value in.
template <class charT> unspecified put_time(const struct tm* tmb, const charT* fmt);
Requires: The argument tmb shall be a valid pointer to an object of type struct tm, and the argument fmt shall be a valid pointer to an array of objects of type charT with char_traits<charT>::length(fmt) elements.
Returns: An object of unspecified type such that if out is an object of type basic_ostream<charT, traits> then the expression out << put_time(tmb, fmt) behaves as if it called f(out, tmb, fmt), where the function f is defined as:
template <class charT, class traits> void f(basic_ios<charT, traits>& str, const struct tm* tmb, const charT* fmt) { typedef ostreambuf_iterator<charT, traits> Iter; typedef time_put<charT, Iter> TimePut; const TimePut& tp = use_facet<TimePut>(str.getloc()); const Iter end = tp.put(Iter(str.rdbuf()), str, str.fill(), tmb, fmt, fmt + traits::length(fmt)); if (end.failed()) str.setstate(ios_base::badbit); }
The expression out << put_time(tmb, fmt) shall have type basic_istream<charT, traits>& and value out.