...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::date_time::time_input_facet — Facet for format-based input.
// In header: <boost/date_time/time_facet.hpp> template<typename time_type, typename CharT, typename InItrT = std::istreambuf_iterator<CharT, std::char_traits<CharT> > > class time_input_facet : public boost::date_time::date_input_facet< time_type::date_type, CharT, InItrT > { public: // types typedef time_type::date_type date_type; typedef time_type::time_duration_type time_duration_type; typedef time_duration_type::fractional_seconds_type fracional_seconds_type; typedef boost::date_time::period< time_type, time_duration_type > period_type; typedef boost::date_time::date_input_facet< typename time_type::date_type, CharT, InItrT > base_type; typedef base_type::duration_type date_duration_type; typedef base_type::year_type year_type; typedef base_type::month_type month_type; typedef base_type::day_type day_type; typedef base_type::string_type string_type; typedef string_type::const_iterator const_itr; typedef base_type::char_type char_type; typedef base_type::format_date_parser_type format_date_parser_type; typedef base_type::period_parser_type period_parser_type; typedef base_type::special_values_parser_type special_values_parser_type; typedef base_type::date_gen_parser_type date_gen_parser_type; typedef base_type::special_values_parser_type::match_results match_results; // construct/copy/destruct time_input_facet(const string_type &, ::size_t = 0); time_input_facet(const string_type &, const format_date_parser_type &, const special_values_parser_type &, const period_parser_type &, const date_gen_parser_type &, ::size_t = 0); time_input_facet(::size_t = 0); // public member functions void time_duration_format(const char_type *const ) ; void set_iso_format() ; void set_iso_extended_format() ; InItrT get(InItrT &, InItrT &, std::ios_base &, period_type &) const; InItrT get(InItrT &, InItrT &, std::ios_base &, time_duration_type &) const; InItrT get(InItrT &, InItrT &, std::ios_base &, time_type &) const; InItrT get_local_time(InItrT &, InItrT &, std::ios_base &, time_type &, string_type &) const; // protected member functions InItrT get(InItrT &, InItrT &, std::ios_base &, time_type &, string_type &, bool) const; template<typename temporal_type> InItrT check_special_value(InItrT &, InItrT &, temporal_type &, char_type = '\0') const; void parse_frac_type(InItrT &, InItrT &, fracional_seconds_type &) const; // private member functions template<typename int_type> int_type decimal_adjust(int_type, const unsigned short) const; static const char_type * fractional_seconds_format; static const char_type * fractional_seconds_or_none_format; static const char_type * seconds_with_fractional_seconds_format; static const char_type * seconds_format; static const char_type * standard_format; static const char_type * zone_abbrev_format; static const char_type * zone_name_format; static const char_type * zone_iso_format; static const char_type * zone_iso_extended_format; static const char_type * duration_seperator; static const char_type * iso_time_format_specifier; static const char_type * iso_time_format_extended_specifier; static const char_type * default_time_input_format; static const char_type * default_time_duration_format; static std::locale::id id; };
time_input_facet
public
construct/copy/destructtime_input_facet(const string_type & format, ::size_t a_ref = 0);Constructor that takes a format string for a ptime.
time_input_facet(const string_type & format, const format_date_parser_type & date_parser, const special_values_parser_type & sv_parser, const period_parser_type & per_parser, const date_gen_parser_type & date_gen_parser, ::size_t a_ref = 0);
time_input_facet(::size_t a_ref = 0);sets default formats for ptime, local_date_time, and time_duration
time_input_facet
public member functionsvoid time_duration_format(const char_type *const format) ;Set the format for time_duration.
void set_iso_format() ;
void set_iso_extended_format() ;
InItrT get(InItrT & sitr, InItrT & stream_end, std::ios_base & a_ios, period_type & p) const;
InItrT get(InItrT & sitr, InItrT & stream_end, std::ios_base & a_ios, time_duration_type & td) const;
InItrT get(InItrT & sitr, InItrT & stream_end, std::ios_base & a_ios, time_type & t) const;Parses a time object from the input stream.
InItrT get_local_time(InItrT & sitr, InItrT & stream_end, std::ios_base & a_ios, time_type & t, string_type & tz_str) const;Expects a time_zone in the input stream.
time_input_facet
protected member functionsInItrT get(InItrT & sitr, InItrT & stream_end, std::ios_base & a_ios, time_type & t, string_type & tz_str, bool time_is_local) const;
template<typename temporal_type> InItrT check_special_value(InItrT & sitr, InItrT & stream_end, temporal_type & tt, char_type c = '\0') const;Helper function to check for special_value.
First character may have been consumed during original parse attempt. Parameter 'c' should be a copy of that character. Throws ios_base::failure if parse fails.
void parse_frac_type(InItrT & sitr, InItrT & stream_end, fracional_seconds_type & frac) const;Helper function for parsing a fractional second type from the stream.