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_facet< date_type, CharT, OutItrT > Class Template Reference

Class that provides format based I/O facet for date types. More...

#include <date_facet.hpp>

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

Public Types

typedef date_type::duration_type duration_type
 
typedef date_type::day_of_week_type day_of_week_type
 
typedef date_type::day_type day_type
 
typedef date_type::month_type month_type
 
typedef
boost::date_time::period
< date_type, duration_type
period_type
 
typedef std::basic_string< CharT > string_type
 
typedef CharT char_type
 
typedef
boost::date_time::period_formatter
< CharT > 
period_formatter_type
 
typedef
boost::date_time::special_values_formatter
< CharT > 
special_values_formatter_type
 
typedef std::vector
< std::basic_string< CharT > > 
input_collection_type
 
typedef
date_generator_formatter
< date_type, CharT > 
date_gen_formatter_type
 
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
 

Public Member Functions

 date_facet (::size_t a_ref=0)
 
 date_facet (const char_type *format_str, const input_collection_type &short_names,::size_t ref_count=0)
 
 date_facet (const char_type *format_str, period_formatter_type per_formatter=period_formatter_type(), special_values_formatter_type sv_formatter=special_values_formatter_type(), date_gen_formatter_type dg_formatter=date_gen_formatter_type(),::size_t ref_count=0)
 
void format (const char_type *const format_str)
 
virtual void set_iso_format ()
 
virtual void set_iso_extended_format ()
 
void month_format (const char_type *const format_str)
 
void weekday_format (const char_type *const format_str)
 
void period_formatter (period_formatter_type per_formatter)
 
void special_values_formatter (const special_values_formatter_type &svf)
 
void short_weekday_names (const input_collection_type &short_names)
 
void long_weekday_names (const input_collection_type &long_names)
 
void short_month_names (const input_collection_type &short_names)
 
void long_month_names (const input_collection_type &long_names)
 
void date_gen_phrase_strings (const input_collection_type &new_strings, typename date_gen_formatter_type::phrase_elements beg_pos=date_gen_formatter_type::first)
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const date_type &d) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const duration_type &dd) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const month_type &m) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const day_type &day) const
 puts the day of month More...
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const day_of_week_type &dow) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const period_type &p) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const partial_date_type &pd) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const nth_kday_type &nkd) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const first_kday_type &fkd) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const last_kday_type &lkd) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const kday_before_type &fkb) const
 
OutItrT put (OutItrT next, std::ios_base &a_ios, char_type fill_char, const kday_after_type &fka) const
 

Static Public Attributes

static const char_type long_weekday_format [3] = {'%','A'}
 
static const char_type short_weekday_format [3] = {'%','a'}
 
static const char_type long_month_format [3] = {'%','B'}
 
static const char_type short_month_format [3] = {'%','b'}
 
static const char_type default_period_separator [4] = { ' ', '/', ' '}
 
static const char_type standard_format_specifier [3]
 
static const char_type iso_format_specifier [7]
 
static const char_type iso_format_extended_specifier [9]
 
static const char_type default_date_format [9]
 
static std::locale::id id
 

Protected Member Functions

virtual OutItrT do_put_special (OutItrT next, std::ios_base &, char_type, const boost::date_time::special_values sv) const
 
virtual OutItrT do_put_tm (OutItrT next, std::ios_base &a_ios, char_type fill_char, const tm &tm_value, string_type a_format) const
 

Protected Attributes

string_type m_format
 
string_type m_month_format
 
string_type m_weekday_format
 
period_formatter_type m_period_formatter
 
date_gen_formatter_type m_date_gen_formatter
 
special_values_formatter_type m_special_values_formatter
 
input_collection_type m_month_short_names
 
input_collection_type m_month_long_names
 
input_collection_type m_weekday_short_names
 
input_collection_type m_weekday_long_names
 

Detailed Description

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

Class that provides format based I/O facet for date types.

This class allows the formatting of dates by using format string. Format strings are:

  • A => long_weekday_format - Full name Ex: Tuesday
  • a => short_weekday_format - Three letter abbreviation Ex: Tue
  • B => long_month_format - Full name Ex: October
  • b => short_month_format - Three letter abbreviation Ex: Oct
  • x => standard_format_specifier - defined by the locale
  • Y-b-d => default_date_format - YYYY-Mon-dd

Default month format == b Default weekday format == a

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_facet< date_type, CharT, OutItrT >::char_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef date_generator_formatter<date_type, CharT> boost::date_time::date_facet< date_type, CharT, OutItrT >::date_gen_formatter_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef date_type::day_of_week_type boost::date_time::date_facet< date_type, CharT, OutItrT >::day_of_week_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef date_type::day_type boost::date_time::date_facet< date_type, CharT, OutItrT >::day_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef date_type::duration_type boost::date_time::date_facet< date_type, CharT, OutItrT >::duration_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_facet< date_type, CharT, OutItrT >::first_kday_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef std::vector<std::basic_string<CharT> > boost::date_time::date_facet< date_type, CharT, OutItrT >::input_collection_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_facet< 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_facet< 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_facet< date_type, CharT, OutItrT >::last_kday_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef date_type::month_type boost::date_time::date_facet< date_type, CharT, OutItrT >::month_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_facet< 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_facet< date_type, CharT, OutItrT >::partial_date_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef boost::date_time::period_formatter<CharT> boost::date_time::date_facet< date_type, CharT, OutItrT >::period_formatter_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef boost::date_time::period<date_type,duration_type> boost::date_time::date_facet< date_type, CharT, OutItrT >::period_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef boost::date_time::special_values_formatter<CharT> boost::date_time::date_facet< date_type, CharT, OutItrT >::special_values_formatter_type
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
typedef std::basic_string<CharT> boost::date_time::date_facet< date_type, CharT, OutItrT >::string_type

Constructor & Destructor Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
boost::date_time::date_facet< date_type, CharT, OutItrT >::date_facet ( ::size_t  a_ref = 0)
inlineexplicit
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
boost::date_time::date_facet< date_type, CharT, OutItrT >::date_facet ( const char_type format_str,
const input_collection_type short_names,
::size_t  ref_count = 0 
)
inlineexplicit
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
boost::date_time::date_facet< date_type, CharT, OutItrT >::date_facet ( const char_type format_str,
period_formatter_type  per_formatter = period_formatter_type(),
special_values_formatter_type  sv_formatter = special_values_formatter_type(),
date_gen_formatter_type  dg_formatter = date_gen_formatter_type(),
::size_t  ref_count = 0 
)
inlineexplicit

Member Function Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::date_gen_phrase_strings ( const input_collection_type new_strings,
typename date_gen_formatter_type::phrase_elements  beg_pos = date_gen_formatter_type::first 
)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
virtual OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::do_put_special ( OutItrT  next,
std::ios_base &  ,
char_type  ,
const boost::date_time::special_values  sv 
) const
inlineprotectedvirtual
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
virtual OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::do_put_tm ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const tm &  tm_value,
string_type  a_format 
) const
inlineprotectedvirtual
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::format ( const char_type *const  format_str)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::long_month_names ( const input_collection_type long_names)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::long_weekday_names ( const input_collection_type long_names)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::month_format ( const char_type *const  format_str)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::period_formatter ( period_formatter_type  per_formatter)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const date_type &  d 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const duration_type dd 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const month_type m 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const day_type day 
) const
inline

puts the day of month

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const day_of_week_type dow 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const period_type p 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const partial_date_type pd 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const nth_kday_type nkd 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const first_kday_type fkd 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const last_kday_type lkd 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const kday_before_type fkb 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
OutItrT boost::date_time::date_facet< date_type, CharT, OutItrT >::put ( OutItrT  next,
std::ios_base &  a_ios,
char_type  fill_char,
const kday_after_type fka 
) const
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
virtual void boost::date_time::date_facet< date_type, CharT, OutItrT >::set_iso_extended_format ( )
inlinevirtual
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
virtual void boost::date_time::date_facet< date_type, CharT, OutItrT >::set_iso_format ( )
inlinevirtual
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::short_month_names ( const input_collection_type short_names)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::short_weekday_names ( const input_collection_type short_names)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::special_values_formatter ( const special_values_formatter_type svf)
inline
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
void boost::date_time::date_facet< date_type, CharT, OutItrT >::weekday_format ( const char_type *const  format_str)
inline

Member Data Documentation

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::default_date_format
static
Initial value:
=
{'%','Y','-','%','b','-','%','d'}
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::default_period_separator = { ' ', '/', ' '}
static
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
std::locale::id boost::date_time::date_facet< date_type, CharT, OutItrT >::id
static
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::iso_format_extended_specifier
static
Initial value:
=
{'%', 'Y', '-', '%', 'm', '-', '%', 'd' }

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

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::iso_format_specifier
static
Initial value:
=
{'%', 'Y', '%', 'm', '%', 'd' }

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

template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::long_month_format = {'%','B'}
static
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::long_weekday_format = {'%','A'}
static
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
date_gen_formatter_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_date_gen_formatter
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
string_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_month_format
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
input_collection_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_month_long_names
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
input_collection_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_month_short_names
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
period_formatter_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_period_formatter
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
special_values_formatter_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_special_values_formatter
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
string_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_weekday_format
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
input_collection_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_weekday_long_names
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
input_collection_type boost::date_time::date_facet< date_type, CharT, OutItrT >::m_weekday_short_names
protected
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::short_month_format = {'%','b'}
static
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::short_weekday_format = {'%','a'}
static
template<class date_type, class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> >>
const date_facet< date_type, CharT, OutItrT >::char_type boost::date_time::date_facet< date_type, CharT, OutItrT >::standard_format_specifier
static
Initial value:
=
{'%', 'x' }

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