From a09fe66e667ed2b91a4c953e74cf6b1abaaa919f Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 20 Mar 2019 19:18:57 +1100 Subject: Implement WStringFromUTF8 to simplify code that creates wstring objects for regular expressions and calling the Win32 API. --- src/UniConversion.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/UniConversion.h') diff --git a/src/UniConversion.h b/src/UniConversion.h index c676230da..a0a1f1a56 100644 --- a/src/UniConversion.h +++ b/src/UniConversion.h @@ -20,7 +20,11 @@ void UTF8FromUTF16(std::wstring_view wsv, char *putf, size_t len); void UTF8FromUTF32Character(int uch, char *putf); size_t UTF16Length(std::string_view sv); size_t UTF16FromUTF8(std::string_view sv, wchar_t *tbuf, size_t tlen); +size_t UTF32Length(std::string_view svu8) noexcept; size_t UTF32FromUTF8(std::string_view sv, unsigned int *tbuf, size_t tlen); +// WStringFromUTF8 does the right thing when wchar_t is 2 or 4 bytes so +// works on both Windows and Unix. +std::wstring WStringFromUTF8(std::string_view svu8); unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf) noexcept; bool UTF8IsValid(std::string_view sv) noexcept; std::string FixInvalidUTF8(const std::string &text); -- cgit v1.2.3