diff options
author | 2020-12-15 13:36:55 -0500 | |
---|---|---|
committer | 2020-12-15 13:36:55 -0500 | |
commit | 2ca5f3a386a1ca63433d6d13bb66f5e46fb2a854 (patch) | |
tree | efc52a61e29ab44d0996e97e01782591e891f646 /src/lib/util/unicode.cpp | |
parent | 35bec8d2731fb775248ff3634bde538d77d6f2a0 (diff) |
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
Diffstat (limited to 'src/lib/util/unicode.cpp')
-rw-r--r-- | src/lib/util/unicode.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
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 @@ -125,6 +125,17 @@ bool uchar_is_digit(char32_t uchar) // 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 +//----------------------------------------------- + int uchar_from_utf8(char32_t *uchar, const char *utf8char, size_t count) { // validate parameters @@ -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); } |