1 // xloctime internal header (from <locale>)
2 #pragma once
3 #ifndef _XLOCTIME_
4 #define _XLOCTIME_
5 #ifndef RC_INVOKED
6 #include <ctime>
7 #include <xlocnum>
8
9 #ifdef _MSC_VER
10  #pragma pack(push,_CRT_PACKING)
11  #pragma warning(push,3)
12 #endif  /* _MSC_VER */
13
14 _STD_BEGIN
15
16 #pragma warning(push)
17 #pragma warning(disable:4275)
18         // STRUCT time_base
19 struct _CRTIMP2_PURE time_base
20     : public locale::facet
21     {    // base class for time_get
22     enum dateorder
23         {    // constants for different orders of date components
24         no_order, dmy, mdy, ymd, ydm};
25
26     __CLR_OR_THIS_CALL time_base(size_t _Refs = 0)
27         : locale::facet(_Refs)
28         {    // default constructor
29         }
30       __CLR_OR_THIS_CALL ~time_base()
31              {
32              }
33     };
34
35         // TEMPLATE CLASS time_get
36 template<class _Elem,
37     class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem> > >
38     class time_get
39         : public time_base
40     {    // facet for converting text to encoded times
41 public:
42     typedef _Elem char_type;
43     typedef _InIt iter_type;
44
45     __PURE_APPDOMAIN_GLOBAL static locale::id id;    // unique facet id
46
47     dateorder __CLR_OR_THIS_CALL date_order() const
48         {    // return date order code
49         return (do_date_order());
50         }
51
52     _InIt __CLR_OR_THIS_CALL get_time(_InIt _First, _InIt _Last,
53         ios_base& _Iosbase, ios_base::iostate& _State, tm *_Pt) const
54         {    // get time of day from [_First, _Last) into _Pt
55         return (do_get_time(_First, _Last, _Iosbase, _State, _Pt));
56         }
57
58     _InIt __CLR_OR_THIS_CALL get_date(_InIt _First, _InIt _Last,
59         ios_base& _Iosbase, ios_base::iostate& _State, tm *_Pt) const
Lines 60 ... 643 are skipped.
644         wchar_t _Wc;
645         --_Count;    // skip '!'
646         for (string::const_iterator _Snext = _Str.begin() + 1; 0 < _Count;
647             _Count -= _Bytes, _Snext += _Bytes, *_Dest++ = _Wc)
648             switch (_Bytes = _Mbrtowc(&_Wc, &*_Snext, _Count, &_Mbst, &_Cvt))
649                 {    // convert a wchar_t
650             case -2:    // partial conversion
651             case -1:    // failed conversion
652                 return (_Dest);
653
654             case 0:    // may have converted null character
655                 if (_Wc == L'\0')
656                     _Bytes = (int)::strlen(&*_Snext) + 1;
657                 break;
658
659             case -3:
660                 _Bytes = 0;    // wchar_t generated from state info
661                 }
662         return (_Dest);
663         }
664
665 private:
666     _Locinfo::_Timevec _Tnames;    // locale-specific stuff for _Strftime
667     _Locinfo::_Cvtvec _Cvt;        // conversion information
668     };
669
670         // STATIC time_put::id OBJECT
671 template<class _OutIt>
672     __PURE_APPDOMAIN_GLOBAL locale::id time_put<wchar_t, _OutIt>::id;
673
674
675         // TEMPLATE CLASS time_put_byname
676 template<class _Elem,
677     class _OutIt = ostreambuf_iterator<_Elem, char_traits<_Elem> > >
678     class time_put_byname
679         : public time_put<_Elem, _OutIt>
680     {    // time_put for named locale
681 public:
682     explicit time_put_byname(const char *_Locname, size_t _Refs = 0)
683         : time_put<_Elem, _OutIt>(_Locname, _Refs)
684         {    // construct for named locale
685         }
686
687 _PROTECTED:
688     virtual __CLR_OR_THIS_CALL ~time_put_byname()
689         {    // destroy the object
690         }
691     };
692
693  #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE)
694 template class _CRTIMP2_PURE time_get<char,
695     istreambuf_iterator<char, char_traits<char> > >;
696 template class _CRTIMP2_PURE time_put<char,
697     ostreambuf_iterator<char, char_traits<char> > >;
698
699 template class _CRTIMP2_PURE time_get<wchar_t,
700     istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
701 template class _CRTIMP2_PURE time_put<wchar_t,
702     ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
703
704
705
706  #endif /* _DLL_CPPLIB */
707
708 #pragma warning(pop)
709
710 _STD_END
711
712 #ifdef _MSC_VER
713  #pragma warning(pop)
714  #pragma pack(pop)
715 #endif  /* _MSC_VER */
716
717 #endif /* RC_INVOKED */
718 #endif /* _XLOCTIME_ */
719
720 /*
721  * Copyright (c) 1992-2007 by P.J. Plauger.  ALL RIGHTS RESERVED.
722  * Consult your license regarding permissions and restrictions.
723  V5.03:0009 */
724