OutItrT put(OutItrT a_next, std::ios_base& a_ios, char_type a_fill, const time_type& a_time) const { if (a_time.is_special()) { return do_put_special(a_next, a_ios, a_fill, a_time.date().as_special()); } string_type format(m_format); string_type frac_str; if (format.find(seconds_with_fractional_seconds_format)) { // replace %s with %S.nnn frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); string_type replace_string(seconds_format); replace_string += sep; replace_string += frac_str; boost::algorithm::replace_all(format, seconds_with_fractional_seconds_format, replace_string); } if (format.find(fractional_seconds_format)) { // replace %f with nnnnnnn if (!frac_str.size()) { frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); } boost::algorithm::replace_all(format, fractional_seconds_format, frac_str); } if (format.find(fractional_seconds_or_none_format)) { // replace %F with nnnnnnn or nothing if fs == 0 frac_str = fractional_seconds_as_string(a_time.time_of_day(), true); if (frac_str.size()) { char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); string_type replace_string; replace_string += sep; replace_string += frac_str; boost::algorithm::replace_all(format, fractional_seconds_or_none_format, replace_string); } else { boost::algorithm::erase_all(format, fractional_seconds_or_none_format); } } return do_put_tm(a_next, a_ios, a_fill, to_tm(a_time), format); }
OutItrT put(OutItrT next, std::ios_base& a_ios, char_type fill_char, const date_type& d) const { if (d.is_special()) { return do_put_special(next, a_ios, fill_char, d.as_special()); } //The following line of code required the date to support a to_tm function return do_put_tm(next, a_ios, fill_char, to_tm(d), m_format); }
//! puts the day of month OutItrT put(OutItrT next, std::ios_base& a_ios, char_type fill_char, const day_type& day) const { std::tm dtm = {}; dtm.tm_mday = day.as_number(); char_type tmp[3] = {'%','d'}; string_type temp_format(tmp); return do_put_tm(next, a_ios, fill_char, dtm, temp_format); }
OutItrT put(OutItrT next, std::ios_base& a_ios, char_type fill_char, const day_of_week_type& dow) const { //if (d.is_special()) { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function std::tm dtm = {}; dtm.tm_wday = dow; return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format); }
OutItrT put(OutItrT next, std::ios_base& a_ios, char_type fill_char, const month_type& m) const { //if (d.is_special()) { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function std::tm dtm; std::memset(&dtm, 0, sizeof(dtm)); dtm.tm_mon = m - 1; return do_put_tm(next, a_ios, fill_char, dtm, m_month_format); }