![]() |
Home | Libraries | People | FAQ | More |
boost::date_time::period_formatter — Not a facet, but a class used to specify and control period formats.
// In header: <boost/date_time/period_formatter.hpp> template<typename CharT, typename OutItrT = CharT, CharT> > > class period_formatter { public: // types typedef CharT > ; typedef CharT ; typedef ; typedef CharT > > ; enum range_display_options { AS_OPEN_RANGE, AS_CLOSED_RANGE }; // construct/copy/destruct ( = , const const = , const const = , const const = , const const = ); // public member functions OutItrT (OutItrT &) ; OutItrT (OutItrT &) ; OutItrT (OutItrT &) ; () ; void () ; void (const , const , const , const ); template<typename period_type, typename facet_type> OutItrT (OutItrT, , , const , const facet_type &) ; // public data members static const default_period_separator; static const default_period_start_delimeter; static const default_period_open_range_end_delimeter; static const default_period_closed_range_end_delimeter; };
Provides settings for the following:
period_separator – default '/'
period_open_start_delimeter – default '['
period_open_range_end_delimeter – default ')'
period_closed_range_end_delimeter – default ']'
display_as_open_range, display_as_closed_range – default closed_range
Thus the default formatting for a period is as follows:
[
So for a typical date_period this would be
[
where the date formatting is controlled by the date facet
period_formatter
public member functionsOutItrT (OutItrT & oitr) ;Puts the characters between period elements into stream – default is /.
OutItrT (OutItrT & oitr) ;Puts the period start characters into stream – default is [.
OutItrT (OutItrT & oitr) ;Puts the period end characters into stream as controled by open/closed range setting.
() ;
void ( option) ;Reset the range_option control.
void (const separator, const start_delim, const open_end_delim, const closed_end_delim);Change the delimiter strings.
template<typename period_type, typename facet_type> OutItrT (OutItrT next, a_ios, a_fill, const p, const facet_type & facet) ;Generic code to output a period – no matter the period type.
This generic code will output any period using a facet to to output the 'elements'. For example, in the case of a date_period the elements will be instances of a date which will be formatted according the to setup in the passed facet parameter.
The steps for formatting a period are always the same:
put the start delimiter
put start element
put the separator
put either last or end element depending on range settings
put end delimeter depending on range settings
Thus for a typical date period the result might look like this:
[