STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
time_get< _Elem, _InIt > Class Template Reference
Inheritance diagram for time_get< _Elem, _InIt >:
time_base locale::facet _Facet_base _Crt_new_delete time_get_byname< _Elem, _InIt >

Public Types

typedef _Elem char_type
 
typedef _InIt iter_type
 
typedef ctype< _Elem > _Ctype
 
- Public Types inherited from time_base
enum  dateorder {
  no_order, dmy, mdy, ymd,
  ydm
}
 

Public Member Functions

dateorder __CLR_OR_THIS_CALL date_order () const
 
_InIt __CLR_OR_THIS_CALL get_time (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
_InIt __CLR_OR_THIS_CALL get_date (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
_InIt __CLR_OR_THIS_CALL get_weekday (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
_InIt __CLR_OR_THIS_CALL get_monthname (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
_InIt __CLR_OR_THIS_CALL get_year (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
_InIt __CLR_OR_THIS_CALL get (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, char _Specifier, char _Modifier= '\0') const
 
_InIt __CLR_OR_THIS_CALL get (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, const _Elem *_Fmtfirst, const _Elem *_Fmtlast) const
 
__CLR_OR_THIS_CALL time_get (size_t _Refs=0)
 
__CLR_OR_THIS_CALL time_get (const _Locinfo &_Lobj, size_t _Refs=0)
 
- Public Member Functions inherited from time_base
__CLR_OR_THIS_CALL time_base (size_t _Refs=0)
 
__CLR_OR_THIS_CALL ~time_base () _NOEXCEPT
 
- Public Member Functions inherited from locale::facet
virtual void __CLR_OR_THIS_CALL _Incref ()
 
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref ()
 
__CLR_OR_THIS_CALL facet (const facet &)=delete
 
facet &__CLR_OR_THIS_CALL operator= (const facet &)=delete
 
- Public Member Functions inherited from _Facet_base
virtual __CLR_OR_THIS_CALL ~_Facet_base () _NOEXCEPT
 

Static Public Member Functions

static size_t __CLRCALL_OR_CDECL _Getcat (const locale::facet **_Ppf=0, const locale *_Ploc=0)
 
- Static Public Member Functions inherited from locale::facet
static size_t __CLRCALL_OR_CDECL _Getcat (const facet **=0, const locale *=0)
 

Static Public Attributes

static __PURE_APPDOMAIN_GLOBAL locale::id id
 

Protected Member Functions

virtual __CLR_OR_THIS_CALL ~time_get () _NOEXCEPT
 
__CLR_OR_THIS_CALL time_get (const char *_Locname, size_t _Refs=0)
 
template<class _Elem2 >
void _Getvals (_Elem2, const _Locinfo &_Lobj)
 
template<>
void _Getvals (wchar_t, const _Locinfo &_Lobj)
 
void __CLR_OR_THIS_CALL _Init (const _Locinfo &_Lobj)
 
virtual dateorder __CLR_OR_THIS_CALL do_date_order () const
 
virtual _InIt __CLR_OR_THIS_CALL do_get_time (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
virtual _InIt __CLR_OR_THIS_CALL do_get_date (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
virtual _InIt __CLR_OR_THIS_CALL do_get_weekday (_InIt _First, _InIt _Last, ios_base &, ios_base::iostate &_State, tm *_Pt) const
 
virtual _InIt __CLR_OR_THIS_CALL do_get_monthname (_InIt _First, _InIt _Last, ios_base &, ios_base::iostate &_State, tm *_Pt) const
 
virtual _InIt __CLR_OR_THIS_CALL do_get_year (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
 
virtual _InIt __CLR_OR_THIS_CALL do_get (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, char _Specifier, char=0) const
 
_InIt __CLR_OR_THIS_CALL _Getfmt (_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, const char *_Fmtfirst) const
 
- Protected Member Functions inherited from locale::facet
__CLR_OR_THIS_CALL facet (size_t _Initrefs=0)
 
virtual __CLR_OR_THIS_CALL ~facet () _NOEXCEPT
 

Private Member Functions

ios_base::iostate __CLRCALL_OR_CDECL _Getint (_InIt &_First, _InIt &_Last, int _Lo, int _Hi, int &_Val, const _Ctype &_Ctype_fac) const
 
void __CLR_OR_THIS_CALL _Tidy ()
 

Private Attributes

const _Elem * _Days
 
const _Elem * _Months
 
const _Elem * _Ampm
 
dateorder _Dateorder
 
_Locinfo::_Cvtvec _Cvt
 

Member Typedef Documentation

template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
typedef ctype<_Elem> time_get< _Elem, _InIt >::_Ctype
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
typedef _Elem time_get< _Elem, _InIt >::char_type
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
typedef _InIt time_get< _Elem, _InIt >::iter_type

Constructor & Destructor Documentation

template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
__CLR_OR_THIS_CALL time_get< _Elem, _InIt >::time_get ( size_t  _Refs = 0)
inlineexplicit
161  : time_base(_Refs)
162  { // construct from current locale
163  _BEGIN_LOCINFO(_Lobj)
164  _Init(_Lobj);
165  _END_LOCINFO()
166  }
__CLR_OR_THIS_CALL time_base(size_t _Refs=0)
Definition: xloctime:25
void __CLR_OR_THIS_CALL _Init(const _Locinfo &_Lobj)
Definition: xloctime:217
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
__CLR_OR_THIS_CALL time_get< _Elem, _InIt >::time_get ( const _Locinfo _Lobj,
size_t  _Refs = 0 
)
inline
169  : time_base(_Refs)
170  { // construct from specified locale
171  _Init(_Lobj);
172  }
__CLR_OR_THIS_CALL time_base(size_t _Refs=0)
Definition: xloctime:25
void __CLR_OR_THIS_CALL _Init(const _Locinfo &_Lobj)
Definition: xloctime:217
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::~time_get ( )
inlineprotectedvirtual
185  { // destroy the object
186  _Tidy();
187  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: xloctime:640
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
__CLR_OR_THIS_CALL time_get< _Elem, _InIt >::time_get ( const char *  _Locname,
size_t  _Refs = 0 
)
inlineprotected
190  : time_base(_Refs)
191  { // construct from specified locale
192  _BEGIN_LOCINFO(_Lobj(_Locname))
193  _Init(_Lobj);
194  _END_LOCINFO()
195  }
__CLR_OR_THIS_CALL time_base(size_t _Refs=0)
Definition: xloctime:25
void __CLR_OR_THIS_CALL _Init(const _Locinfo &_Lobj)
Definition: xloctime:217

Member Function Documentation

template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
static size_t __CLRCALL_OR_CDECL time_get< _Elem, _InIt >::_Getcat ( const locale::facet **  _Ppf = 0,
const locale _Ploc = 0 
)
inlinestatic
176  { // return locale category mask and construct standard facet
177  if (_Ppf != 0 && *_Ppf == 0)
178  *_Ppf = new time_get<_Elem, _InIt>(
179  _Locinfo(_Ploc->c_str()));
180  return (_X_TIME);
181  }
Definition: xlocinfo:54
const char * c_str() const
Definition: xlocale:452
#define _X_TIME
Definition: xlocinfo.h:42
Definition: xloctime:38
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::_Getfmt ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt,
const char *  _Fmtfirst 
) const
inlineprotected
569  { // get formatted time for format NTBS
570  const _Ctype& _Ctype_fac = _USE(_Iosbase.getloc(), _Ctype);
571 
572  for (; *_Fmtfirst != '\0'; ++_Fmtfirst)
573  if (*_Fmtfirst == '%')
574  _First = do_get(_First, _Last, _Iosbase, _State, _Pt,
575  *++_Fmtfirst); // convert a single field
576  else if (*_Fmtfirst == ' ')
577  for (; _First != _Last
578  && _Ctype_fac.is(_Ctype::space, *_First); ++_First)
579  ;
580  else if (_Ctype_fac.narrow(*_First) != *_Fmtfirst)
581  { // bad literal match
582  _State |= ios_base::failbit;
583  break;
584  }
585  else
586  ++_First;
587  if (_First == _Last)
588  _State |= ios_base::eofbit;
589  return (_First);
590  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _USE(loc, fac)
Definition: xlocale:547
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
virtual _InIt __CLR_OR_THIS_CALL do_get(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, char _Specifier, char=0) const
Definition: xloctime:417
ctype< _Elem > _Ctype
Definition: xloctime:44
Definition: xlocale:2097
_FwdIt _Last
Definition: algorithm:1936
static constexpr _Iostate eofbit
Definition: xiosbase:88
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
ios_base::iostate __CLRCALL_OR_CDECL time_get< _Elem, _InIt >::_Getint ( _InIt &  _First,
_InIt &  _Last,
int  _Lo,
int  _Hi,
int &  _Val,
const _Ctype _Ctype_fac 
) const
inlineprivate
597  { // get integer in range [_Lo, _Hi] from [_First, _Last)
598  char _Ac[_MAX_INT_DIG], *_Ep;
599  char *_Ptr = _Ac;
600  char _Ch;
601 
602  if (_First == _Last)
603  ;
604  else if ((_Ch = _Ctype_fac.narrow(*_First)) == '+')
605  *_Ptr++ = '+', ++_First; // copy plus sign
606  else if (_Ch == '-')
607  *_Ptr++ = '-', ++_First; // copy minus sign
608 
609  bool _Seendigit = false;
610  while (_First != _Last && _Ctype_fac.narrow(*_First) == '0')
611  _Seendigit = true, ++_First; // strip leading zeros
612  if (_Seendigit)
613  *_Ptr++ = '0'; // replace one or more with single zero
614 
615  for (char *const _Pe = &_Ac[_MAX_INT_DIG - 1]; _First != _Last
616  && '0' <= (_Ch = _Ctype_fac.narrow(*_First)) && _Ch <= '9';
617  _Seendigit = true, ++_First)
618  { // copy digits
619  *_Ptr = _Ch;
620  if (_Ptr < _Pe)
621  ++_Ptr; // drop trailing digits if already too large
622  }
623 
624  if (!_Seendigit)
625  _Ptr = _Ac;
626  *_Ptr = '\0';
627  int _Errno = 0;
628  const long _Ans = _CSTD _Stolx(_Ac, &_Ep, 10, &_Errno);
629  ios_base::iostate _State = ios_base::goodbit;
630 
631  if (_First == _Last)
632  _State |= ios_base::eofbit;
633  if (_Ep == _Ac || _Errno != 0 || _Ans < _Lo || _Hi < _Ans)
634  _State |= ios_base::failbit; // bad conversion
635  else
636  _Val = _Ans; // store valid result
637  return (_State);
638  }
static constexpr _Iostate failbit
Definition: xiosbase:89
_In_ int _Val
Definition: vcruntime_string.h:62
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
#define _MAX_INT_DIG
Definition: yvals.h:588
static constexpr _Iostate goodbit
Definition: xiosbase:87
_CRTIMP2_PURE long __CLRCALL_PURE_OR_CDECL _Stolx(const char *, _Out_opt_ _Deref_post_opt_valid_ char **, int, int *)
#define _CSTD
Definition: yvals.h:570
_FwdIt _Last
Definition: algorithm:1936
static constexpr _Iostate eofbit
Definition: xiosbase:88
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
template<class _Elem2 >
void time_get< _Elem, _InIt >::_Getvals ( _Elem2  ,
const _Locinfo _Lobj 
)
inlineprotected
199  { // get values
200  _Cvt = _Lobj._Getcvt();
201  _Days = _MAKLOCSTR(_Elem, _Lobj._Getdays(), _Cvt);
202  _Months = _MAKLOCSTR(_Elem, _Lobj._Getmonths(), _Cvt);
203  _Ampm = _MAKLOCSTR(_Elem, ":AM:am:PM:pm", _Cvt);
204  }
const _Elem * _Ampm
Definition: xloctime:649
const _Elem * _Months
Definition: xloctime:648
_Cvtvec __CLR_OR_THIS_CALL _Getcvt() const
Definition: xlocinfo:120
const char *__CLR_OR_THIS_CALL _Getmonths() const
Definition: xlocinfo:149
_Locinfo::_Cvtvec _Cvt
Definition: xloctime:651
const _Elem * _Days
Definition: xloctime:647
#define _MAKLOCSTR(Elem, str, cvt)
Definition: xlocale:713
const char *__CLR_OR_THIS_CALL _Getdays() const
Definition: xlocinfo:135
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
template<>
void time_get< _Elem, _InIt >::_Getvals ( wchar_t  ,
const _Locinfo _Lobj 
)
inlineprotected
208  { // get values
209  _Cvt = _Lobj._Getcvt();
210  _Days = (const _Elem *)_Maklocwcs(
211  (const wchar_t *)_Lobj._W_Getdays());
212  _Months = (const _Elem *)_Maklocwcs(
213  (const wchar_t *)_Lobj._W_Getmonths());
214  _Ampm = (const _Elem *)_Maklocwcs(L":AM:am:PM:pm");
215  }
const _Elem * _Ampm
Definition: xloctime:649
const _Elem * _Months
Definition: xloctime:648
wchar_t * _Maklocwcs(const wchar_t *_Ptr)
Definition: xlocnum:97
_Cvtvec __CLR_OR_THIS_CALL _Getcvt() const
Definition: xlocinfo:120
const unsigned short *__CLR_OR_THIS_CALL _W_Getdays() const
Definition: xlocinfo:185
_Locinfo::_Cvtvec _Cvt
Definition: xloctime:651
const _Elem * _Days
Definition: xloctime:647
const unsigned short *__CLR_OR_THIS_CALL _W_Getmonths() const
Definition: xlocinfo:200
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
void __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::_Init ( const _Locinfo _Lobj)
inlineprotected
218  { // initialize from _Lobj
219  _Days = 0;
220  _Months = 0;
221  _Ampm = 0;
222 
223  _TRY_BEGIN
224  _Getvals((_Elem)0, _Lobj);
225 
227 
228  _CATCH_ALL
229  _Tidy();
230  _RERAISE;
231  _CATCH_END
232  }
const _Elem * _Ampm
Definition: xloctime:649
int __CLR_OR_THIS_CALL _Getdateorder() const
Definition: xlocinfo:175
const _Elem * _Months
Definition: xloctime:648
#define _TRY_BEGIN
Definition: xstddef:60
void _Getvals(_Elem2, const _Locinfo &_Lobj)
Definition: xloctime:198
#define _CATCH_END
Definition: xstddef:63
dateorder _Dateorder
Definition: xloctime:650
dateorder
Definition: xloctime:21
#define _CATCH_ALL
Definition: xstddef:62
const _Elem * _Days
Definition: xloctime:647
#define _RERAISE
Definition: xstddef:74
void __CLR_OR_THIS_CALL _Tidy()
Definition: xloctime:640
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
void __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::_Tidy ( )
inlineprivate
641  { // free all storage
642  _CSTD free((void *)_Days);
643  _CSTD free((void *)_Months);
644  _CSTD free((void *)_Ampm);
645  }
const _Elem * _Ampm
Definition: xloctime:649
const _Elem * _Months
Definition: xloctime:648
const _Elem * _Days
Definition: xloctime:647
#define _CSTD
Definition: yvals.h:570
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
dateorder __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::date_order ( ) const
inline
49  { // return date order code
50  return (do_date_order());
51  }
virtual dateorder __CLR_OR_THIS_CALL do_date_order() const
Definition: xloctime:234
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual dateorder __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::do_date_order ( ) const
inlineprotectedvirtual
235  { // return date order code
236  return (_Dateorder);
237  }
dateorder _Dateorder
Definition: xloctime:650
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual _InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::do_get ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt,
char  _Specifier,
char  = 0 
) const
inlineprotectedvirtual
420  { // get formatted time for _Specifier (_Modifier ignored)
421  const _Ctype& _Ctype_fac = _USE(_Iosbase.getloc(), _Ctype);
422  int _Ans = 0;
423 
424  _State = ios_base::goodbit;
425 
426  switch (_Specifier)
427  { // process format specifier
428  case 'a':
429  case 'A':
430  _First = get_weekday(_First, _Last, _Iosbase, _State, _Pt);
431  break;
432 
433  case 'b':
434  case 'B':
435  case 'h':
436  _First = get_monthname(_First, _Last, _Iosbase, _State, _Pt);
437  break;
438 
439  case 'c':
440  _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt,
441  "%b %d %H : %M : %S %Y");
442  break;
443 
444  case 'C':
445  _State |= _Getint(_First, _Last, 0, 99,
446  _Ans, _Ctype_fac);
447  if (!(_State & ios_base::failbit))
448  _Pt->tm_year = _Ans * 100 - 1900; // convert to century
449  break;
450 
451  case 'd':
452  case 'e':
453  _State |= _Getint(_First, _Last, 1, 31,
454  _Pt->tm_mday, _Ctype_fac);
455  break;
456 
457  case 'D':
458  _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt,
459  "%m / %d / %y");
460  break;
461 
462  case 'H':
463  _State |= _Getint(_First, _Last, 0, 23,
464  _Pt->tm_hour, _Ctype_fac);
465  break;
466 
467  case 'I':
468  _State |= _Getint(_First, _Last, 1, 12,
469  _Ans, _Ctype_fac);
470  if (!(_State & ios_base::failbit))
471  _Pt->tm_hour = _Ans == 12 ? 0 : _Ans;
472  break;
473 
474  case 'j':
475  _State |= _Getint(_First, _Last, 1, 366,
476  _Pt->tm_yday, _Ctype_fac);
477  break;
478 
479  case 'm':
480  _State |= _Getint(_First, _Last, 1, 12,
481  _Ans, _Ctype_fac);
482  if (!(_State & ios_base::failbit))
483  _Pt->tm_mon = _Ans - 1;
484  break;
485 
486  case 'M':
487  _State |= _Getint(_First, _Last, 0, 59,
488  _Pt->tm_min, _Ctype_fac);
489  break;
490 
491  case 'n':
492  case 't':
493  _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt,
494  " ");
495  break;
496 
497  case 'p':
498  _Ans = _Getloctxt(_First, _Last, (size_t)0, ":AM:am:PM:pm");
499  if (_Ans < 0)
500  _State |= ios_base::failbit;
501  else if (1 < _Ans)
502  _Pt->tm_hour += 12;
503  break;
504 
505  case 'r':
506  _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt,
507  "%I : %M : %S %p");
508  break;
509 
510  case 'R':
511  _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt,
512  "%H : %M");
513  break;
514 
515  case 'S':
516  _State |= _Getint(_First, _Last, 0, 60,
517  _Pt->tm_sec, _Ctype_fac);
518  break;
519 
520  case 'T':
521  case 'X':
522  _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt,
523  "%H : %M : %S");
524  break;
525 
526  case 'U':
527  _State |= _Getint(_First, _Last, 0, 53,
528  _Pt->tm_yday, _Ctype_fac);
529  break;
530 
531  case 'w':
532  _State |= _Getint(_First, _Last, 0, 6,
533  _Pt->tm_wday, _Ctype_fac);
534  break;
535 
536  case 'W':
537  _State |= _Getint(_First, _Last, 0, 53,
538  _Pt->tm_yday, _Ctype_fac);
539  break;
540 
541  case 'x':
542  _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt,
543  "%d / %m / %y");
544  break;
545 
546  case 'y':
547  _State |= _Getint(_First, _Last, 0, 99,
548  _Ans, _Ctype_fac);
549  if (!(_State & ios_base::failbit))
550  _Pt->tm_year = _Ans < 69 ? _Ans + 100 : _Ans;
551  break;
552 
553  case 'Y':
554  _First = get_year(_First, _Last, _Iosbase, _State, _Pt);
555  break;
556 
557  default:
558  _State |= ios_base::failbit; // unknown specifier
559  }
560 
561  if (_First == _Last)
562  _State |= ios_base::eofbit;
563  return (_First);
564  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _USE(loc, fac)
Definition: xlocale:547
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
_InIt __CLR_OR_THIS_CALL get_monthname(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:71
_InIt __CLR_OR_THIS_CALL get_year(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:77
ctype< _Elem > _Ctype
Definition: xloctime:44
static constexpr _Iostate goodbit
Definition: xiosbase:87
_InIt __CLR_OR_THIS_CALL _Getfmt(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, const char *_Fmtfirst) const
Definition: xloctime:566
ios_base::iostate __CLRCALL_OR_CDECL _Getint(_InIt &_First, _InIt &_Last, int _Lo, int _Hi, int &_Val, const _Ctype &_Ctype_fac) const
Definition: xloctime:593
_FwdIt _Last
Definition: algorithm:1936
int __CRTDECL _Getloctxt(_InIt &_First, _InIt &_Last, size_t _Numfields, const _Elem *_Ptr)
Definition: xlocale:604
_InIt __CLR_OR_THIS_CALL get_weekday(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:65
static constexpr _Iostate eofbit
Definition: xiosbase:88
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual _InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::do_get_date ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inlineprotectedvirtual
267  { // get date from [_First, _Last) into _Pt
268  _DEBUG_RANGE(_First, _Last);
269  _DEBUG_POINTER(_Pt);
270  const _Ctype& _Ctype_fac = _USE(_Iosbase.getloc(), _Ctype);
271 
272  dateorder _Dorder = date_order();
273  if (_Dorder == no_order)
274  _Dorder = mdy;
275 
276  if (_First == _Last)
277  ;
278  else if (!_Ctype_fac.is(_Ctype::digit, *_First))
279  { // begins with month name, assume mdy
280  _First = get_monthname(_First, _Last, _Iosbase, _State, _Pt);
281  _Dorder = mdy;
282  }
283  else if (_Dorder == mdy)
284  { // get month number
285  _State |= _Getint(_First, _Last, 1, 12,
286  _Pt->tm_mon, _Ctype_fac);
287  --_Pt->tm_mon;
288  }
289  else if (_Dorder == dmy)
290  _State |= _Getint(_First, _Last, 1, 31,
291  _Pt->tm_mday, _Ctype_fac);
292  else // ymd or ydm
293  _First = get_year(_First, _Last, _Iosbase, _State, _Pt);
294 
295  while (_First != _Last && _Ctype_fac.is(_Ctype::space, *_First))
296  ++_First; // skip spaces
297 
298  if (_First != _Last)
299  { // skip [:,/]
300  char _Ch = _Ctype_fac.narrow(*_First);
301  if (_Ch == ':' || _Ch == ',' || _Ch == '/')
302  ++_First;
303  }
304  while (_First != _Last && _Ctype_fac.is(_Ctype::space, *_First))
305  ++_First; // skip spaces
306 
307  if (_First == _Last)
308  ;
309  else if (!_Ctype_fac.is(_Ctype::digit, *_First))
310  if (_Dorder == mdy)
311  _State |= ios_base::failbit; // error, month already seen
312  else
313  { // month name is second, like it or not
314  _First = get_monthname(_First, _Last, _Iosbase, _State, _Pt);
315  if (_Dorder == ydm)
316  _Dorder = ymd;
317  }
318  else if (_Dorder == dmy || _Dorder == ymd)
319  { // get month number
320  _State |= _Getint(_First, _Last, 1, 12,
321  _Pt->tm_mon, _Ctype_fac);
322  --_Pt->tm_mon;
323  }
324  else
325  _State |= _Getint(_First, _Last, 1, 31,
326  _Pt->tm_mday, _Ctype_fac);
327 
328  while (_First != _Last && _Ctype_fac.is(_Ctype::space, *_First))
329  ++_First; // skip spaces
330  if (_First != _Last)
331  { // skip [:,/]
332  char _Ch = _Ctype_fac.narrow(*_First);
333  if (_Ch == ':' || _Ch == ',' || _Ch == '/')
334  ++_First;
335  }
336  while (_First != _Last && _Ctype_fac.is(_Ctype::space, *_First))
337  ++_First; // skip spaces
338 
339  if (_First == _Last)
340  _State |= ios_base::failbit; // error, missing component(s)
341  else if (!_Ctype_fac.is(_Ctype::digit, *_First))
342  if (_Dorder != ydm)
343  _State |= ios_base::failbit; // error, month out of place
344  else
345  _First = get_monthname(_First, _Last, _Iosbase, _State, _Pt);
346  else if (_Dorder == ydm)
347  { // get month number
348  _State |= _Getint(_First, _Last, 1, 12,
349  _Pt->tm_mon, _Ctype_fac);
350  --_Pt->tm_mon;
351  }
352  else if (_Dorder == ymd)
353  _State |= _Getint(_First, _Last, 1, 31,
354  _Pt->tm_mday, _Ctype_fac);
355  else // mdy or dmy
356  _First = get_year(_First, _Last, _Iosbase, _State, _Pt);
357 
358  if (_First == _Last)
359  _State |= ios_base::eofbit;
360  return (_First);
361  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
#define _USE(loc, fac)
Definition: xlocale:547
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
_Check_return_ _In_ wchar_t _Ch
Definition: vcruntime_string.h:89
Definition: xloctime:23
dateorder
Definition: xloctime:21
Definition: xloctime:23
_InIt __CLR_OR_THIS_CALL get_monthname(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:71
dateorder __CLR_OR_THIS_CALL date_order() const
Definition: xloctime:48
Definition: xloctime:23
#define _DEBUG_POINTER(first)
Definition: xutility:819
_InIt __CLR_OR_THIS_CALL get_year(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:77
ctype< _Elem > _Ctype
Definition: xloctime:44
ios_base::iostate __CLRCALL_OR_CDECL _Getint(_InIt &_First, _InIt &_Last, int _Lo, int _Hi, int &_Val, const _Ctype &_Ctype_fac) const
Definition: xloctime:593
Definition: xloctime:23
Definition: xloctime:23
Definition: xlocale:2095
Definition: xlocale:2097
_FwdIt _Last
Definition: algorithm:1936
static constexpr _Iostate eofbit
Definition: xiosbase:88
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual _InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::do_get_monthname ( _InIt  _First,
_InIt  _Last,
ios_base ,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inlineprotectedvirtual
381  { // get month from [_First, _Last) into _Pt
382  _DEBUG_RANGE(_First, _Last);
383  _DEBUG_POINTER(_Pt);
384  int _Num = _Getloctxt(_First, _Last, (size_t)0, _Months);
385 
386  if (_Num < 0)
387  _State |= ios_base::failbit;
388  else
389  _Pt->tm_mon = _Num >> 1; // set mon
390  return (_First);
391  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
const _Elem * _Months
Definition: xloctime:648
#define _DEBUG_POINTER(first)
Definition: xutility:819
_FwdIt _Last
Definition: algorithm:1936
int __CRTDECL _Getloctxt(_InIt &_First, _InIt &_Last, size_t _Numfields, const _Elem *_Ptr)
Definition: xlocale:604
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual _InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::do_get_time ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inlineprotectedvirtual
242  { // get time of day from [_First, _Last) into _Pt
243  _DEBUG_RANGE(_First, _Last);
244  _DEBUG_POINTER(_Pt);
245  const _Ctype& _Ctype_fac = _USE(_Iosbase.getloc(), _Ctype);
246 
247  _State |= _Getint(_First, _Last, 0, 23,
248  _Pt->tm_hour, _Ctype_fac);
249 
250  if (_State != ios_base::goodbit || _Ctype_fac.narrow(*_First) != ':')
251  _State |= ios_base::failbit; // hour field is bad
252  else
253  _State |= _Getint(++_First, _Last, 0, 59,
254  _Pt->tm_min, _Ctype_fac);
255 
256  if (_State != ios_base::goodbit || _Ctype_fac.narrow(*_First) != ':')
257  _State |= ios_base::failbit; // min field is bad
258  else
259  _State |= _Getint(++_First, _Last, 0, 59,
260  _Pt->tm_sec, _Ctype_fac);
261  return (_First);
262  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
#define _USE(loc, fac)
Definition: xlocale:547
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
#define _DEBUG_POINTER(first)
Definition: xutility:819
ctype< _Elem > _Ctype
Definition: xloctime:44
static constexpr _Iostate goodbit
Definition: xiosbase:87
ios_base::iostate __CLRCALL_OR_CDECL _Getint(_InIt &_First, _InIt &_Last, int _Lo, int _Hi, int &_Val, const _Ctype &_Ctype_fac) const
Definition: xloctime:593
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual _InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::do_get_weekday ( _InIt  _First,
_InIt  _Last,
ios_base ,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inlineprotectedvirtual
366  { // get weekday from [_First, _Last) into _Pt
367  _DEBUG_RANGE(_First, _Last);
368  _DEBUG_POINTER(_Pt);
369  int _Num = _Getloctxt(_First, _Last, (size_t)0, _Days);
370 
371  if (_Num < 0)
372  _State |= ios_base::failbit;
373  else
374  _Pt->tm_wday = _Num >> 1; // set wday
375  return (_First);
376  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
#define _DEBUG_POINTER(first)
Definition: xutility:819
const _Elem * _Days
Definition: xloctime:647
_FwdIt _Last
Definition: algorithm:1936
int __CRTDECL _Getloctxt(_InIt &_First, _InIt &_Last, size_t _Numfields, const _Elem *_Ptr)
Definition: xlocale:604
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
virtual _InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::do_get_year ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inlineprotectedvirtual
396  { // get year from [_First, _Last) into _Pt
397  _DEBUG_RANGE(_First, _Last);
398  _DEBUG_POINTER(_Pt);
399  const _Ctype& _Ctype_fac = _USE(_Iosbase.getloc(), _Ctype);
400 
401  int _Ans = 0;
402  ios_base::iostate _Res = _Getint(_First, _Last, 0, 9999,
403  _Ans, _Ctype_fac);
404 
405  _State |= _Res; // pass on eofbit and failbit
406  if (_Res & ios_base::failbit)
407  ; // invalid input
408  else if (_Ans < 69)
409  _Pt->tm_year = _Ans + 100; // [0, 68] parsed as [2000, 2068]
410  else if (_Ans < 100)
411  _Pt->tm_year = _Ans; // [69, 99] parsed as [1969, 1999]
412  else
413  _Pt->tm_year = _Ans - 1900; // [100, 9999] parsed literally
414  return (_First);
415  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
#define _USE(loc, fac)
Definition: xlocale:547
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
#define _DEBUG_POINTER(first)
Definition: xutility:819
ctype< _Elem > _Ctype
Definition: xloctime:44
ios_base::iostate __CLRCALL_OR_CDECL _Getint(_InIt &_First, _InIt &_Last, int _Lo, int _Hi, int &_Val, const _Ctype &_Ctype_fac) const
Definition: xloctime:593
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::get ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt,
char  _Specifier,
char  _Modifier = '\0' 
) const
inline
86  { // get formatted time for _Specifier/_Modifier
87  _DEBUG_RANGE(_First, _Last);
88  _DEBUG_POINTER(_Pt);
89  return (do_get(_First, _Last, _Iosbase, _State, _Pt,
90  _Specifier, _Modifier));
91  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
virtual _InIt __CLR_OR_THIS_CALL do_get(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, char _Specifier, char=0) const
Definition: xloctime:417
#define _DEBUG_POINTER(first)
Definition: xutility:819
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::get ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt,
const _Elem *  _Fmtfirst,
const _Elem *  _Fmtlast 
) const
inline
96  { // get formatted time for format string
97  _DEBUG_RANGE(_First, _Last);
98  _DEBUG_POINTER(_Pt);
99  _DEBUG_RANGE(_Fmtfirst, _Fmtlast);
100  const _Ctype& _Ctype_fac = _USE(_Iosbase.getloc(), _Ctype);
101 
102  _State = ios_base::goodbit;
103 
104  for (; _Fmtfirst != _Fmtlast; ++_Fmtfirst)
105  if (_Ctype_fac.narrow(*_Fmtfirst) != '%')
106  { // match literal element
107  if (_Ctype_fac.is(_Ctype::space, *_Fmtfirst))
108  for (; _First != _Last
109  && _Ctype_fac.is(_Ctype::space, *_First); ++_First)
110  ;
111  else if (*_First != *_Fmtfirst)
112  { // bad literal match
113  _State |= ios_base::failbit;
114  break;
115  }
116  else
117  ++_First;
118  }
119  else if (++_Fmtfirst == _Fmtlast)
120  { // treat trailing % as literal match
121  if (*_First != _Fmtfirst[-1])
122  _State |= ios_base::failbit;
123  else
124  ++_First;
125  break;
126  }
127  else
128  { // get specifier after %
129  char _Specifier = _Ctype_fac.narrow(*_Fmtfirst);
130  char _Modifier = '\0';
131  _Elem _Percent = _Fmtfirst[-1];
132 
133  if (_Specifier != 'E' && _Specifier != 'O'
134  && _Specifier != 'Q' && _Specifier != '#')
135  ; // not [E0Q#] modifier, treat as specifier
136  else if (++_Fmtfirst == _Fmtlast)
137  { // no specifier, treat %[E0Q#] as literal match
138  if (*_First != _Percent
139  || ++_First == _Last
140  || _Ctype_fac.narrow(*_First) != _Specifier)
141  _State |= ios_base::failbit;
142  else
143  ++_First;
144  break;
145  }
146  else
147  { // save both qualifier and specifier
148  _Modifier = _Specifier;
149  _Specifier = _Ctype_fac.narrow(*_Fmtfirst);
150  }
151 
152  _First = do_get(_First, _Last, _Iosbase, _State, _Pt,
153  _Specifier, _Modifier); // convert a single field
154  }
155  if (_First == _Last)
156  _State |= ios_base::eofbit;
157  return (_First);
158  }
static constexpr _Iostate failbit
Definition: xiosbase:89
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
#define _USE(loc, fac)
Definition: xlocale:547
locale __CLR_OR_THIS_CALL getloc() const
Definition: xiosbase:433
virtual _InIt __CLR_OR_THIS_CALL do_get(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt, char _Specifier, char=0) const
Definition: xloctime:417
#define _DEBUG_POINTER(first)
Definition: xutility:819
ctype< _Elem > _Ctype
Definition: xloctime:44
static constexpr _Iostate goodbit
Definition: xiosbase:87
Definition: xlocale:2097
_FwdIt _Last
Definition: algorithm:1936
static constexpr _Iostate eofbit
Definition: xiosbase:88
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::get_date ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inline
61  { // get date from [_First, _Last) into _Pt
62  return (do_get_date(_First, _Last, _Iosbase, _State, _Pt));
63  }
virtual _InIt __CLR_OR_THIS_CALL do_get_date(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:264
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::get_monthname ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inline
73  { // get month from [_First, _Last) into _Pt
74  return (do_get_monthname(_First, _Last, _Iosbase, _State, _Pt));
75  }
virtual _InIt __CLR_OR_THIS_CALL do_get_monthname(_InIt _First, _InIt _Last, ios_base &, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:378
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::get_time ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inline
55  { // get time of day from [_First, _Last) into _Pt
56  return (do_get_time(_First, _Last, _Iosbase, _State, _Pt));
57  }
virtual _InIt __CLR_OR_THIS_CALL do_get_time(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:239
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::get_weekday ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inline
67  { // get weekday from [_First, _Last) into _Pt
68  return (do_get_weekday(_First, _Last, _Iosbase, _State, _Pt));
69  }
virtual _InIt __CLR_OR_THIS_CALL do_get_weekday(_InIt _First, _InIt _Last, ios_base &, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:363
_FwdIt _Last
Definition: algorithm:1936
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_InIt __CLR_OR_THIS_CALL time_get< _Elem, _InIt >::get_year ( _InIt  _First,
_InIt  _Last,
ios_base _Iosbase,
ios_base::iostate &  _State,
tm *  _Pt 
) const
inline
79  { // get year from [_First, _Last) into _Pt
80  return (do_get_year(_First, _Last, _Iosbase, _State, _Pt));
81  }
virtual _InIt __CLR_OR_THIS_CALL do_get_year(_InIt _First, _InIt _Last, ios_base &_Iosbase, ios_base::iostate &_State, tm *_Pt) const
Definition: xloctime:393
_FwdIt _Last
Definition: algorithm:1936

Member Data Documentation

template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
const _Elem* time_get< _Elem, _InIt >::_Ampm
private
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
_Locinfo::_Cvtvec time_get< _Elem, _InIt >::_Cvt
private
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
dateorder time_get< _Elem, _InIt >::_Dateorder
private
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
const _Elem* time_get< _Elem, _InIt >::_Days
private
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
const _Elem* time_get< _Elem, _InIt >::_Months
private
template<class _Elem , class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> >>
__PURE_APPDOMAIN_GLOBAL locale::id time_get< _Elem, _InIt >::id
static

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