#pragma once
#ifndef _XLOCBUF_
#define _XLOCBUF_
#ifndef RC_INVOKED
#include <xlocale>
#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(push)
#pragma warning(disable:
4996
)
template
<
class
,
class
=
wchar_t
,
class
=
<
> >
class _CXX17_DEPRECATE_CODECVT_HEADER wbuffer_convert
:
public
<
,
>
{
enum
{
,
,
,
,
};
enum
{
=
8
};
public
:
typedef
;
typedef
<
char
>
;
typedef
typename
::int_type
;
typedef
typename
::pos_type
;
typedef
typename
::off_type
;
typedef
typename
::state_type
;
explicit
(
*
=
nullptr
)
: _State(), _Pcvt(
new
),
_Mystrbuf(
), _Status(
), _Nback(
0
)
{
(
,
);
}
(
*
,
const
*
)
: _State(), _Pcvt(
),
_Mystrbuf(
), _Status(
), _Nback(
0
)
{
(
,
);
}
(
*
,
const
*
,
)
: _State(
), _Pcvt(
),
_Mystrbuf(
), _Status(
), _Nback(
0
)
{
(
,
);
}
virtual
()
noexcept
{
char
*
= (
char
*)
.
();
while
(
)
{
char
*
;
if
(
.
()
)
.
(
,
'\0'
);
switch
(
->unshift(
,
_Buf
,
_Buf
+
.
(),
_Dest
))
{
case
::ok:
=
;
case
::partial:
{
int
= (
int
)(
_Dest
-
_Buf
);
if
(
0
_Count
&&
::
(
::
(),
(
::
)
->
(
_Buf
,
_Count
)))
return
;
if
(
&&
_Count
0
)
.
(
,
'\0'
);
break
;
}
case
::noconv:
return
;
default
:
return
;
}
}
}
_NODISCARD _Mysb *rdbuf() const
{
return
(
);
}
*
(
*
)
{
*
=
;
=
;
return
(
_Oldstrbuf
);
}
_NODISCARD state_type state() const
{
return
(
);
}
(
const
&) =
delete
;
&
(
const
&) =
delete
;
protected
:
virtual
(
=
::eof())
{
if
(
::eq_int_type(
::eof(),
))
return
(
::not_eof(
));
else
if
(
==
nullptr
||
0
<
|| (
&&
!=
))
return
(
::eof());
else
{
char
*
= (
char
*)
.
();
const
=
::to_char_type(
);
const
*
;
char
*
;
if
(
.
()
)
.
(
,
'\0'
);
for
(
=
; ; )
switch
(
->out(
,
&
_Ch
, &
_Ch
+
1
,
_Src
,
_Buf
,
_Buf
+
.
(),
_Dest
))
{
case
::partial:
case
::ok:
{
int
= (
int
)(
_Dest
-
_Buf
);
if
(
0
_Count
&&
::
(
::
(),
(
::
)
->
(
_Buf
,
_Count
)))
{
return
(
::eof());
}
if
(
_Src
!= &
_Ch
)
{
return
(
);
}
if
(
0
>=
_Count
)
{
if
(
.
() >=
4
*
)
{
return
(
::eof());
}
.
(
,
'\0'
);
}
break
;
}
case
::noconv:
if
(
::eq_int_type(
::eof(),
(
typename
::int_type)
->
(
(
char
*)&
_Ch
,
(
)
sizeof
(
))))
{
return
(
::eof());
}
return
(
);
default
:
return
(
::eof());
}
}
}
virtual
(
=
::eof())
{
if
(
sizeof
(
) /
sizeof
(
[
0
]) <=
||
==
)
return
(
::eof());
else
{
if
(!
::eq_int_type(
::eof(),
))
[
] =
::to_char_type(
);
++
;
if
(
)
=
;
return
(
);
}
}
virtual
()
{
;
if
(
0
>=
)
{
if
(
::eq_int_type(
::eof(),
_Meta
=
()))
{
return
(
_Meta
);
}
[
++] =
::to_char_type(
_Meta
);
}
return
(
::to_int_type(
[
-
1
]));
}
#pragma warning(push)
#pragma warning(disable: 6385) // Reading invalid data from 'this->_Myback':
#pragma warning(disable:
6385
)
virtual
()
{
;
if
(
0
>=
)
{
if
(
::eq_int_type(
::eof(),
_Meta
=
()))
{
return
(
_Meta
);
}
[
++] =
::to_char_type(
_Meta
);
}
return
(
::to_int_type(
[--
]));
}
#pragma warning(pop)
virtual
(
,
::
,
::
=
(
::
)(
::
|
::
))
{
return
(
(-
1
));
}
virtual
(
,
::
=
(
::
)(
::
|
::
))
{
return
(
(-
1
));
}
private
:
()
{
if
(
!=
nullptr
&&
!=
)
{
if
(
)
{
if
(
.
())
{
=
;
}
else
{
=
;
}
}
while
(
)
{
char
*
= (
char
*)
.
();
, *
;
const
char
*
;
int
;
if
(
)
{
if
(
::
(
::
(),
_Meta
=
->
()))
{
=
;
}
else
{
.
(
::
(
_Meta
));
}
}
switch
(
->in(
,
_Buf
,
_Buf
+
.
(),
_Src
,
&
_Ch
, &
_Ch
+
1
,
_Dest
))
{
case
::partial:
case
::ok:
.
((
)
0
,
(
)(
_Src
-
_Buf
));
if
(
_Dest
!= &
_Ch
)
return
(
::to_int_type(
_Ch
));
break
;
case
::noconv:
if
(
.
()
sizeof
(
))
break
;
sizeof
(
));
.
((
)
0
,
sizeof
(
));
return
(
::to_int_type(
_Ch
));
default
:
=
;
}
}
}
return
(
::eof());
}
;
const
*
;
*
;
;
;
[
8
];
;
;
};
template
<
class
,
class
=
wchar_t
,
class
=
<
>,
class
=
<
char
> >
class _CXX17_DEPRECATE_CODECVT_HEADER wstring_convert
{
enum
{
=
8
,
=
16
};
void
(
const
*
=
new
)
{
=
{};
=
;
(
,
);
=
0
;
}
public
:
typedef
<
char
,
<
char
>,
>
;
typedef
<
,
<
>,
>
;
typedef
typename
::state_type
;
typedef
typename
::
::
;
()
: _Has_state(
false
), _Has_berr(
false
), _Has_werr(
false
)
{
();
}
explicit
(
const
*
)
: _Has_state(
false
), _Has_berr(
false
), _Has_werr(
false
)
{
(
);
}
(
const
*
,
)
: _Has_state(
true
), _Has_berr(
false
), _Has_werr(
false
)
{
(
);
=
;
}
explicit
(
const
&
)
: _Berr(
), _Has_state(
false
), _Has_berr(
true
), _Has_werr(
false
)
{
();
}
(
const
&
,
const
&
)
: _Berr(
), _Werr(
), _Has_state(
false
), _Has_berr(
true
), _Has_werr(
true
)
{
();
}
virtual
()
noexcept
{
}
_NODISCARD size_t converted() const noexcept
{
return
(
);
}
_NODISCARD state_type state() const
{
return
(
);
}
_NODISCARD wide_string from_bytes(char _Byte)
{
return
(
(&
, &
+
1
));
}
_NODISCARD wide_string from_bytes(const char *_Ptr)
{
return (from_bytes(_Ptr, _Ptr + _CSTD strlen(_Ptr)));
}
_NODISCARD wide_string from_bytes(const byte_string& _Bstr)
{
const
char
*
=
.
();
return
(
(
_Ptr
,
_Ptr
+
.
()));
}
_NODISCARD wide_string from_bytes(const char *_First, const char *_Last)
(
const
char
*
,
const
char
*
)
{
,
;
const
char
*
=
;
if
(!
)
=
{};
_Wbuf.append((_CSTD size_t)_BUF_INC, (_Elem)'\0');
for
(
=
0
;
;
=
static_cast
<
>(
-
_First_sav
))
{
*
= &
_Wbuf
.
();
*
;
switch
(
->in(
,
,
,
,
_Dest
,
_Dest
+
_Wbuf
.
(),
_Dnext
))
{
case
::partial:
case
::ok:
if
(
_Dest
_Dnext
)
_Wstr
.
(
_Dest
,
static_cast
<
>(
_Dnext
-
_Dest
));
else
if
(
_Wbuf
.
()
)
_Wbuf
.
(
static_cast
<
>(
),
'\0'
);
else
if
(
)
return
(
);
else
_THROW(range_error("bad conversion"));
throw
(
"bad conversion"
);
break
;
case
::noconv:
for
(;
; ++
)
_Wstr
.
((
)(
unsigned
char
)*
);
break
;
default
:
if
(
)
return
(
);
else
_THROW(range_error("bad conversion"));
throw
(
"bad conversion"
);
}
}
return
(
_Wstr
);
}
_NODISCARD byte_string to_bytes(_Elem _Char)
{
return
(
(&
, &
+
1
));
}
_NODISCARD byte_string to_bytes(const _Elem *_Wptr)
{
const
*
=
;
while
((
)*
_Next
0
)
{
++
_Next
;
}
return
(
(
,
_Next
));
}
_NODISCARD byte_string to_bytes(const wide_string& _Wstr)
{
const
*
=
.
();
return
(
(
_Wptr
,
_Wptr
+
.
()));
}
_NODISCARD byte_string to_bytes(const _Elem *_First, const _Elem *_Last)
{
,
;
const
*
=
;
if
(!
)
=
{};
_Bbuf.append((_CSTD size_t)_BUF_INC, '\0');
for
(
=
0
;
;
=
static_cast
<
>(
-
_First_sav
))
{
char
*
= &
_Bbuf
.
();
char
*
;
switch
(
->out(
,
,
,
,
_Dest
,
_Dest
+
_Bbuf
.
(),
_Dnext
))
{
case
::partial:
case
::ok:
if
(
_Dest
_Dnext
)
_Bstr.append(_Dest, (_CSTD size_t)(_Dnext - _Dest));
_Bstr
.
(
_Dest
, (::
)(
_Dnext
-
_Dest
));
else
if
(
_Bbuf
.
()
)
_Bbuf.append((_CSTD size_t)_BUF_INC, '\0');
else
if
(
)
return
(
);
else
_THROW(range_error("bad conversion"));
throw
(
"bad conversion"
);
break
;
case
::noconv:
for
(;
; ++
)
_Bstr
.
((
char
)(
)*
);
break
;
default
:
if
(
)
return
(
);
else
_THROW(range_error("bad conversion"));
throw
(
"bad conversion"
);
}
}
return
(
_Bstr
);
}
(
const
&) =
delete
;
&
(
const
&) =
delete
;
private
:
const
*
;
;
;
;
;
bool
;
bool
;
bool
;
;
};
#pragma warning(pop)
#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma warning(pop)
#pragma pack(pop)
#endif /* RC_INVOKED */
#endif /* _XLOCBUF_ */
#pragma pack(pop)