Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::date_time::date_generator_formatter< date_type, CharT, OutItrT > Class Template Reference

Formats date_generators for output. More...

#include <date_generator_formatter.hpp>

Inheritance diagram for boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >:

Public Types

enum  phrase_elements {
  first =0,
  second,
  third,
  fourth,
  fifth,
  last,
  before,
  after,
  of,
  number_of_phrase_elements
}
 
typedef partial_date< date_type > partial_date_type
 
typedef nth_kday_of_month
< date_type > 
nth_kday_type
 
typedef first_kday_of_month
< date_type > 
first_kday_type
 
typedef last_kday_of_month
< date_type > 
last_kday_type
 
typedef first_kday_after
< date_type > 
kday_after_type
 
typedef first_kday_before
< date_type > 
kday_before_type
 
typedef CharT char_type
 
typedef std::basic_string
< char_type
string_type
 
typedef std::vector< string_typecollection_type
 

Public Member Functions

 date_generator_formatter ()
 Default format elements used. More...
 
 date_generator_formatter (const string_type &first_str, const string_type &second_str, const string_type &third_str, const string_type &fourth_str, const string_type &fifth_str, const string_type &last_str, const string_type &before_str, const string_type &after_str, const string_type &of_str)
 Constructor that allows for a custom set of phrase elements. More...
 
void elements (const collection_type &new_strings, phrase_elements beg_pos=first)
 Replace the set of phrase elements with those contained in new_strings. More...
 
template<class facet_type >
OutItrT put_partial_date (OutItrT next, std::ios_base &a_ios, CharT a_fill, const partial_date_type &pd, const facet_type &facet) const
 Put a partial_date => "dd Month". More...
 
template<class facet_type >
OutItrT put_nth_kday (OutItrT next, std::ios_base &a_ios, CharT a_fill, const nth_kday_type &nkd, const facet_type &facet) const
 Put an nth_day_of_the_week_in_month => "nth weekday of month". More...
 
template<class facet_type >
OutItrT put_first_kday (OutItrT next, std::ios_base &a_ios, CharT a_fill, const first_kday_type &fkd, const facet_type &facet) const
 Put a first_day_of_the_week_in_month => "first weekday of month". More...
 
template<class facet_type >
OutItrT put_last_kday (OutItrT next, std::ios_base &a_ios, CharT a_fill, const last_kday_type &lkd, const facet_type &facet) const
 Put a last_day_of_the_week_in_month => "last weekday of month". More...
 
template<class facet_type >
OutItrT put_kday_before (OutItrT next, std::ios_base &a_ios, CharT a_fill, const kday_before_type &fkb, const facet_type &facet) const
 Put a first_day_of_the_week_before => "weekday before". More...
 
template<class facet_type >
OutItrT put_kday_after (OutItrT next, std::ios_base &a_ios, CharT a_fill, const kday_after_type &fka, const facet_type &facet) const
 Put a first_day_of_the_week_after => "weekday after". More...
 

Static Public Attributes

static const char_type first_string [6]
 
static const char_type second_string [7]
 
static const char_type third_string [6]
 
static const char_type fourth_string [7]
 
static const char_type fifth_string [6]
 
static const char_type last_string [5]
 
static const char_type before_string [8]
 
static const char_type after_string [6]
 
static const char_type of_string [3]
 

Detailed Description

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
class boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >

Formats date_generators for output.

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.

Member Typedef Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef CharT boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::char_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef std::vector<string_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::collection_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef first_kday_of_month<date_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::first_kday_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef first_kday_after<date_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::kday_after_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef first_kday_before<date_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::kday_before_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef last_kday_of_month<date_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::last_kday_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef nth_kday_of_month<date_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::nth_kday_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef partial_date<date_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::partial_date_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef std::basic_string<char_type> boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::string_type

Member Enumeration Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
enum boost::date_time::date_generator_formatter::phrase_elements
Enumerator
first 
second 
third 
fourth 
fifth 
last 
before 
after 
of 
number_of_phrase_elements 

Constructor & Destructor Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::date_generator_formatter ( )
inline

Default format elements used.

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::date_generator_formatter ( const string_type first_str,
const string_type second_str,
const string_type third_str,
const string_type fourth_str,
const string_type fifth_str,
const string_type last_str,
const string_type before_str,
const string_type after_str,
const string_type of_str 
)
inline

Constructor that allows for a custom set of phrase elements.

Member Function Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::elements ( const collection_type new_strings,
phrase_elements  beg_pos = first 
)
inline

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:

Referenced by boost::date_time::date_facet< time_type::date_type, CharT, OutItrT >::date_gen_phrase_strings().

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
template<class facet_type >
OutItrT boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::put_first_kday ( OutItrT  next,
std::ios_base &  a_ios,
CharT  a_fill,
const first_kday_type fkd,
const facet_type &  facet 
) const
inline

Put a first_day_of_the_week_in_month => "first weekday of month".

Referenced by boost::date_time::date_facet< time_type::date_type, CharT, OutItrT >::put().

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
template<class facet_type >
OutItrT boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::put_kday_after ( OutItrT  next,
std::ios_base &  a_ios,
CharT  a_fill,
const kday_after_type fka,
const facet_type &  facet 
) const
inline

Put a first_day_of_the_week_after => "weekday after".

Referenced by boost::date_time::date_facet< time_type::date_type, CharT, OutItrT >::put().

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
template<class facet_type >
OutItrT boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::put_kday_before ( OutItrT  next,
std::ios_base &  a_ios,
CharT  a_fill,
const kday_before_type fkb,
const facet_type &  facet 
) const
inline

Put a first_day_of_the_week_before => "weekday before".

Referenced by boost::date_time::date_facet< time_type::date_type, CharT, OutItrT >::put().

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
template<class facet_type >
OutItrT boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::put_last_kday ( OutItrT  next,
std::ios_base &  a_ios,
CharT  a_fill,
const last_kday_type lkd,
const facet_type &  facet 
) const
inline

Put a last_day_of_the_week_in_month => "last weekday of month".

Referenced by boost::date_time::date_facet< time_type::date_type, CharT, OutItrT >::put().

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
template<class facet_type >
OutItrT boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::put_nth_kday ( OutItrT  next,
std::ios_base &  a_ios,
CharT  a_fill,
const nth_kday_type nkd,
const facet_type &  facet 
) const
inline

Put an nth_day_of_the_week_in_month => "nth weekday of month".

Referenced by boost::date_time::date_facet< time_type::date_type, CharT, OutItrT >::put().

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
template<class facet_type >
OutItrT boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::put_partial_date ( OutItrT  next,
std::ios_base &  a_ios,
CharT  a_fill,
const partial_date_type pd,
const facet_type &  facet 
) const
inline

Member Data Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::after_string
static
Initial value:
=
{'a','f','t','e','r'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::before_string
static
Initial value:
=
{'b','e','f','o','r','e'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::fifth_string
static
Initial value:
=
{'f','i','f','t','h'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::first_string
static
Initial value:
=
{'f','i','r','s','t'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::fourth_string
static
Initial value:
=
{'f','o','u','r','t','h'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::last_string
static
Initial value:
=
{'l','a','s','t'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::of_string
static
Initial value:
=
{'o','f'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::second_string
static
Initial value:
=
{'s','e','c','o','n','d'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_generator_formatter< date_type, CharT, OutItrT >::char_type boost::date_time::date_generator_formatter< date_type, CharT, OutItrT >::third_string
static
Initial value:
=
{'t','h','i','r','d'}

The documentation for this class was generated from the following file: