From 2ca5f3a386a1ca63433d6d13bb66f5e46fb2a854 Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 15 Dec 2020 13:36:55 -0500 Subject: unicode.h: Updates - Remove from emu.h (except for UTF8_xxx macros, which have been transplanted to emucore.h since a lot of drivers use them) and osdepend.h - Add std::string_view overrides for uchar_from_utf8 and normalize_unicode --- src/lib/util/unicode.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/lib/util/unicode.cpp') diff --git a/src/lib/util/unicode.cpp b/src/lib/util/unicode.cpp index 4a83b675087..b3568fbb8d4 100644 --- a/src/lib/util/unicode.cpp +++ b/src/lib/util/unicode.cpp @@ -120,6 +120,17 @@ bool uchar_is_digit(char32_t uchar) } +//------------------------------------------------- +// uchar_from_utf8 - convert a UTF-8 sequence +// into a unicode character +//----------------------------------------------- + +int uchar_from_utf8(char32_t *uchar, std::string_view utf8str) +{ + return uchar_from_utf8(uchar, utf8str.data(), utf8str.length()); +} + + //------------------------------------------------- // uchar_from_utf8 - convert a UTF-8 sequence // into a unicode character @@ -494,9 +505,9 @@ std::string normalize_unicode(const char *s, unicode_normalization_form normaliz // unicode //------------------------------------------------- -std::string normalize_unicode(const char *s, size_t length, unicode_normalization_form normalization_form, bool fold_case) +std::string normalize_unicode(std::string_view s, unicode_normalization_form normalization_form, bool fold_case) { - return internal_normalize_unicode(s, length, normalization_form, fold_case, false); + return internal_normalize_unicode(s.data(), s.length(), normalization_form, fold_case, false); } -- cgit v1.2.3-70-g09d2