Time_get Virtual Functions

The facet time_get has 6 protected virtual members:

The method do_date_order returns no_order. This result can be changed via derivation.

  iter_type do_get_time(iter_type s, iter_type end,
  ios_base& str, ios_base::iostate& err, 
  tm* t) const;
  

The method do_get_time parses time with the format:

  "%H:%M:%S"
  iter_type do_get_date
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;
  

The method do_get_date parses a date with the format:

  "%A %B %d %T %Y"
  

This format string can be changed via the named locale facility, or by derivation.

  iter_type do_get_weekday
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;
  

The method do_get_weekday parses with the format:

  "%A"
  

Although the format string can only be changed by derivation, the names of the weekdays themselves can be changed via the named locale facility or by derivation.

  iter_type do_get_monthname
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;
  

The method do_get_monthname parses with the format:

  "%B"
  

Although the format string can only be changed by derivation, the names of the months themselves can be changed via the named locale facility or by derivation.

  iter_type do_get_year
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;
  

The method do_get_year parses a year with the format:

  "%Y"
  

This behavior can only be changed by derivation.

The details of what these formats mean can be found in the Format/Parsing Table .

In addition to the above mentioned protected methods, EWL C++ provides a non-standard, non-virtual protected method:

  iter_type __do_parse(iter_type in, iter_type end,
  ios_base& str, ios_base::iostate& err, 
  const basic_string<charT>& pattern, tm* t) const;
  

This method takes the parameters typical of the standard methods, but adds the pattern parameter of type basic_string. The pattern is a general string governed by the rules outlined in the section Format Parsing . Derived classes can make use of this method to parse patterns not offered by time_get.

Listing: Derived classes example:
template <class charT, class InputIterator>
typename my_time_get<charT, InputIterator>::iter_type

  my_time_get<charT, InputIterator>::do_get_date_time(

    iter_type in, iter_type end,std::ios_base& str,

    std::ios_base::iostate& err, std::tm* t) const

{

  const std::ctype<charT>& ct = std::use_facet<std::ctype<charT>> 
    (str.getloc());

  return __do_parse(in, end, str, err, ct.widen("%c"), t);

}