#pragma once
#ifndef _XLOCTIME_
#define _XLOCTIME_
#ifndef RC_INVOKED
#include <ctime>
#include <xlocnum>
#pragma pack(push,_CRT_PACKING)
#pragma warning(push,_STL_WARNING_LEVEL)
#pragma warning(disable: _STL_DISABLED_WARNINGS)
#pragma warning(disable:
4455
4494
4619
4643
4702
4984
4988
)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new
struct _CRTIMP2_PURE_IMPORT time_base
struct
__declspec
(dllimport)
:
public
::
{
enum
{
,
,
,
,
};
__CLR_OR_THIS_CALL time_base(size_t _Refs = 0)
:
::
(
)
{
}
__CLR_OR_THIS_CALL ~time_base() noexcept
{
}
};
template
<
class
,
class
=
<
,
<
> > >
class
:
public
{
public
:
typedef
;
typedef
;
typedef
<
>
;
__PURE_APPDOMAIN_GLOBAL static locale::id id; // unique facet id
dateorder __CLR_OR_THIS_CALL date_order() const
{
return
(
());
}
_InIt __CLR_OR_THIS_CALL get_time(_InIt _First, _InIt _Last,
&
,
::
&
,
*
)
const
{
return
(
(
,
,
,
,
));
}
_InIt __CLR_OR_THIS_CALL get_date(_InIt _First, _InIt _Last,
&
,
::
&
,
*
)
const
{
return
(
(
,
,
,
,
));
}
_InIt __CLR_OR_THIS_CALL get_weekday(_InIt _First, _InIt _Last,
&
,
::
&
,
*
)
const
{
return
(
(
,
,
,
,
));
}
_InIt __CLR_OR_THIS_CALL get_monthname(_InIt _First, _InIt _Last,
&
,
::
&
,
*
)
const
{
return
(
(
,
,
,
,
));
}
_InIt __CLR_OR_THIS_CALL get_year(_InIt _First, _InIt _Last,
&
,
::
&
,
*
)
const
{
return
(
(
,
,
,
,
));
}
_InIt __CLR_OR_THIS_CALL get(_InIt _First, _InIt _Last,
&
,
::
&
,
*
,
char
,
char
=
'\0'
)
const
{
return
(
(
,
,
,
,
,
,
));
}
_InIt __CLR_OR_THIS_CALL get(_InIt _First, _InIt _Last,
&
,
::
&
,
*
,
const
*
,
const
*
)
const
{
(
,
);
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
=
::
;
for
(;
; ++
)
{
if
(
_Ctype_fac
.
(*
)
'%'
)
{
if
(
_Ctype_fac
.
(
::
, *
))
{
while
(
!=
&&
_Ctype_fac
.
(
::
, *
))
{
++
;
}
}
else
if
(*
!= *
)
{
|=
::
;
break
;
}
else
{
++
;
}
}
else
if
(++
)
{
if
(*
!=
[-
1
])
{
|=
::
;
}
else
{
++
;
}
break
;
}
else
{
char
=
_Ctype_fac
.
(*
);
char
=
'\0'
;
=
[-
1
];
if
(
_Specifier
'E'
||
_Specifier
'O'
||
_Specifier
'Q'
||
_Specifier
'#'
)
{
if
(++
)
{
if
(*
!=
_Percent
|| ++
==
||
_Ctype_fac
.
(*
) !=
_Specifier
)
{
|=
::
;
}
else
{
++
;
}
break
;
}
else
{
_Modifier
=
_Specifier
;
_Specifier
=
_Ctype_fac
.
(*
);
}
}
=
(
,
,
,
,
,
_Specifier
,
_Modifier
);
}
}
if
(
==
)
{
|=
::
;
}
return
(
);
}
explicit __CLR_OR_THIS_CALL time_get(size_t _Refs = 0)
:
(
)
{
(
_Lobj
);
}
__CLR_OR_THIS_CALL time_get(const _Locinfo& _Lobj, size_t _Refs = 0)
:
(
)
{
(
);
}
static size_t __CLRCALL_OR_CDECL _Getcat(const locale::facet **_Ppf = nullptr,
static
__cdecl
(
const
::
**
=
nullptr
,
const
*
=
nullptr
)
{
if
(
!=
nullptr
&& *
==
nullptr
)
*
=
new
<
,
>(
(
->
()));
}
protected
:
virtual __CLR_OR_THIS_CALL ~time_get() noexcept
{
();
}
__CLR_OR_THIS_CALL time_get(const char *_Locname, size_t _Refs = 0)
:
(
)
{
_BEGIN_LOCINFO(_Lobj(_Locname))
(
_Lobj
);
}
template
<
class
>
void __CLR_OR_THIS_CALL _Getvals(_Elem2, const _Locinfo& _Lobj)
{
.
();
if
(
<
,
wchar_t
>)
{
= (
const
*)
((
const
wchar_t
*)
.
());
= (
const
*)
((
const
wchar_t
*)
.
());
= (
const
*)
(
L":AM:am:PM:pm"
);
}
else
{
=
(
.
(),
static_cast
<
*>(
nullptr
),
);
=
(
.
(),
static_cast
<
*>(
nullptr
),
);
=
(
":AM:am:PM:pm"
,
static_cast
<
*>(
nullptr
),
);
}
}
void __CLR_OR_THIS_CALL _Init(const _Locinfo& _Lobj)
{
=
nullptr
;
=
nullptr
;
=
nullptr
;
((
)
0
,
);
= (
)
.
();
();
}
virtual dateorder __CLR_OR_THIS_CALL do_date_order() const
{
return
(
);
}
virtual _InIt __CLR_OR_THIS_CALL do_get_time(
,
,
&
,
::
&
,
*
)
const
{
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
|=
(
,
,
0
,
23
,
->
,
_Ctype_fac
);
if
(
::
||
_Ctype_fac
.
(*
)
':'
)
|=
::
;
else
|=
(++
,
,
0
,
59
,
->
,
_Ctype_fac
);
if
(
::
||
_Ctype_fac
.
(*
)
':'
)
|=
::
;
else
|=
(++
,
,
0
,
59
,
->
,
_Ctype_fac
);
return
(
);
}
virtual _InIt __CLR_OR_THIS_CALL do_get_date(
,
,
&
,
::
&
,
*
)
const
{
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
=
();
if
(
_Dorder
)
_Dorder
=
;
if
(
!=
)
{
if
(!
_Ctype_fac
.
(
::
, *
))
{
=
(
,
,
,
,
);
_Dorder
=
;
}
else
if
(
_Dorder
)
{
|=
(
,
,
1
,
12
,
->
,
_Ctype_fac
);
--
->
;
}
else
if
(
_Dorder
)
{
|=
(
,
,
1
,
31
,
->
,
_Ctype_fac
);
}
else
{
=
(
,
,
,
,
);
}
}
while
(
!=
&&
_Ctype_fac
.
(
::
, *
))
{
++
;
}
if
(
!=
)
{
char
=
_Ctype_fac
.
(*
);
if
(
_Ch
':'
||
_Ch
','
||
_Ch
'/'
)
{
++
;
}
}
while
(
!=
&&
_Ctype_fac
.
(
::
, *
))
{
++
;
}
if
(
!=
)
{
if
(!
_Ctype_fac
.
(
::
, *
))
{
if
(
_Dorder
)
{
|=
::
;
}
else
{
=
(
,
,
,
,
);
if
(
_Dorder
)
{
_Dorder
=
;
}
}
}
else
if
(
_Dorder
||
_Dorder
==
)
{
|=
(
,
,
1
,
12
,
->
,
_Ctype_fac
);
--
->
;
}
else
{
|=
(
,
,
1
,
31
,
->
,
_Ctype_fac
);
}
}
while
(
!=
&&
_Ctype_fac
.
(
::
, *
))
{
++
;
}
if
(
!=
)
{
char
=
_Ctype_fac
.
(*
);
if
(
_Ch
':'
||
_Ch
','
||
_Ch
'/'
)
{
++
;
}
}
while
(
!=
&&
_Ctype_fac
.
(
::
, *
))
{
++
;
}
if
(
==
)
{
|=
::
;
}
else
if
(!
_Ctype_fac
.
(
::
, *
))
{
if
(
_Dorder
)
{
|=
::
;
}
else
{
=
(
,
,
,
,
);
}
}
else
if
(
_Dorder
)
{
|=
(
,
,
1
,
12
,
->
,
_Ctype_fac
);
--
->
;
}
else
if
(
_Dorder
)
{
|=
(
,
,
1
,
31
,
->
,
_Ctype_fac
);
}
else
{
=
(
,
,
,
,
);
}
if
(
==
)
{
|=
::
;
}
return
(
);
}
virtual _InIt __CLR_OR_THIS_CALL do_get_weekday(
,
,
&,
::
&
,
*
)
const
{
int
=
(
,
, (
)
0
,
);
if
(
_Num
0
)
{
|=
::
;
}
else
{
->
=
_Num
>>
1
;
}
return
(
);
}
virtual _InIt __CLR_OR_THIS_CALL do_get_monthname(
,
,
&,
::
&
,
*
)
const
{
int
=
(
,
, (
)
0
,
);
if
(
_Num
0
)
|=
::
;
else
->
=
_Num
>>
1
;
return
(
);
}
virtual _InIt __CLR_OR_THIS_CALL do_get_year(
,
,
&
,
::
&
,
*
)
const
{
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
int
=
0
;
::
=
(
,
,
0
,
9999
,
_Ans
,
_Ctype_fac
);
|=
_Res
;
if
(!(
_Res
&
::
))
{
if
(
_Ans
69
)
{
->
=
_Ans
+
100
;
}
else
if
(
_Ans
100
)
{
->
=
_Ans
;
}
else
{
->
=
_Ans
-
1900
;
}
}
return
(
);
}
virtual _InIt __CLR_OR_THIS_CALL do_get(_InIt _First, _InIt _Last,
&
,
::
&
,
*
,
char
,
char
=
0
)
const
{
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
int
=
0
;
=
::
;
switch
(
)
{
case
'a'
:
case
'A'
:
=
(
,
,
,
,
);
break
;
case
'b'
:
case
'B'
:
case
'h'
:
=
(
,
,
,
,
);
break
;
case
'c'
:
=
(
,
,
,
,
,
"%b %d %H : %M : %S %Y"
);
break
;
case
'C'
:
|=
(
,
,
0
,
99
,
_Ans
,
_Ctype_fac
);
if
(!(
&
::
))
->
=
_Ans
*
100
-
1900
;
break
;
case
'd'
:
case
'e'
:
|=
(
,
,
1
,
31
,
->
,
_Ctype_fac
);
break
;
case
'D'
:
=
(
,
,
,
,
,
"%m / %d / %y"
);
break
;
case
'H'
:
|=
(
,
,
0
,
23
,
->
,
_Ctype_fac
);
break
;
case
'I'
:
|=
(
,
,
1
,
12
,
_Ans
,
_Ctype_fac
);
if
(!(
&
::
))
->
=
_Ans
12
?
0
:
_Ans
;
break
;
case
'j'
:
|=
(
,
,
1
,
366
,
->
,
_Ctype_fac
);
break
;
case
'm'
:
|=
(
,
,
1
,
12
,
_Ans
,
_Ctype_fac
);
if
(!(
&
::
))
->
=
_Ans
-
1
;
break
;
case
'M'
:
|=
(
,
,
0
,
59
,
->
,
_Ctype_fac
);
break
;
case
'n'
:
case
't'
:
=
(
,
,
,
,
,
" "
);
break
;
case
'p'
:
_Ans
=
(
,
, (
)
0
,
":AM:am:PM:pm"
);
if
(
_Ans
0
)
|=
::
;
else
if
(
1
_Ans
)
->
+=
12
;
break
;
case
'r'
:
=
(
,
,
,
,
,
"%I : %M : %S %p"
);
break
;
case
'R'
:
=
(
,
,
,
,
,
"%H : %M"
);
break
;
case
'S'
:
|=
(
,
,
0
,
60
,
->
,
_Ctype_fac
);
break
;
case
'T'
:
case
'X'
:
=
(
,
,
,
,
,
"%H : %M : %S"
);
break
;
case
'U'
:
|=
(
,
,
0
,
53
,
->
,
_Ctype_fac
);
break
;
case
'w'
:
|=
(
,
,
0
,
6
,
->
,
_Ctype_fac
);
break
;
case
'W'
:
|=
(
,
,
0
,
53
,
->
,
_Ctype_fac
);
break
;
case
'x'
:
=
(
,
,
,
,
,
"%d / %m / %y"
);
break
;
case
'y'
:
|=
(
,
,
0
,
99
,
_Ans
,
_Ctype_fac
);
if
(!(
&
::
))
->
=
_Ans
69
?
_Ans
+
100
:
_Ans
;
break
;
case
'Y'
:
=
(
,
,
,
,
);
break
;
default
:
|=
::
;
}
if
(
==
)
|=
::
;
return
(
);
}
_InIt __CLR_OR_THIS_CALL _Getfmt(_InIt _First, _InIt _Last,
&
,
::
&
,
*
,
const
char
*
)
const
{
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
for
(; *
'\0'
; ++
)
{
if
(*
'%'
)
{
=
(
,
,
,
,
,
*++
);
}
else
if
(*
' '
)
{
while
(
!=
&&
_Ctype_fac
.
(
::
, *
))
{
++
;
}
}
else
if
(
_Ctype_fac
.
(*
)
*
)
{
|=
::
;
break
;
}
else
{
++
;
}
}
if
(
==
)
{
|=
::
;
}
return
(
);
}
private
:
ios_base::iostate __CLRCALL_OR_CDECL _Getint(
&
,
&
,
int
,
int
,
int
&
,
const
&
)
const
{
char _Ac[_MAX_INT_DIG], *_Ep;
char
*
=
_Ac
;
char
;
if
(
!=
)
{
if
((
_Ch
=
.
(*
))
'+'
)
{
*
_Ptr
++ =
'+'
;
++
;
}
else
if
(
_Ch
'-'
)
{
*
_Ptr
++ =
'-'
;
++
;
}
}
bool
=
false
;
for
(;
!=
&&
.
(*
) ==
'0'
; ++
)
{
_Seendigit
=
true
;
}
if
(
_Seendigit
)
*
_Ptr
++ =
'0'
;
for (char *const _Pe = &_Ac[_MAX_INT_DIG - 1]; _First != _Last
for
(
char
*
const
= &
_Ac
[
32
-
1
];
!=
&&
'0'
<= (
_Ch
=
.
(*
)) &&
_Ch
<=
'9'
;
_Seendigit
=
true
, (
void
)++
)
{
*
_Ptr
=
_Ch
;
if
(
_Ptr
_Pe
)
++
_Ptr
;
}
if
(!
_Seendigit
)
_Ptr
=
_Ac
;
*
_Ptr
=
'\0'
;
int
=
0
;
const long _Ans = _CSTD _Stolx(_Ac, &_Ep, 10, &_Errno);
const
long
= ::
(
_Ac
, &
_Ep
,
10
, &
_Errno
);
::
=
::
;
if
(
==
)
_State
|=
::
;
if
(
_Ep
_Ac
||
_Errno
0
||
_Ans
||
_Ans
)
_State
|=
::
;
else
=
_Ans
;
return
(
_State
);
}
void __CLR_OR_THIS_CALL _Tidy()
{
_CSTD free((void *)_Days);
_CSTD free((void *)_Months);
_CSTD free((void *)_Ampm);
}
const
*
;
const
*
;
const
*
;
;
::
;
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdllimport-static-field-def"
#endif /* __clang__ */
template
<
class
,
class
>
__PURE_APPDOMAIN_GLOBAL locale::id time_get<_Elem, _InIt>::id;
#ifdef __clang__
#pragma clang diagnostic pop
#endif /* __clang__ */
template
<
class
,
class
=
<
,
<
> > >
class
:
public
<
,
>
{
public
:
explicit
(
const
char
*
,
=
0
)
:
<
,
>(
,
)
{
}
explicit
(
const
&
,
=
0
)
:
<
,
>(
(
.
()),
)
{
}
protected
:
virtual __CLR_OR_THIS_CALL ~time_get_byname() noexcept
{
}
};
template
<
class
,
class
=
<
,
<
> > >
class
:
public
::
{
public
:
typedef
;
typedef
;
typedef
<
>
;
_OutIt __CLR_OR_THIS_CALL put(_OutIt _Dest,
&
,
,
const
*
,
const
*
,
const
*
)
const
{
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
for
(;
; ++
)
{
if
(
_Ctype_fac
.
(*
)
'%'
)
{
*
++ = *
;
}
else
if
(++
)
{
*
++ =
[-
1
];
break
;
}
else
{
char
=
_Ctype_fac
.
(*
);
char
=
'\0'
;
=
[-
1
];
if
(
_Specifier
'E'
||
_Specifier
'O'
||
_Specifier
'Q'
||
_Specifier
'#'
)
{
if
(++
)
{
*
++ =
_Percent
;
*
++ =
_Specifier
;
break
;
}
_Modifier
=
_Specifier
;
_Specifier
=
_Ctype_fac
.
(*
);
}
=
(
,
,
,
,
_Specifier
,
_Modifier
);
}
}
return
(
);
}
_OutIt __CLR_OR_THIS_CALL put(_OutIt _Dest,
&
,
,
const
*
,
char
,
char
=
'\0'
)
const
{
return
(
(
,
,
,
,
,
));
}
__PURE_APPDOMAIN_GLOBAL static locale::id id; // unique facet id
explicit __CLR_OR_THIS_CALL time_put(size_t _Refs = 0)
:
::
(
)
{
(
_Lobj
);
}
__CLR_OR_THIS_CALL time_put(const _Locinfo& _Lobj, size_t _Refs = 0)
:
::
(
)
{
(
);
}
static size_t __CLRCALL_OR_CDECL _Getcat(const locale::facet **_Ppf = nullptr,
static
__cdecl
(
const
::
**
=
nullptr
,
const
*
=
nullptr
)
{
if
(
!=
nullptr
&& *
==
nullptr
)
{
*
=
new
<
,
>(
(
->
()));
}
}
protected
:
virtual __CLR_OR_THIS_CALL ~time_put() noexcept
{
}
void __CLR_OR_THIS_CALL _Init(const _Locinfo& _Lobj)
{
.
();
}
virtual _OutIt __CLR_OR_THIS_CALL do_put(_OutIt _Dest,
&,
,
const
*
,
char
,
char
=
'\0'
)
const
{
char
[
5
] =
"!%x\0"
;
,
;
;
if
(
'\0'
)
_Fmt
[
2
] =
;
else
{
_Fmt
[
2
] =
;
_Fmt
[
3
] =
;
}
for
(
_Num
=
16
; ;
_Num
*=
2
)
{
_Str
.
(
_Num
,
'\0'
);
if
(
0
(
_Count
=
(&
_Str
.
(),
_Str
.
(),
_Fmt
,
,
.
())))
{
break
;
}
}
return (_STD copy(&_Str[1], &_Str[_Count], _Dest));
return
(::
std
::
(&
_Str
1
], &
_Str
_Count
],
));
}
private
:
::
;
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdllimport-static-field-def"
#endif /* __clang__ */
template
<
class
,
class
>
__PURE_APPDOMAIN_GLOBAL locale::id time_put<_Elem, _OutIt>::id;
#ifdef __clang__
#pragma clang diagnostic pop
#endif /* __clang__ */
template
<
class
>
class _CRTIMP2_PURE_IMPORT time_put<wchar_t, _OutIt>
class
__declspec
(dllimport)
<
wchar_t
,
>
:
public
::
{
public
:
typedef
wchar_t
;
typedef
;
typedef
;
typedef
<
>
;
_OutIt __CLR_OR_THIS_CALL put(_OutIt _Dest,
&
,
,
const
*
,
const
*
,
const
*
)
const
{
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
const
&
= ::
std
::
<
>(
.
());
for
(;
; ++
)
{
if
(
_Ctype_fac
.
(*
)
'%'
)
{
*
++ = *
;
}
else
if
(++
)
{
*
++ =
[-
1
];
break
;
}
else
{
= *
;
char
=
_Ctype_fac
.
(
_Raw
);
char
=
'\0'
;
=
[-
1
];
if
(
_Specifier
'E'
||
_Specifier
'O'
||
_Specifier
'Q'
||
_Specifier
'#'
)
{
if
(++
)
{
*
++ =
_Percent
;
*
++ =
_Raw
;
break
;
}
_Modifier
=
_Specifier
;
_Specifier
=
_Ctype_fac
.
(*
);
}
=
(
,
,
,
,
_Specifier
,
_Modifier
);
}
}
return
(
);
}
_OutIt __CLR_OR_THIS_CALL put(_OutIt _Dest,
&
,
,
const
*
,
char
,
char
=
'\0'
)
const
{
return
(
(
,
,
,
,
,
));
}
__PURE_APPDOMAIN_GLOBAL static locale::id id; // unique facet id
explicit __CLR_OR_THIS_CALL time_put(size_t _Refs = 0)
:
::
(
)
{
(
_Lobj
);
}
__CLR_OR_THIS_CALL time_put(const _Locinfo& _Lobj, size_t _Refs = 0)
:
::
(
)
{
(
);
}
static size_t __CLRCALL_OR_CDECL _Getcat(const locale::facet **_Ppf = nullptr,
static
__cdecl
(
const
::
**
=
nullptr
,
const
*
=
nullptr
)
{
if
(
!=
nullptr
&& *
==
nullptr
)
{
*
=
new
<
,
>(
(
->
()));
}
}
protected
:
virtual __CLR_OR_THIS_CALL ~time_put() noexcept
{
}
__CLR_OR_THIS_CALL time_put(const char *_Locname, size_t _Refs = 0)
:
::
(
)
{
_BEGIN_LOCINFO(_Lobj(_Locname))
(
_Lobj
);
}
void __CLR_OR_THIS_CALL _Init(const _Locinfo& _Lobj)
{
.
();
}
virtual _OutIt __CLR_OR_THIS_CALL do_put(_OutIt _Dest,
&,
,
const
*
,
char
,
char
=
'\0'
)
const
{
wchar_t
[
5
] =
L"!%x\0"
;
,
;
;
if
(
'\0'
)
_Fmt
[
2
] = (
)
;
else
{
_Fmt
[
2
] = (
)
;
_Fmt
[
3
] = (
)
;
}
for
(
_Num
=
16
; ;
_Num
*=
2
)
{
_Str
.
(
_Num
,
'\0'
);
if
(
0
(
_Count
=
(&
_Str
.
(),
_Str
.
(),
_Fmt
,
,
.
())))
break
;
}
return (_STD copy(&_Str[1], &_Str[_Count], _Dest));
return
(::
std
::
(&
_Str
1
], &
_Str
_Count
],
));
}
private
:
::
;
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdllimport-static-field-def"
#endif /* __clang__ */
template
<
class
>
__PURE_APPDOMAIN_GLOBAL locale::id time_put<wchar_t, _OutIt>::id;
#ifdef __clang__
#pragma clang diagnostic pop
#endif /* __clang__ */
#if defined(_CRTBLD)
// CLASS time_put<unsigned short>
template<class _OutIt>
class _CRTIMP2_PURE_IMPORT time_put<unsigned short, _OutIt>
: public locale::facet
{ // facet for converting encoded times to unsigned short text
public:
typedef unsigned short _Elem;
typedef _Elem char_type;
typedef _OutIt iter_type;
typedef ctype<_Elem> _Ctype;
_OutIt __CLR_OR_THIS_CALL put(_OutIt _Dest,
ios_base& _Iosbase, _Elem _Fill, const tm *_Pt,
const _Elem *_Fmtfirst, const _Elem *_Fmtlast) const
{ // put formatted time from _Pt to _Dest for [_Fmtfirst, _Fmtlast)
const _Ctype& _Ctype_fac = _STD use_facet<_Ctype>(_Iosbase.getloc());
for (; _Fmtfirst != _Fmtlast; ++_Fmtfirst)
{
if (_Ctype_fac.narrow(*_Fmtfirst) != '%')
{
*_Dest++ = *_Fmtfirst; // copy literal element
}
else if (++_Fmtfirst == _Fmtlast)
{ // treat trailing % as %%
*_Dest++ = _Fmtfirst[-1];
break;
}
else
{ // get specifier after %
char _Specifier = _Ctype_fac.narrow(*_Fmtfirst);
char _Modifier = '\0';
_Elem _Percent = _Fmtfirst[-1];
if (_Specifier == 'E' || _Specifier == 'O'
|| _Specifier == 'Q' || _Specifier == '#')
{
if (++_Fmtfirst == _Fmtlast)
{ // no specifier, copy %[E0Q#] as literal elements
*_Dest++ = _Percent;
*_Dest++ = _Specifier;
break;
}
// save both qualifier and specifier
_Modifier = _Specifier;
_Specifier = _Ctype_fac.narrow(*_Fmtfirst);
}
_Dest = do_put(_Dest, _Iosbase, _Fill, _Pt,
_Specifier, _Modifier); // convert a single field
}
}
return (_Dest);
}
_OutIt __CLR_OR_THIS_CALL put(_OutIt _Dest,
ios_base& _Iosbase, _Elem _Fill, const tm *_Pt,
char _Specifier, char _Modifier = '\0') const
{ // put formatted time from _Pt to _Dest for _Specifier/_Modifier
return (do_put(_Dest, _Iosbase, _Fill, _Pt, _Specifier, _Modifier));
}
__PURE_APPDOMAIN_GLOBAL static locale::id id; // unique facet id
explicit __CLR_OR_THIS_CALL time_put(size_t _Refs = 0)
: locale::facet(_Refs)
{ // construct from current locale
_BEGIN_LOCINFO(_Lobj)
_Init(_Lobj);
_END_LOCINFO()
}
__CLR_OR_THIS_CALL time_put(const _Locinfo& _Lobj, size_t _Refs = 0)
: locale::facet(_Refs)
{ // construct from specified locale
_Init(_Lobj);
}
static size_t __CLRCALL_OR_CDECL _Getcat(const locale::facet **_Ppf = nullptr,
const locale *_Ploc = nullptr)
{ // return locale category mask and construct standard facet
if (_Ppf != nullptr && *_Ppf == nullptr)
{
*_Ppf = new time_put<_Elem, _OutIt>(_Locinfo(_Ploc->c_str()));
}
return (_X_TIME);
}
protected:
virtual __CLR_OR_THIS_CALL ~time_put() noexcept
{ // destroy the object
}
__CLR_OR_THIS_CALL time_put(const char *_Locname, size_t _Refs = 0)
: locale::facet(_Refs)
{ // construct from specified locale
_BEGIN_LOCINFO(_Lobj(_Locname))
_Init(_Lobj);
_END_LOCINFO()
}
void __CLR_OR_THIS_CALL _Init(const _Locinfo& _Lobj)
{ // initialize from _Lobj
_Tnames = _Lobj._W_Gettnames();
}
virtual _OutIt __CLR_OR_THIS_CALL do_put(_OutIt _Dest,
ios_base&, _Elem, const tm *_Pt,
char _Specifier, char _Modifier = '\0') const
{ // put formatted time from _Pt to _Dest for [_Fmtfirst, _Fmtlast)
wchar_t _Fmt[5] = L"!%x\0"; // ! for nonzero count, null for modifier
size_t _Count, _Num;
wstring _Str;
if (_Modifier == '\0')
{
_Fmt[2] = (_Elem)_Specifier; // conversion rule unspecified
}
else
{ // add both modifier and specifier
_Fmt[2] = (_Elem)_Modifier;
_Fmt[3] = (_Elem)_Specifier;
}
for (_Num = 16; ; _Num *= 2)
{ // convert into ever larger string buffer until success
_Str.append(_Num, '\0');
if (0 < (_Count = _Wcsftime(&*_Str.begin(), _Str.size(),
_Fmt, _Pt, _Tnames._Getptr())))
{
break;
}
}
return (_STD copy(&_Str[1], &_Str[_Count], _Dest));
}
private:
_Locinfo::_Timevec _Tnames; // locale-specific stuff for _Wcsftime
};
// STATIC time_put::id OBJECT
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdllimport-static-field-def"
#endif /* __clang__ */
template<class _OutIt>
__PURE_APPDOMAIN_GLOBAL locale::id time_put<unsigned short, _OutIt>::id;
#ifdef __clang__
#pragma clang diagnostic pop
#endif /* __clang__ */
#endif /* defined(_CRTBLD) */
template
<
class
,
class
=
<
,
<
> > >
class
:
public
<
,
>
{
public
:
explicit
(
const
char
*
,
=
0
)
:
<
,
>(
,
)
{
}
explicit
(
const
&
,
=
0
)
:
<
,
>(
.
(),
)
{
}
protected
:
virtual __CLR_OR_THIS_CALL ~time_put_byname() noexcept
{
}
};
#if defined(_DLL_CPPLIB)
#if !defined(_CRTBLD) || defined(__FORCE_INSTANCE)
template class _CRTIMP2_PURE_IMPORT time_get<char,
template
class
__declspec
(dllimport)
<
char
,
<
char
,
<
char
> > >;
template class _CRTIMP2_PURE_IMPORT time_put<char,
template
class
__declspec
(dllimport)
<
char
,
<
char
,
<
char
> > >;
template _CRTIMP2_PURE void __CLR_OR_THIS_CALL time_get<char,
<
char
,
<
char
>>>::_Getvals(
wchar_t
,
const
&);
template class _CRTIMP2_PURE_IMPORT time_get<wchar_t,
template
class
__declspec
(dllimport)
<
wchar_t
,
<
wchar_t
,
<
wchar_t
> > >;
template class _CRTIMP2_PURE_IMPORT time_put<wchar_t,
template
class
__declspec
(dllimport)
<
wchar_t
,
<
wchar_t
,
<
wchar_t
> > >;
template _CRTIMP2_PURE void __CLR_OR_THIS_CALL time_get<wchar_t,
<
wchar_t
,
<
wchar_t
>>>::_Getvals(
wchar_t
,
const
&);
#endif /* !defined(_CRTBLD) || defined(__FORCE_INSTANCE) */
#ifdef __FORCE_INSTANCE
template class _CRTIMP2_PURE_IMPORT time_get<unsigned short,
istreambuf_iterator<unsigned short, char_traits<unsigned short> > >;
template class _CRTIMP2_PURE_IMPORT time_put<unsigned short,
ostreambuf_iterator<unsigned short, char_traits<unsigned short> > >;
template _CRTIMP2_PURE void __CLR_OR_THIS_CALL time_get<unsigned short,
istreambuf_iterator<unsigned short, char_traits<unsigned short>>>::_Getvals(wchar_t, const _Locinfo&);
#endif /* __FORCE_INSTANCE */
#endif /* defined(_DLL_CPPLIB) */
#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma warning(pop)
#pragma pack(pop)
#endif /* RC_INVOKED */
#endif /* _XLOCTIME_ */
#pragma pack(pop)