std::time_get< _CharT, _InIter > Class Template Reference

Facet for parsing dates and times. More...

#include <locale_facets.h>

Inheritance diagram for std::time_get< _CharT, _InIter >:

std::locale::facet std::time_base std::time_get_byname< _CharT, _InIter > List of all members.

Public Types

typedef basic_string< _CharT > __string_type
typedef _CharT char_type
 Public typedefs.
typedef _InIter iter_type

Public Member Functions

 time_get (size_t __refs=0)
 Constructor performs initialization.
dateorder date_order () const
 Return preferred order of month, day, and year.
iter_type get_time (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input time string.
iter_type get_date (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input date string.
iter_type get_weekday (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input weekday string.
iter_type get_monthname (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input month string.
iter_type get_year (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input year string.

Static Public Attributes

static locale::id id
 Numpunct facet id.

Protected Member Functions

virtual ~time_get ()
 Destructor.
virtual dateorder do_date_order () const
 Return preferred order of month, day, and year.
virtual iter_type do_get_time (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input time string.
virtual iter_type do_get_date (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input date string.
virtual iter_type do_get_weekday (iter_type __beg, iter_type __end, ios_base &, ios_base::iostate &__err, tm *__tm) const
 Parse input weekday string.
virtual iter_type do_get_monthname (iter_type __beg, iter_type __end, ios_base &, ios_base::iostate &__err, tm *__tm) const
 Parse input month string.
virtual iter_type do_get_year (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm) const
 Parse input year string.
iter_type _M_extract_num (iter_type __beg, iter_type __end, int &__member, int __min, int __max, size_t __len, ios_base &__io, ios_base::iostate &__err) const
iter_type _M_extract_name (iter_type __beg, iter_type __end, int &__member, const _CharT **__names, size_t __indexlen, ios_base &__io, ios_base::iostate &__err) const
iter_type _M_extract_via_format (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, tm *__tm, const _CharT *__format) const

Detailed Description

template<typename _CharT, typename _InIter>
class std::time_get< _CharT, _InIter >

Facet for parsing dates and times.

This facet encapsulates the code to parse and return a date or time from a string. It is used by the istream numeric extraction operators.

The time_get template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the time_get facet.

Definition at line 3010 of file locale_facets.h.


Member Typedef Documentation

template<typename _CharT, typename _InIter>
typedef basic_string<_CharT> std::time_get< _CharT, _InIter >::__string_type

Definition at line 3019 of file locale_facets.h.

template<typename _CharT, typename _InIter>
typedef _CharT std::time_get< _CharT, _InIter >::char_type

Public typedefs.

Reimplemented in std::time_get_byname< _CharT, _InIter >.

Definition at line 3016 of file locale_facets.h.

template<typename _CharT, typename _InIter>
typedef _InIter std::time_get< _CharT, _InIter >::iter_type

Reimplemented in std::time_get_byname< _CharT, _InIter >.

Definition at line 3017 of file locale_facets.h.


Constructor & Destructor Documentation

template<typename _CharT, typename _InIter>
std::time_get< _CharT, _InIter >::time_get ( size_t  __refs = 0  )  [inline, explicit]

Constructor performs initialization.

This is the constructor provided by the standard.

Parameters:
refs Passed to the base facet class.

Definition at line 3032 of file locale_facets.h.

template<typename _CharT, typename _InIter>
virtual std::time_get< _CharT, _InIter >::~time_get (  )  [inline, protected, virtual]

Destructor.

Definition at line 3188 of file locale_facets.h.


Member Function Documentation

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::_M_extract_name ( iter_type  __beg,
iter_type  __end,
int &  __member,
const _CharT **  __names,
size_t  __indexlen,
ios_base __io,
ios_base::iostate __err 
) const [protected]

Definition at line 2052 of file locale_facets.tcc.

References std::ios_base::_M_getloc(), std::ios_base::failbit, std::min(), and std::__ctype_abstract_base< _CharT >::toupper().

Referenced by std::time_get< _CharT, _InIter >::_M_extract_via_format(), std::time_get< _CharT, _InIter >::do_get_monthname(), and std::time_get< _CharT, _InIter >::do_get_weekday().

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::_M_extract_num ( iter_type  __beg,
iter_type  __end,
int &  __member,
int  __min,
int  __max,
size_t  __len,
ios_base __io,
ios_base::iostate __err 
) const [protected]

Definition at line 2013 of file locale_facets.tcc.

References std::ios_base::_M_getloc(), std::ios_base::failbit, and std::__ctype_abstract_base< _CharT >::narrow().

Referenced by std::time_get< _CharT, _InIter >::_M_extract_via_format().

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::_M_extract_via_format ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm,
const _CharT *  __format 
) const [protected]

Definition at line 1805 of file locale_facets.tcc.

References std::__timepunct< _CharT >::_M_date_formats(), std::__timepunct< _CharT >::_M_date_time_formats(), std::__timepunct< _CharT >::_M_days(), std::__timepunct< _CharT >::_M_days_abbreviated(), std::time_get< _CharT, _InIter >::_M_extract_name(), std::time_get< _CharT, _InIter >::_M_extract_num(), std::ios_base::_M_getloc(), std::__timepunct< _CharT >::_M_months(), std::__timepunct< _CharT >::_M_months_abbreviated(), std::__timepunct< _CharT >::_M_time_formats(), std::ios_base::failbit, ctype_base::space, and ctype_base::upper.

Referenced by std::time_get< _CharT, _InIter >::do_get_date(), and std::time_get< _CharT, _InIter >::do_get_time().

template<typename _CharT, typename _InIter>
dateorder std::time_get< _CharT, _InIter >::date_order (  )  const [inline]

Return preferred order of month, day, and year.

This function returns an enum from timebase::dateorder giving the preferred ordering if the format "x" given to time_put::put() only uses month, day, and year. If the format "x" for the associated locale uses other fields, this function returns timebase::dateorder::noorder.

NOTE: The library always returns noorder at the moment.

Returns:
A member of timebase::dateorder.

Definition at line 3049 of file locale_facets.h.

References std::time_get< _CharT, _InIter >::do_date_order().

template<typename _CharT, typename _InIter>
_GLIBCXX_END_LDBL_NAMESPACE time_base::dateorder std::time_get< _CharT, _InIter >::do_date_order (  )  const [protected, virtual]

Return preferred order of month, day, and year.

This function returns an enum from timebase::dateorder giving the preferred ordering if the format "x" given to time_put::put() only uses month, day, and year. This function is a hook for derived classes to change the value returned.

Returns:
A member of timebase::dateorder.

Definition at line 1797 of file locale_facets.tcc.

References std::time_base::no_order.

Referenced by std::time_get< _CharT, _InIter >::date_order().

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::do_get_date ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [protected, virtual]

Parse input date string.

This function parses a date according to the format "X" and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also:
get_date() for details.
Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond date string.

Definition at line 2142 of file locale_facets.tcc.

References std::__timepunct< _CharT >::_M_date_formats(), std::time_get< _CharT, _InIter >::_M_extract_via_format(), std::ios_base::_M_getloc(), and std::ios_base::eofbit.

Referenced by std::time_get< _CharT, _InIter >::get_date().

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::do_get_monthname ( iter_type  __beg,
iter_type  __end,
ios_base ,
ios_base::iostate __err,
tm *  __tm 
) const [protected, virtual]

Parse input month string.

This function parses a month name and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also:
get_monthname() for details.
Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond month name.

Definition at line 2204 of file locale_facets.tcc.

References std::time_get< _CharT, _InIter >::_M_extract_name(), std::ios_base::_M_getloc(), std::__timepunct< _CharT >::_M_months(), std::__timepunct< _CharT >::_M_months_abbreviated(), std::ios_base::eofbit, and std::ios_base::failbit.

Referenced by std::time_get< _CharT, _InIter >::get_monthname().

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::do_get_time ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [protected, virtual]

Parse input time string.

This function parses a time according to the format "x" and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also:
get_time() for details.
Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond time string.

Definition at line 2125 of file locale_facets.tcc.

References std::time_get< _CharT, _InIter >::_M_extract_via_format(), std::ios_base::_M_getloc(), std::__timepunct< _CharT >::_M_time_formats(), and std::ios_base::eofbit.

Referenced by std::time_get< _CharT, _InIter >::get_time().

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::do_get_weekday ( iter_type  __beg,
iter_type  __end,
ios_base ,
ios_base::iostate __err,
tm *  __tm 
) const [protected, virtual]

Parse input weekday string.

This function parses a weekday name and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also:
get_weekday() for details.
Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond weekday name.

Definition at line 2159 of file locale_facets.tcc.

References std::__timepunct< _CharT >::_M_days(), std::__timepunct< _CharT >::_M_days_abbreviated(), std::time_get< _CharT, _InIter >::_M_extract_name(), std::ios_base::_M_getloc(), std::ios_base::eofbit, and std::ios_base::failbit.

Referenced by std::time_get< _CharT, _InIter >::get_weekday().

template<typename _CharT, typename _InIter>
_InIter std::time_get< _CharT, _InIter >::do_get_year ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [protected, virtual]

Parse input year string.

This function reads up to 4 characters to parse a year string and puts the results into a user-supplied struct tm. This function is a hook for derived classes to change the value returned.

See also:
get_year() for details.
Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond year.

Definition at line 2250 of file locale_facets.tcc.

References std::ios_base::_M_getloc(), std::ios_base::eofbit, std::ios_base::failbit, and std::__ctype_abstract_base< _CharT >::narrow().

Referenced by std::time_get< _CharT, _InIter >::get_year().

template<typename _CharT, typename _InIter>
iter_type std::time_get< _CharT, _InIter >::get_date ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [inline]

Parse input date string.

This function parses a date according to the format "X" and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_date().

If there is a valid date string according to format "X", tm will be filled in accordingly and the returned iterator will point to the first character beyond the date string. If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond date string.

Definition at line 3098 of file locale_facets.h.

References std::time_get< _CharT, _InIter >::do_get_date().

template<typename _CharT, typename _InIter>
iter_type std::time_get< _CharT, _InIter >::get_monthname ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [inline]

Parse input month string.

This function parses a month name and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_monthname().

Parsing starts by parsing an abbreviated month name. If a valid abbreviation is followed by a character that would lead to the full month name, parsing continues until the full name is found or an error occurs. Otherwise parsing finishes at the end of the abbreviated name.

If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond month name.

Definition at line 3155 of file locale_facets.h.

References std::time_get< _CharT, _InIter >::do_get_monthname().

template<typename _CharT, typename _InIter>
iter_type std::time_get< _CharT, _InIter >::get_time ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [inline]

Parse input time string.

This function parses a time according to the format "x" and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_time().

If there is a valid time string according to format "x", tm will be filled in accordingly and the returned iterator will point to the first character beyond the time string. If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond time string.

Definition at line 3073 of file locale_facets.h.

References std::time_get< _CharT, _InIter >::do_get_time().

template<typename _CharT, typename _InIter>
iter_type std::time_get< _CharT, _InIter >::get_weekday ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [inline]

Parse input weekday string.

This function parses a weekday name and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_weekday().

Parsing starts by parsing an abbreviated weekday name. If a valid abbreviation is followed by a character that would lead to the full weekday name, parsing continues until the full name is found or an error occurs. Otherwise parsing finishes at the end of the abbreviated name.

If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond weekday name.

Definition at line 3126 of file locale_facets.h.

References std::time_get< _CharT, _InIter >::do_get_weekday().

template<typename _CharT, typename _InIter>
iter_type std::time_get< _CharT, _InIter >::get_year ( iter_type  __beg,
iter_type  __end,
ios_base __io,
ios_base::iostate __err,
tm *  __tm 
) const [inline]

Parse input year string.

This function reads up to 4 characters to parse a year string and puts the results into a user-supplied struct tm. The result is returned by calling time_get::do_get_year().

4 consecutive digits are interpreted as a full year. If there are exactly 2 consecutive digits, the library interprets this as the number of years since 1900.

If an error occurs before the end, err |= ios_base::failbit. If parsing reads all the characters, err |= ios_base::eofbit.

Parameters:
beg Start of string to parse.
end End of string to parse.
io Source of the locale.
err Error flags to set.
tm Pointer to struct tm to fill in.
Returns:
Iterator to first char beyond year.

Definition at line 3181 of file locale_facets.h.

References std::time_get< _CharT, _InIter >::do_get_year().


Member Data Documentation

template<typename _CharT, typename _InIter>
locale::id std::time_get< _CharT, _InIter >::id [static]

Numpunct facet id.

Definition at line 3022 of file locale_facets.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 16:59:01 2010 for GNU C++ STL by  doxygen 1.4.7