#pragma once
#ifndef _CODECVT_
#define _CODECVT_
#ifndef RC_INVOKED
#include <locale>
#include <cwchar>
#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
#pragma warning(disable: 4127) // conditional expression is constant
#pragma warning(disable:
4127
)
#pragma warning(disable: 6326) // Potential comparison of a constant with another constant.
#pragma warning(disable:
6326
)
#define _LITTLE_FIRST 1
#define _BIG_FIRST 2
#define _BYTES_PER_WORD 4
enum _CXX17_DEPRECATE_CODECVT_HEADER codecvt_mode {
=
4
,
=
2
,
=
1
};
typedef _CSTD mbstate_t _Statype;
#pragma warning(push)
#pragma warning(disable: 4996) // was declared deprecated
#pragma warning(disable:
4996
)
template
<
class
,
unsigned
long
=
0x10ffff
,
= (
)
0
>
class _CXX17_DEPRECATE_CODECVT_HEADER codecvt_utf8
:
public
<
,
char
,
>
{
public
:
typedef
<
,
char
,
>
;
typedef
typename
::
;
typedef
char
;
typedef
;
typedef
;
typedef
;
explicit
(
=
0
)
:
(
)
{
}
virtual __CLR_OR_THIS_CALL ~codecvt_utf8() noexcept
{
}
protected
:
virtual result __CLR_OR_THIS_CALL do_in(_Statype& _State,
const
*
,
const
*
,
const
*&
,
*
,
*
,
*&
)
const
override
{
char
*
= (
char
*)&
;
=
;
=
;
while
(
&&
)
{
unsigned
long
=
static_cast
<
unsigned
char
>(*
);
unsigned
long
;
int
;
if
(
_By
0x80
)
_Ch
=
_By
,
_Nextra
=
0
;
else
if
(
_By
0xc0
)
{
++
;
return
(
::
);
}
else
if
(
_By
0xe0
)
_Ch
=
_By
&
0x1f
,
_Nextra
=
1
;
else
if
(
_By
0xf0
)
_Ch
=
_By
&
0x0f
,
_Nextra
=
2
;
else
if
(
_By
0xf8
)
_Ch
=
_By
&
0x07
,
_Nextra
=
3
;
else
_Ch
=
_By
&
0x03
,
_Nextra
=
_By
0xfc
?
4
:
5
;
if
(
_Nextra
0
)
++
;
else
if
(
-
_Nextra
+
1
)
break
;
else
for
(++
;
0
_Nextra
; --
_Nextra
, ++
)
if
((
_By
= (
unsigned
char
)*
)
0x80
||
0xc0
<=
_By
)
return
(
::
);
else
_Ch
=
_Ch
<<
6
| (
_By
&
0x3f
);
if
(*
_Pstate
0
)
{
*
_Pstate
=
1
;
if
((
&
) !=
0
&&
_Ch
==
0xfeff
)
{
const
=
(
,
,
,
,
,
,
);
if
(
_Ans
::
)
{
*
_Pstate
=
0
;
=
;
}
return
(
_Ans
);
}
}
if
(
_Ch
)
return
(
::
);
*
++ = (
)
_Ch
;
}
return
(
?
::
:
::
);
}
virtual result __CLR_OR_THIS_CALL do_out(_Statype& _State,
const
*
,
const
*
,
const
*&
,
*
,
*
,
*&
)
const
override
{
char
*
= (
char
*)&
;
=
;
=
;
while
(
&&
)
{
;
int
;
unsigned
long
= (
unsigned
long
)*
;
if
(
_Ch
)
return
(
::
);
if
(
_Ch
0x0080
)
{
_By
= (
)
_Ch
;
_Nextra
=
0
;
}
else
if
(
_Ch
0x0800
)
{
_By
= (
)(
0xc0
|
_Ch
>>
6
);
_Nextra
=
1
;
}
else
if
(
_Ch
0x00010000
)
{
_By
= (
)(
0xe0
|
_Ch
>>
12
);
_Nextra
=
2
;
}
else
if
(
_Ch
0x00200000
)
{
_By
= (
)(
0xf0
|
_Ch
>>
18
);
_Nextra
=
3
;
}
else
if
(
_Ch
0x04000000
)
{
_By
= (
)(
0xf8
|
_Ch
>>
24
);
_Nextra
=
4
;
}
else
{
_By
= (
)(
0xfc
| (
_Ch
>>
30
&
0x03
));
_Nextra
=
5
;
}
if
(*
_Pstate
0
)
{
*
_Pstate
=
1
;
if
((
&
) !=
0
)
{
if
(
-
3
+
1
+
_Nextra
)
{
return
(
::
);
}
*
++ = (
)(
unsigned
char
)
0xef
;
*
++ = (
)(
unsigned
char
)
0xbb
;
*
++ = (
)(
unsigned
char
)
0xbf
;
}
}
if
(
-
1
+
_Nextra
)
{
break
;
}
++
;
for
(*
++ =
_By
;
0
_Nextra
; )
{
*
++ = (
)((
_Ch
>>
6
* --
_Nextra
&
0x3f
) |
0x80
);
}
}
return
(
?
::
:
::
);
}
virtual result __CLR_OR_THIS_CALL do_unshift(_Statype&,
*
,
*,
*&
)
const
override
{
=
;
return
(
::
);
}
virtual int __CLR_OR_THIS_CALL do_length(_Statype& _State, const _Byte *_First1,
virtual
int
(
&
,
const
*
,
const
*
,
)
const
noexcept
override
{
=
0
;
=
;
while
(
_Wchars
&&
)
{
const
*
;
*
;
;
switch
(
(
_Mystate
,
,
,
_Mid1
,
&
_Ch
, &
_Ch
+
1
,
_Mid2
))
{
case
::
:
return
((
int
)(
_Wchars
+ (
-
)));
case
::
:
if
(
_Mid2
== &
_Ch
+
1
)
{
++
_Wchars
;
}
=
_Mid1
;
break
;
default
:
return
((
int
)
_Wchars
);
}
}
return
((
int
)
_Wchars
);
}
virtual bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept override
virtual
bool
()
const
noexcept
override
{
return
(
false
);
}
virtual int __CLR_OR_THIS_CALL do_max_length() const noexcept override
virtual
int
()
const
noexcept
override
{
return
((
& (
|
)) !=
0
?
9
:
6
);
}
virtual int __CLR_OR_THIS_CALL do_encoding() const noexcept override
virtual
int
()
const
noexcept
override
{
return
((
& (
|
)) !=
0
? -
1
:
0
);
}
};
template
<
class
,
unsigned
long
=
0x10ffff
,
= (
)
0
>
class _CXX17_DEPRECATE_CODECVT_HEADER codecvt_utf16
:
public
<
,
char
,
>
{
enum
{
=
2
};
public
:
typedef
<
,
char
,
>
;
typedef
typename
::
;
typedef
char
;
typedef
;
typedef
;
typedef
;
explicit
(
=
0
)
:
(
)
{
}
virtual __CLR_OR_THIS_CALL ~codecvt_utf16() noexcept
{
}
protected
:
virtual result __CLR_OR_THIS_CALL do_in(_Statype& _State,
const
*
,
const
*
,
const
*&
,
*
,
*
,
*&
)
const
{
char
*
= (
char
*)&
;
=
;
=
;
while
(
<=
-
&&
!=
)
{
unsigned
char
*
= (
unsigned
char
*)
;
unsigned
long
;
unsigned
short
,
;
if (*_Pstate == _LITTLE_FIRST)
_Ch0
= (
unsigned
short
)(
_Ptr
[
1
] <<
8
|
_Ptr
[
0
]);
else if (*_Pstate == _BIG_FIRST)
_Ch0
= (
unsigned
short
)(
_Ptr
[
0
] <<
8
|
_Ptr
[
1
]);
else
{
char
= (
&
) !=
0
? _LITTLE_FIRST : _BIG_FIRST;
if
((
&
) !=
0
)
_Ch0
= (
unsigned
short
)(
_Ptr
[
1
] <<
8
|
_Ptr
[
0
]);
else
_Ch0
= (
unsigned
short
)(
_Ptr
[
0
] <<
8
|
_Ptr
[
1
]);
if
((
&
) ==
0
|| (
_Ch0
0xfeff
&&
_Ch0
0xfffe
))
*
_Pstate
=
_Default_endian
;
else
{
+=
;
*
_Pstate
=
_Ch0
0xfeff
?
_Default_endian
:
3
-
_Default_endian
;
=
(
,
,
,
,
,
,
);
if
(
_Ans
::
)
{
*
_Pstate
=
0
;
=
;
}
return
(
_Ans
);
}
}
if
(
_Ch0
0xd800
||
0xdc00
<=
_Ch0
)
{
+=
;
_Ch
=
_Ch0
;
}
else
if
(
-
2
*
)
break
;
else
{
if (*_Pstate == _LITTLE_FIRST)
_Ch1
=
static_cast
<
unsigned
short
>(
_Ptr
[
3
] <<
8
|
_Ptr
[
2
]);
else
_Ch1
=
static_cast
<
unsigned
short
>(
_Ptr
[
2
] <<
8
|
_Ptr
[
3
]);
if
(
_Ch1
0xdc00
||
0xe000
<=
_Ch1
)
return
(
::
);
+=
2
*
;
_Ch
= (
unsigned
long
)(
_Ch0
-
0xd800
+
0x0040
) <<
10
| (
_Ch1
-
0xdc00
);
}
if
(
_Ch
)
return
(
::
);
*
++ = (
)
_Ch
;
}
return
(
?
::
:
::
);
}
virtual result __CLR_OR_THIS_CALL do_out(_Statype& _State,
const
*
,
const
*
,
const
*&
,
*
,
*
,
*&
)
const
{
char
*
= (
char
*)&
;
=
;
=
;
if
(*
_Pstate
0
)
{
*_Pstate = (_Mymode & little_endian) != 0 ? _LITTLE_FIRST : _BIG_FIRST;
*
_Pstate
= (
&
) !=
0
?
1
:
2
;
if
((
&
) !=
0
)
{
if
(
-
3
*
)
{
return
(
::
);
}
if (*_Pstate == _LITTLE_FIRST)
{
*
++ = (
)(
unsigned
char
)
0xff
;
*
++ = (
)(
unsigned
char
)
0xfe
;
}
else
{
*
++ = (
)(
unsigned
char
)
0xfe
;
*
++ = (
)(
unsigned
char
)
0xff
;
}
}
}
while
(
&&
<=
-
)
{
bool
=
false
;
unsigned
long
= (
unsigned
long
)*
++;
if
((
0x10ffff
?
:
0x10ffff
)
_Ch
)
{
return
(
::
);
}
if
(
_Ch
<=
0xffff
)
{
if
(
0xd800
<=
_Ch
&&
_Ch
0xdc00
)
{
return
(
::
);
}
}
else
if
(
-
2
*
)
{
--
;
return
(
::
);
}
else
{
_Extra
=
true
;
}
if (*_Pstate == _LITTLE_FIRST)
{
if
(
_Extra
)
{
unsigned
short
= (
unsigned
short
)(
0xd800
| (
unsigned
short
)(
_Ch
>>
10
) -
0x0040
);
*
++ = (
)
_Ch0
;
*
++ = (
)(
_Ch0
>>
8
);
_Ch0
= (
unsigned
short
)(
0xdc00
| ((
unsigned
short
)
_Ch
&
0x03ff
));
*
++ = (
)
_Ch0
;
*
++ = (
)(
_Ch0
>>
8
);
}
else
{
*
++ = (
)
_Ch
;
*
++ = (
)(
_Ch
>>
8
);
}
}
else
{
if
(
_Extra
)
{
unsigned
short
= (
unsigned
short
)(
0xd800
| (
unsigned
short
)(
_Ch
>>
10
) -
0x0040
);
*
++ = (
)(
_Ch0
>>
8
);
*
++ = (
)
_Ch0
;
_Ch0
= (
unsigned
short
)(
0xdc00
| ((
unsigned
short
)
_Ch
&
0x03ff
));
*
++ = (
)(
_Ch0
>>
8
);
*
++ = (
)
_Ch0
;
}
else
{
*
++ = (
)(
_Ch
>>
8
);
*
++ = (
)
_Ch
;
}
}
}
return
(
?
::
:
::
);
}
virtual result __CLR_OR_THIS_CALL do_unshift(_Statype&,
*
,
*,
*&
)
const
{
=
;
return
(
::
);
}
virtual int __CLR_OR_THIS_CALL do_length(_Statype& _State, const _Byte *_First1,
virtual
int
(
&
,
const
*
,
const
*
,
)
const
noexcept
{
=
0
;
=
;
while
(
_Wchars
&&
)
{
const
*
;
*
;
;
switch
(
(
_Mystate
,
,
,
_Mid1
,
&
_Ch
, &
_Ch
+
1
,
_Mid2
))
{
case
::
:
return
((
int
)(
_Wchars
+ (
-
)));
case
::
:
if
(
_Mid2
== &
_Ch
+
1
)
{
++
_Wchars
;
}
=
_Mid1
;
break
;
default
:
return
((
int
)
_Wchars
);
}
}
return
((
int
)
_Wchars
);
}
virtual bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept
virtual
bool
()
const
noexcept
{
return
(
false
);
}
virtual int __CLR_OR_THIS_CALL do_max_length() const noexcept
virtual
int
()
const
noexcept
{
return
((
& (
|
)) !=
0
?
3
*
:
6
*
);
}
virtual int __CLR_OR_THIS_CALL do_encoding() const noexcept
virtual
int
()
const
noexcept
{
return
((
& (
|
)) !=
0
? -
1
:
0
);
}
};
template
<
class
,
unsigned
long
=
0x10ffff
,
= (
)
0
>
class _CXX17_DEPRECATE_CODECVT_HEADER codecvt_utf8_utf16
:
public
<
,
char
,
>
{
public
:
typedef
<
,
char
,
>
;
typedef
typename
::
;
typedef
char
;
typedef
;
typedef
;
typedef
;
static_assert
(
sizeof
(
unsigned
short
) <=
sizeof
(
),
"state_type too small"
);
explicit
(
=
0
)
:
(
)
{
}
virtual __CLR_OR_THIS_CALL ~codecvt_utf8_utf16() noexcept
{
}
protected
:
virtual result __CLR_OR_THIS_CALL do_in(_Statype& _State,
const
*
,
const
*
,
const
*&
,
*
,
*
,
*&
)
const
{
unsigned
short
*
= (
unsigned
short
*)&
;
=
;
=
;
while
(
&&
)
{
unsigned
long
=
static_cast
<
unsigned
char
>(*
);
unsigned
long
;
int
,
;
if
(*
_Pstate
>
1
)
{
if
(
_By
0x80
||
0xc0
<=
_By
)
{
return
(
::
);
}
++
;
*
++ = (
)(*
_Pstate
| (
_By
&
0x3f
));
*
_Pstate
=
1
;
continue
;
}
if
(
_By
0x80
)
{
_Ch
=
_By
;
_Nextra
=
0
;
}
else
if
(
_By
0xc0
)
{
++
;
return
(
::
);
}
else
if
(
_By
0xe0
)
{
_Ch
=
_By
&
0x1f
;
_Nextra
=
1
;
}
else
if
(
_By
0xf0
)
{
_Ch
=
_By
&
0x0f
;
_Nextra
=
2
;
}
else
if
(
_By
0xf8
)
{
_Ch
=
_By
&
0x07
;
_Nextra
=
3
;
}
else
{
_Ch
=
_By
&
0x03
;
_Nextra
=
_By
0xfc
?
4
:
5
;
}
_Nskip
=
_Nextra
3
?
0
:
1
;
=
;
if
(
_Nextra
0
)
{
++
;
}
else
if
(
-
_Nextra
+
1
-
_Nskip
)
{
break
;
}
else
{
for
(++
;
_Nskip
_Nextra
; --
_Nextra
, ++
)
{
if
((
_By
= (
unsigned
char
)*
)
0x80
||
0xc0
<=
_By
)
{
return
(
::
);
}
_Ch
=
_Ch
<<
6
| (
_By
&
0x3f
);
}
}
if
(
0
_Nskip
)
{
_Ch
<<=
6
;
}
if
((
0x10ffff
?
:
0x10ffff
)
_Ch
)
{
return
(
::
);
}
if
(
0xffff
_Ch
)
{
unsigned
short
= (
unsigned
short
)(
0xd800
| (
_Ch
>>
10
) -
0x0040
);
*
++ = (
)
_Ch0
;
*
_Pstate
= (
unsigned
short
)(
0xdc00
| (
_Ch
&
0x03ff
));
continue
;
}
if
(
_Nskip
0
)
{
if
(
)
{
=
;
break
;
}
if
((
_By
= (
unsigned
char
)*
++)
0x80
||
0xc0
<=
_By
)
{
return
(
::
);
}
_Ch
|=
_By
&
0x3f
;
}
if
(*
_Pstate
0
)
{
*
_Pstate
=
1
;
if
((
&
) !=
0
&&
_Ch
==
0xfeff
)
{
=
(
,
,
,
,
,
,
);
if
(
_Ans
::
)
{
*
_Pstate
=
0
;
=
;
}
return
(
_Ans
);
}
}
*
++ = (
)
_Ch
;
}
return
(
?
::
:
::
);
}
virtual result __CLR_OR_THIS_CALL do_out(_Statype& _State,
const
*
,
const
*
,
const
*&
,
*
,
*
,
*&
)
const
{
unsigned
short
*
= (
unsigned
short
*)&
;
=
;
=
;
while
(
&&
)
{
unsigned
long
;
unsigned
short
= (
unsigned
short
)*
;
bool
=
false
;
if
(
1
*
_Pstate
)
{
if
(
_Ch1
0xdc00
||
0xe000
<=
_Ch1
)
{
return
(
::
);
}
_Ch
=
static_cast
<
unsigned
long
>((*
_Pstate
<<
10
) | (
_Ch1
-
0xdc00
));
}
else
if
(
0xd800
<=
_Ch1
&&
_Ch1
0xdc00
)
{
_Ch
=
static_cast
<
unsigned
long
>((
_Ch1
-
0xd800
+
0x0040
) <<
10
);
_Save
=
true
;
}
else
{
_Ch
=
_Ch1
;
}
;
int
;
if
(
_Ch
0x0080
)
{
_By
= (
)
_Ch
;
_Nextra
=
0
;
}
else
if
(
_Ch
0x0800
)
{
_By
= (
)(
0xc0
|
_Ch
>>
6
);
_Nextra
=
1
;
}
else
if
(
_Ch
0x10000
)
{
_By
= (
)(
0xe0
|
_Ch
>>
12
);
_Nextra
=
2
;
}
else
{
_By
= (
)(
0xf0
|
_Ch
>>
18
);
_Nextra
=
3
;
}
int
=
_Nextra
3
?
_Nextra
+
1
:
_Save
?
1
:
3
;
if
(
-
_Nput
)
{
break
;
}
if
(*
_Pstate
0
&& (
&
) !=
0
)
{
if
(
-
3
+
_Nput
)
{
break
;
}
*
++ = (
)(
unsigned
char
)
0xef
;
*
++ = (
)(
unsigned
char
)
0xbb
;
*
++ = (
)(
unsigned
char
)
0xbf
;
}
++
;
if
(
_Save
||
_Nextra
3
)
{
*
++ =
_By
;
--
_Nput
;
}
for
(;
0
_Nput
; --
_Nput
)
{
*
++ = (
)((
_Ch
>>
6
* --
_Nextra
&
0x3f
) |
0x80
);
}
*
_Pstate
= (
unsigned
short
)(
_Save
?
_Ch
>>
10
:
1
);
}
return
(
?
::
:
::
);
}
virtual result __CLR_OR_THIS_CALL do_unshift(_Statype& _State,
*
,
*,
*&
)
const
{
unsigned
short
*
= (
unsigned
short
*)&
;
=
;
return
(
1
*
_Pstate
?
::
:
::
);
}
virtual int __CLR_OR_THIS_CALL do_length(_Statype& _State, const _Byte *_First1,
virtual
int
(
&
,
const
*
,
const
*
,
)
const
noexcept
{
=
0
;
=
;
while
(
_Wchars
&&
)
{
const
*
;
*
;
;
switch
(
(
_Mystate
,
,
,
_Mid1
,
&
_Ch
, &
_Ch
+
1
,
_Mid2
))
{
case
::
:
return
((
int
)(
_Wchars
+ (
-
)));
case
::
:
if
(
_Mid2
== &
_Ch
+
1
)
++
_Wchars
;
=
_Mid1
;
break
;
default
:
return
((
int
)
_Wchars
);
}
}
return
((
int
)
_Wchars
);
}
virtual bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept
virtual
bool
()
const
noexcept
{
return
(
false
);
}
virtual int __CLR_OR_THIS_CALL do_max_length() const noexcept
virtual
int
()
const
noexcept
{
return
((
&
) !=
0
?
9
: (
&
) !=
0
?
7
:
6
);
}
virtual int __CLR_OR_THIS_CALL do_encoding() const noexcept
virtual
int
()
const
noexcept
{
return
(
0
);
}
};
#pragma warning(pop)
#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma warning(pop)
#pragma pack(pop)
#endif /* RC_INVOKED */
#endif /* _CODECVT_ */
#pragma pack(pop)