![]() |
Home | Libraries | People | FAQ | More |
boost::date_time::date_generator_formatter — Formats date_generators for output.
// In header: <boost/date_time/date_generator_formatter.hpp> template<typename date_type, typename CharT, typename OutItrT = CharT, CharT> > > class date_generator_formatter { public: // types typedef partial_date< ; typedef nth_kday_of_month< ; typedef first_kday_of_month< ; typedef last_kday_of_month< ; typedef first_kday_after< ; typedef first_kday_before< ; typedef CharT ; typedef ; typedef ; enum phrase_elements { first = =0, second, third, fourth, fifth, last, before, after, of, number_of_phrase_elements }; // construct/copy/destruct (); (const , const , const , const , const , const , const , const , const ); // public member functions void (const , = ); template<typename facet_type> OutItrT (OutItrT, , CharT, const partial_date_type &, const facet_type &) ; template<typename facet_type> OutItrT (OutItrT, , CharT, const nth_kday_type &, const facet_type &) ; template<typename facet_type> OutItrT (OutItrT, , CharT, const first_kday_type &, const facet_type &) ; template<typename facet_type> OutItrT (OutItrT, , CharT, const last_kday_type &, const facet_type &) ; template<typename facet_type> OutItrT (OutItrT, , CharT, const kday_before_type &, const facet_type &) ; template<typename facet_type> OutItrT (OutItrT, , CharT, const kday_after_type &, const facet_type &) ; // private member functions OutItrT (OutItrT, const ) ; // public data members static const first_string; static const second_string; static const third_string; static const fourth_string; static const fifth_string; static const last_string; static const before_string; static const after_string; static const of_string; };
Formatting of date_generators follows specific orders for the various types of date_generators.
partial_date => "dd Month"
nth_day_of_the_week_in_month => "nth weekday of month"
first_day_of_the_week_in_month => "first weekday of month"
last_day_of_the_week_in_month => "last weekday of month"
first_day_of_the_week_after => "weekday after"
first_day_of_the_week_before => "weekday before" While the order of the elements in these phrases cannot be changed, the elements themselves can be. Weekday and Month get their formats and names from the date_facet. The remaining elements are stored in the date_generator_formatter and can be customized upon construction or via a member function. The default elements are those shown in the examples above.
date_generator_formatter
public member functionsvoid (const new_strings, beg_pos = );Replace the set of phrase elements with those contained in new_strings.
The order of the strings in the given collection is important. They must follow:
first, second, third, fourth, fifth, last, before, after, of.
It is not necessary to send in a complete set if only a few elements are to be replaced as long as the correct beg_pos is used.
Ex: To keep the default first through fifth elements, but replace the rest with a collection of:
"final", "prior", "following", "in". The beg_pos of date_generator_formatter::last would be used.
template<typename facet_type> OutItrT (OutItrT next, a_ios, CharT a_fill, const partial_date_type & pd, const facet_type & facet) ;Put a
partial_date
=> "dd Month". template<typename facet_type> OutItrT (OutItrT next, a_ios, CharT a_fill, const nth_kday_type & nkd, const facet_type & facet) ;Put an nth_day_of_the_week_in_month => "nth weekday of month".
template<typename facet_type> OutItrT (OutItrT next, a_ios, CharT a_fill, const first_kday_type & fkd, const facet_type & facet) ;Put a first_day_of_the_week_in_month => "first weekday of month".
template<typename facet_type> OutItrT (OutItrT next, a_ios, CharT a_fill, const last_kday_type & lkd, const facet_type & facet) ;Put a last_day_of_the_week_in_month => "last weekday of month".
template<typename facet_type> OutItrT (OutItrT next, a_ios, CharT a_fill, const kday_before_type & fkb, const facet_type & facet) ;Put a first_day_of_the_week_before => "weekday before".
template<typename facet_type> OutItrT (OutItrT next, a_ios, CharT a_fill, const kday_after_type & fka, const facet_type & facet) ;Put a first_day_of_the_week_after => "weekday after".