nth_kday_type get_nth_kday_type(stream_itr_type& sitr, stream_itr_type& stream_end, std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } typename nth_kday_type::week_num wn; day_of_week_type wd(0); // no default constructor month_type m(1); // no default constructor match_results mr = m_element_strings.match(sitr, stream_end); switch(mr.current_match) { case first : { wn = nth_kday_type::first; break; } case second : { wn = nth_kday_type::second; break; } case third : { wn = nth_kday_type::third; break; } case fourth : { wn = nth_kday_type::fourth; break; } case fifth : { wn = nth_kday_type::fifth; break; } default: { boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'")); BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(wn = nth_kday_type::first); } } // week num facet.get(sitr, stream_end, a_ios, wd); // day_of_week extract_element(sitr, stream_end, of); // "of" element facet.get(sitr, stream_end, a_ios, m); // month return nth_kday_type(wn, wd, m); }
period_type get_period(stream_itr_type& sitr, stream_itr_type& stream_end, std::ios_base& a_ios, const period_type& p, const duration_type& dur_unit, const facet_type& facet) const { // skip leading whitespace while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } typedef typename period_type::point_type point_type; point_type p1(not_a_date_time), p2(not_a_date_time); consume_delim(sitr, stream_end, delimiters[START]); // start delim facet.get(sitr, stream_end, a_ios, p1); // first point consume_delim(sitr, stream_end, delimiters[SEPARATOR]); // separator facet.get(sitr, stream_end, a_ios, p2); // second point // period construction parameters are always open range [begin, end) if (m_range_option == AS_CLOSED_RANGE) { consume_delim(sitr, stream_end, delimiters[CLOSED_END]);// end delim // add 1 duration unit to p2 to make range open p2 += dur_unit; } else { consume_delim(sitr, stream_end, delimiters[OPEN_END]); // end delim } return period_type(p1, p2); }
last_kday_type get_last_kday_type(stream_itr_type& sitr, stream_itr_type& stream_end, std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } day_of_week_type wd(0); // no default constructor month_type m(1); // no default constructor extract_element(sitr, stream_end, last); // "last" element facet.get(sitr, stream_end, a_ios, wd); // day_of_week extract_element(sitr, stream_end, of); // "of" element facet.get(sitr, stream_end, a_ios, m); // month return last_kday_type(wd, m); }
kday_after_type get_kday_after_type(stream_itr_type& sitr, stream_itr_type& stream_end, std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } day_of_week_type wd(0); // no default constructor facet.get(sitr, stream_end, a_ios, wd); // day_of_week extract_element(sitr, stream_end, after); // "after" element return kday_after_type(wd); }
partial_date_type get_partial_date_type(stream_itr_type& sitr, stream_itr_type& stream_end, std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } day_type d(1); month_type m(1); facet.get(sitr, stream_end, a_ios, d); facet.get(sitr, stream_end, a_ios, m); return partial_date_type(d,m); }