22#pragma GCC diagnostic push
23#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
28 enum class charset_id : uint16_t {
54 constexpr charset_id wchar_t_charset = charset_id::utf16;
56 constexpr charset_id system_charset = charset_id::utf16;
58 constexpr charset_id system_charset = charset_id::system;
61 constexpr charset_id wchar_t_charset = charset_id::utf32;
62 constexpr charset_id system_charset = charset_id::system;
72 inline charset_id charset_from_name(_In_z_
const char* name)
75 bool operator()(_In_z_
const char* a, _In_z_
const char* b)
const
77 return stricmp(a, b) < 0;
80 static const std::map<const char*, charset_id, charset_less> charsets = {
81 {
"UNICODE-1-1-UTF-7", charset_id::utf7 },
82 {
"UTF-7", charset_id::utf7 },
83 {
"CSUNICODE11UTF7", charset_id::utf7 },
85 {
"UTF-8", charset_id::utf8 },
86 {
"UTF8", charset_id::utf8 },
88 {
"UTF-16", charset_id::utf16 },
89#if BYTE_ORDER == BIG_ENDIAN
90 {
"UTF-16BE", charset_id::utf16 },
92 {
"UTF-16LE", charset_id::utf16 },
95 {
"UTF-32", charset_id::utf32 },
96#if BYTE_ORDER == BIG_ENDIAN
97 {
"UTF-32BE", charset_id::utf32 },
99 {
"UTF-32LE", charset_id::utf32 },
102 {
"CP1250", charset_id::windows1250 },
103 {
"MS-EE", charset_id::windows1250 },
104 {
"WINDOWS-1250", charset_id::windows1250 },
106 {
"CP1251", charset_id::windows1251 },
107 {
"MS-CYRL", charset_id::windows1251 },
108 {
"WINDOWS-1251", charset_id::windows1251 },
110 {
"CP1252", charset_id::windows1252 },
111 {
"MS-ANSI", charset_id::windows1252 },
112 {
"WINDOWS-1252", charset_id::windows1252 },
114 if (
auto el = charsets.find(name); el != charsets.end())
116 return charset_id::system;
126 template <
class TR = std::
char_traits<
char>,
class AX = std::allocator<
char>>
127 charset_id charset_from_name(_In_
const std::basic_string<char, TR, AX>& name)
129 return charset_from_name(name.c_str());
135 template <
typename T_from,
typename T_to>
139 charset_id m_from, m_to;
147 m_from_wincp = to_encoding(from);
148 m_to_wincp = to_encoding(to);
150 m_handle = iconv_open(to_encoding(to), to_encoding(from));
151 if (m_handle == (iconv_t)-1)
152 throw std::system_error(errno, std::system_category(),
"iconv_open failed");
159 iconv_close(m_handle);
163 charset_id from_encoding()
const {
return m_from; }
164 charset_id to_encoding()
const {
return m_to; }
173 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
175 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
176 _In_reads_or_z_opt_(count_src)
const T_from* src, _In_
size_t count_src)
178 _Assume_(src || !count_src);
179 count_src = strnlen<T_from>(src, count_src);
180 if (!count_src) _Unlikely_
184 constexpr DWORD dwFlagsMBWC = MB_PRECOMPOSED;
185 constexpr DWORD dwFlagsWCMB = 0;
186 constexpr LPCCH lpDefaultChar = NULL;
189 if (m_from_wincp == m_to_wincp) _Unlikely_{
190 dst.append(
reinterpret_cast<const T_to*
>(src), count_src);
194#pragma warning(suppress: 4127)
195 if constexpr (
sizeof(T_from) ==
sizeof(
char) &&
sizeof(T_to) ==
sizeof(
wchar_t)) {
196 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
199 WCHAR szStackBuffer[1024 /
sizeof(WCHAR)];
200#pragma warning(suppress: 6387)
201 int cch = MultiByteToWideChar(
static_cast<UINT
>(m_from_wincp), dwFlagsMBWC,
reinterpret_cast<LPCCH
>(src),
static_cast<int>(count_src), szStackBuffer, _countof(szStackBuffer));
204 dst.append(
reinterpret_cast<const T_to*
>(szStackBuffer), count_src != SIZE_MAX ? wcsnlen(szStackBuffer, cch) :
static_cast<size_t>(cch) - 1);
207 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
209 cch = MultiByteToWideChar(
static_cast<UINT
>(m_from_wincp), dwFlagsMBWC,
reinterpret_cast<LPCCH
>(src),
static_cast<int>(count_src), NULL, 0);
210 std::unique_ptr<WCHAR[]> szBuffer(
new WCHAR[cch]);
211 cch = MultiByteToWideChar(
static_cast<UINT
>(m_from_wincp), dwFlagsMBWC,
reinterpret_cast<LPCCH
>(src),
static_cast<int>(count_src), szBuffer.get(), cch);
212 dst.append(
reinterpret_cast<const T_to*
>(szBuffer.get()), count_src != SIZE_MAX ? wcsnlen(szBuffer.get(), cch) :
static_cast<size_t>(cch) - 1);
215 throw std::system_error(GetLastError(), std::system_category(),
"MultiByteToWideChar failed");
218#pragma warning(suppress: 4127)
219 if constexpr (
sizeof(T_from) ==
sizeof(
wchar_t) &&
sizeof(T_to) ==
sizeof(
char)) {
220 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
223 CHAR szStackBuffer[1024 /
sizeof(CHAR)];
224#pragma warning(suppress: 6387)
225 int cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB,
reinterpret_cast<LPCWCH
>(src),
static_cast<int>(count_src), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, NULL);
228 dst.append(
reinterpret_cast<const T_to*
>(szStackBuffer), count_src != SIZE_MAX ? strnlen(szStackBuffer, cch) :
static_cast<size_t>(cch) - 1);
231 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
233 cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB,
reinterpret_cast<LPCWCH
>(src),
static_cast<int>(count_src), NULL, 0, lpDefaultChar, NULL);
234 std::unique_ptr<CHAR[]> szBuffer(
new CHAR[cch]);
235 cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB,
reinterpret_cast<LPCWCH
>(src),
static_cast<int>(count_src), szBuffer.get(), cch, lpDefaultChar, NULL);
236 dst.append(
reinterpret_cast<const T_to*
>(szBuffer.get()), count_src != SIZE_MAX ? strnlen(szBuffer.get(), cch) :
static_cast<size_t>(cch) - 1);
239 throw std::system_error(GetLastError(), std::system_category(),
"WideCharToMultiByte failed");
242#pragma warning(suppress: 4127)
243 if constexpr (
sizeof(T_from) ==
sizeof(
char) &&
sizeof(T_to) ==
sizeof(
char)) {
244 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
247 WCHAR szStackBufferMBWC[512 /
sizeof(WCHAR)];
248#pragma warning(suppress: 6387)
249 int cch = MultiByteToWideChar(
static_cast<UINT
>(m_from_wincp), dwFlagsMBWC,
reinterpret_cast<LPCCH
>(src),
static_cast<int>(count_src), szStackBufferMBWC, _countof(szStackBufferMBWC));
252 size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szStackBufferMBWC, cch) :
static_cast<size_t>(cch) - 1;
253 _Assume_(count_inter < INT_MAX);
256 CHAR szStackBufferWCMB[512 /
sizeof(CHAR)];
257#pragma warning(suppress: 6387)
258 cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC,
static_cast<int>(count_inter), szStackBufferWCMB, _countof(szStackBufferWCMB), lpDefaultChar, NULL);
261 dst.append(
reinterpret_cast<const T_to*
>(szStackBufferWCMB), strnlen(szStackBufferWCMB, cch));
264 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
266 cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC,
static_cast<int>(count_inter), NULL, 0, lpDefaultChar, NULL);
267 std::unique_ptr<CHAR[]> szBufferWCMB(
new CHAR[cch]);
268 cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC,
static_cast<int>(count_inter), szBufferWCMB.get(), cch, lpDefaultChar, NULL);
269 dst.append(
reinterpret_cast<const T_to*
>(szBufferWCMB.get()), strnlen(szBufferWCMB.get(), cch));
272 throw std::system_error(GetLastError(), std::system_category(),
"WideCharToMultiByte failed");
274 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
276 cch = MultiByteToWideChar(
static_cast<UINT
>(m_from_wincp), dwFlagsMBWC,
reinterpret_cast<LPCCH
>(src),
static_cast<int>(count_src), NULL, 0);
277 std::unique_ptr<WCHAR[]> szBufferMBWC(
new WCHAR[cch]);
278 cch = MultiByteToWideChar(
static_cast<UINT
>(m_from_wincp), dwFlagsMBWC,
reinterpret_cast<LPCCH
>(src),
static_cast<int>(count_src), szBufferMBWC.get(), cch);
279 size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szBufferMBWC.get(), cch) :
static_cast<size_t>(cch) - 1;
282 cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB, szBufferMBWC.get(),
static_cast<int>(count_inter), NULL, 0, lpDefaultChar, NULL);
283 std::unique_ptr<CHAR[]> szBufferWCMB(
new CHAR[cch]);
284 cch = WideCharToMultiByte(
static_cast<UINT
>(m_to_wincp), dwFlagsWCMB, szBufferMBWC.get(),
static_cast<int>(count_inter), szBufferWCMB.get(), cch, lpDefaultChar, NULL);
285 dst.append(
reinterpret_cast<const T_to*
>(szBufferWCMB.get()), strnlen(szBufferWCMB.get(), cch));
288 throw std::system_error(GetLastError(), std::system_category(),
"MultiByteToWideChar failed");
291 dst.reserve(dst.size() + count_src);
292 T_to buf[1024 /
sizeof(T_to)];
293 size_t src_size = stdex::mul(
sizeof(T_from), count_src);
295 T_to* output = &buf[0];
296 size_t output_size =
sizeof(buf);
298 iconv(m_handle,
const_cast<char**
>(
reinterpret_cast<const char**
>(&src)), &src_size,
reinterpret_cast<char**
>(&output), &output_size);
299 dst.append(buf,
reinterpret_cast<T_to*
>(
reinterpret_cast<char*
>(buf) +
sizeof(buf) - output_size));
304 throw std::system_error(errno, std::system_category(),
"iconv failed");
315 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
317 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
318 _In_z_
const T_from* src)
320 strcat(dst, src, SIZE_MAX);
329 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
331 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
332 _In_
const std::basic_string_view<T_from, std::char_traits<T_from>> src)
334 strcat(dst, src.data(), src.size());
344 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
346 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
347 _In_reads_or_z_opt_(count_src)
const T_from* src, _In_
size_t count_src)
350 strcat(dst, src, count_src);
359 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
361 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
362 _In_z_
const T_from* src)
364 strcpy(dst, src, SIZE_MAX);
373 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
375 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
376 _In_
const std::basic_string_view<T_from, std::char_traits<T_from>> src)
378 strcpy(dst, src.data(), src.size());
387 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
388 std::basic_string<T_to, TR_to, AX_to>
convert(_In_reads_or_z_opt_(count_src)
const T_from* src, _In_
size_t count_src)
390 std::basic_string<T_to, TR_to, AX_to> dst;
391 strcat(dst, src, count_src);
400 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
401 std::basic_string<T_to, TR_to, AX_to>
convert(_In_z_
const T_from* src)
411 template <
class TR_to = std::
char_traits<T_to>,
class AX_to = std::allocator<T_to>>
412 std::basic_string<T_to, TR_to, AX_to>
convert(_In_
const std::basic_string_view<T_from, std::char_traits<T_from>> src)
414 return convert(src.data(), src.size());
420 iconv(m_handle, NULL, NULL, NULL, NULL);
424 static charset_id system_charset()
427 return static_cast<charset_id
>(GetACP());
429 return charset_from_name(nl_langinfo(CODESET));
435 static UINT to_encoding(_In_ charset_id charset)
438 charset == charset_id::system ? GetACP() :
439 charset == charset_id::oem ? GetOEMCP() :
440 static_cast<UINT>(charset);
444 UINT m_from_wincp, m_to_wincp;
447 static const char* to_encoding(_In_ charset_id charset)
449 static const char*
const encodings[
static_cast<std::underlying_type_t<charset_id>
>(charset_id::_max)] = {
453#if BYTE_ORDER == BIG_ENDIAN
465 charset == charset_id::system ? nl_langinfo(CODESET) :
466 encodings[static_cast<std::underlying_type_t<charset_id>>(charset)];
484 template <
class TR_to = std::
char_traits<
wchar_t>,
class AX_to = std::allocator<
wchar_t>>
486 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
489 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
490 _In_reads_or_z_opt_(count_src)
const char* src, _In_
size_t count_src,
491 _In_ charset_id charset = charset_id::system)
493 charset_encoder<char, wchar_t>(charset, wchar_t_charset).strcat(dst, src, count_src);
496 template <
class TR_to = std::
char_traits<
wchar_t>,
class AX_to = std::allocator<
wchar_t>>
497 _Deprecated_(
"Use stdex::strcat")
498 inline
void str2wstr(
499 _Inout_ std::basic_string<
wchar_t, TR_to, AX_to>& dst,
500 _In_reads_or_z_opt_(count_src) const
char* src, _In_
size_t count_src,
501 _In_ charset_id charset = charset_id::system)
503 strcat(dst, src, count_src, charset);
515 template <
class TR_to = std::
char_traits<
wchar_t>,
class AX_to = std::allocator<
wchar_t>>
517 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
520 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
521 _In_
const std::basic_string_view<
char, std::char_traits<char>> src,
522 _In_ charset_id charset = charset_id::system)
524 strcat(dst, src.data(), src.size(), charset);
527 template <
class TR_to = std::
char_traits<
wchar_t>,
class AX_to = std::allocator<
wchar_t>>
528 _Deprecated_(
"Use stdex::strcat")
529 inline
void str2wstr(
530 _Inout_ std::basic_string<
wchar_t, TR_to, AX_to>& dst,
531 _In_ const std::basic_string_view<
char, std::char_traits<
char>> src,
532 _In_ charset_id charset = charset_id::system)
534 strcat(dst, src, charset);
547 template <
class TR_to = std::
char_traits<
wchar_t>,
class AX_to = std::allocator<
wchar_t>>
549 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
552 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
553 _In_reads_or_z_opt_(count_src)
const char* src, _In_
size_t count_src,
554 _In_ charset_id charset = charset_id::system)
557 strcat(dst, src, count_src, charset);
569 template <
class TR_to = std::
char_traits<
wchar_t>,
class AX_to = std::allocator<
wchar_t>>
571 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
574 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
575 _In_
const std::basic_string_view<
char, std::char_traits<char>> src,
576 _In_ charset_id charset = charset_id::system)
578 strcpy(dst, src.data(), src.size(), charset);
592 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
594 inline std::wstring str2wstr(
595 _In_z_
const char* src,
596 _In_ charset_id charset = charset_id::system)
599 strcat(dst, src, SIZE_MAX, charset);
615 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
617 inline std::wstring str2wstr(
618 _In_reads_or_z_opt_(count_src)
const char* src, _In_
size_t count_src,
619 _In_ charset_id charset = charset_id::system)
622 strcat(dst, src, count_src, charset);
637 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
639 inline std::wstring str2wstr(
640 _In_
const std::basic_string_view<
char, std::char_traits<char>> src,
641 _In_ charset_id charset = charset_id::system)
643 return str2wstr(src.data(), src.size(), charset);
656 template <
class TR_to = std::
char_traits<
char>,
class AX_to = std::allocator<
char>>
658 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
661 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
662 _In_reads_or_z_opt_(count_src)
const wchar_t* src, _In_
size_t count_src,
663 _In_ charset_id charset = charset_id::system)
665 charset_encoder<wchar_t, char>(wchar_t_charset, charset).strcat(dst, src, count_src);
668 template <
class TR_to = std::
char_traits<
char>,
class AX_to = std::allocator<
char>>
669 _Deprecated_(
"Use stdex::strcat")
670 inline
void wstr2str(
671 _Inout_ std::basic_string<
char, TR_to, AX_to>& dst,
672 _In_reads_or_z_opt_(count_src) const
wchar_t* src, _In_
size_t count_src,
673 _In_ charset_id charset = charset_id::system)
675 strcat(dst, src, count_src, charset);
687 template <
class TR_to = std::
char_traits<
char>,
class AX_to = std::allocator<
char>>
689 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
692 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
693 _In_
const std::basic_string_view<
wchar_t, std::char_traits<wchar_t>> src,
694 _In_ charset_id charset = charset_id::system)
696 strcat(dst, src.data(), src.size(), charset);
699 template <
class TR_to = std::
char_traits<
char>,
class AX_to = std::allocator<
char>>
700 _Deprecated_(
"Use stdex::strcat")
701 inline
void wstr2str(
702 _Inout_ std::basic_string<
char, TR_to, AX_to>& dst,
703 _In_ const std::basic_string_view<
wchar_t, std::char_traits<
wchar_t>> src,
704 _In_ charset_id charset = charset_id::system)
706 strcat(dst, src, charset);
719 template <
class TR_to = std::
char_traits<
char>,
class AX_to = std::allocator<
char>>
721 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
724 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
725 _In_reads_or_z_opt_(count_src)
const wchar_t* src, _In_
size_t count_src,
726 _In_ charset_id charset = charset_id::system)
729 strcat(dst, src, count_src, charset);
741 template <
class TR_to = std::
char_traits<
char>,
class AX_to = std::allocator<
char>>
743 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
746 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
747 _In_
const std::basic_string_view<
wchar_t, std::char_traits<wchar_t>> src,
748 _In_ charset_id charset = charset_id::system)
750 strcpy(dst, src.data(), src.size(), charset);
764 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
766 inline std::string wstr2str(
767 _In_z_
const wchar_t* src,
768 _In_ charset_id charset = charset_id::system)
771 strcat(dst, src, SIZE_MAX, charset);
787 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
789 inline std::string wstr2str(
790 _In_reads_or_z_opt_(count_src)
const wchar_t* src, _In_
size_t count_src,
791 _In_ charset_id charset = charset_id::system)
794 strcat(dst, src, count_src, charset);
809 _Deprecated_(
"For better performance, consider a reusable charset_encoder")
811 inline std::string wstr2str(
812 _In_
const std::basic_string_view<
wchar_t, std::char_traits<wchar_t>> src,
813 _In_ charset_id charset = charset_id::system)
815 return wstr2str(src.data(), src.size(), charset);
828 template <
class TR = std::
char_traits<
wchar_t>,
class AX = std::allocator<
wchar_t>>
830 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
831 _In_reads_or_z_opt_(count_src)
const wchar_t* src, _In_
size_t count_src)
833 count_src = strnlen(src, count_src);
834 size_t count_dst = dst.size();
835 dst.resize(count_dst + count_src);
836 _Assume_(count_src + 1 < INT_MAX);
837#pragma warning(suppress: 6387)
838 int r = NormalizeString(NormalizationC, src,
static_cast<int>(count_src), dst.data() + count_dst,
static_cast<int>(count_src + 1));
840 dst.resize(count_dst + r);
842#pragma warning(suppress: 6387)
843 memcpy(dst.data() + count_dst, src, count_src *
sizeof(
wchar_t));
855 template <
size_t N,
class TR = std::
char_traits<
wchar_t>,
class AX = std::allocator<
wchar_t>>
857 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
858 _In_
const wchar_t (&src)[N])
860 return normalizecat(dst, src, N);
871 template <
class TR_dst = std::
char_traits<
wchar_t>,
class AX_dst = std::allocator<
wchar_t>>
873 _Inout_ std::basic_string<wchar_t, TR_dst, AX_dst>& dst,
874 _In_
const std::basic_string_view<
wchar_t, std::char_traits<wchar_t>> src)
876 return normalizecat(dst, src.data(), src.size());
888 template <
class TR = std::
char_traits<
wchar_t>,
class AX = std::allocator<
wchar_t>>
890 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
891 _In_reads_or_z_opt_(count_src)
const wchar_t* src, _In_
size_t count_src)
894 return normalizecat(dst, src, count_src);
905 template <
size_t N,
class TR = std::
char_traits<
wchar_t>,
class AX = std::allocator<
wchar_t>>
907 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
908 _In_
const wchar_t(&src)[N])
910 return normalize(dst, src, N);
921 template <
class TR_dst = std::
char_traits<
wchar_t>,
class AX_dst = std::allocator<
wchar_t>>
923 _Inout_ std::basic_string<wchar_t, TR_dst, AX_dst>& dst,
924 _In_
const std::basic_string_view<
wchar_t, std::char_traits<wchar_t>> src)
926 return normalize(dst, src.data(), src.size());
937 inline std::wstring normalize(_In_reads_or_z_opt_(count_src)
const wchar_t* src, _In_
size_t count_src)
940 normalizecat(dst, src, count_src);
952 std::wstring normalize(_In_
const wchar_t(&src)[N])
955 normalizecat(dst, src, N);
966 inline std::wstring normalize(_In_
const std::basic_string_view<
wchar_t, std::char_traits<wchar_t>> src)
969 normalizecat(dst, src.data(), src.size());
976#pragma GCC diagnostic pop
Encoding converter context.
Definition unicode.hpp:137
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, _In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Convert string and append to string.
Definition unicode.hpp:174
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Convert string and append to string.
Definition unicode.hpp:330
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, const T_from *src)
Convert string.
Definition unicode.hpp:360
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, const T_from *src)
Convert string and append to string.
Definition unicode.hpp:316
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, _In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Convert string.
Definition unicode.hpp:345
std::basic_string< T_to, TR_to, AX_to > convert(const T_from *src)
Return converted string.
Definition unicode.hpp:401
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Convert string.
Definition unicode.hpp:374
std::basic_string< T_to, TR_to, AX_to > convert(const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Return converted string.
Definition unicode.hpp:412
std::basic_string< T_to, TR_to, AX_to > convert(_In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Return converted string.
Definition unicode.hpp:388