From 1e89700693e92bb9c78ace739c71431b74d91e22 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sun, 3 Nov 2024 13:04:00 -0600 Subject: Rename FudUtf8 to Utf8. --- source/fud_utf8.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'source/fud_utf8.cpp') diff --git a/source/fud_utf8.cpp b/source/fud_utf8.cpp index ec72b6d..d4b5442 100644 --- a/source/fud_utf8.cpp +++ b/source/fud_utf8.cpp @@ -21,12 +21,12 @@ namespace fud { -FudUtf8 FudUtf8::from(const String& fudString, size_t index) noexcept +Utf8 Utf8::from(const String& fudString, size_t index) noexcept { return from(fudString.asView(), index); } -FudUtf8 FudUtf8::from(StringView view, size_t index) noexcept +Utf8 Utf8::from(StringView view, size_t index) noexcept { auto len = view.length(); const auto* vData = view.data(); @@ -34,7 +34,7 @@ FudUtf8 FudUtf8::from(StringView view, size_t index) noexcept return invalidAscii(); } - FudUtf8 localChar{Ascii{vData[index]}}; + Utf8 localChar{Ascii{vData[index]}}; if (localChar.valid()) { return localChar; } @@ -75,14 +75,14 @@ bool isAscii(utf8 character) return (character & ~ASCII_MASK) == 0; } -bool isAscii(FudUtf8 character) +bool isAscii(Utf8 character) { return character.getType() == Utf8Type::Ascii && character.valid(); } namespace impl { -bool isAsciiPredicate(FudUtf8 character, bool (*predicate)(char)) +bool isAsciiPredicate(Utf8 character, bool (*predicate)(char)) { auto maybeAscii = character.getAscii(); if (!maybeAscii.hasValue()) { @@ -113,7 +113,7 @@ bool isAlphanumeric(utf8 character) return isDigit(character); } -bool isAlphanumeric(FudUtf8 character) +bool isAlphanumeric(Utf8 character) { return impl::isAsciiPredicate(character, isAlphanumeric); } @@ -136,7 +136,7 @@ bool isAlpha(utf8 character) return isLowercase(character); } -bool isAlpha(FudUtf8 character) +bool isAlpha(Utf8 character) { return impl::isAsciiPredicate(character, isAlpha); } @@ -155,7 +155,7 @@ bool isLowercase(utf8 character) return 'a' <= character && character <= 'z'; } -bool isLowercase(FudUtf8 character) +bool isLowercase(Utf8 character) { return impl::isAsciiPredicate(character, isLowercase); } @@ -174,7 +174,7 @@ bool isUppercase(utf8 character) return 'A' <= character && character <= 'Z'; } -bool isUppercase(FudUtf8 character) +bool isUppercase(Utf8 character) { return impl::isAsciiPredicate(character, isUppercase); } @@ -193,7 +193,7 @@ bool isDigit(utf8 character) return '0' <= character && character <= '9'; } -bool isDigit(FudUtf8 character) +bool isDigit(Utf8 character) { return impl::isAsciiPredicate(character, isDigit); } @@ -213,7 +213,7 @@ bool isHexDigit(utf8 character) ('A' <= character && character <= 'F'); } -bool isHexDigit(FudUtf8 character) +bool isHexDigit(Utf8 character) { return impl::isAsciiPredicate(character, isHexDigit); } @@ -234,7 +234,7 @@ bool isControl(utf8 character) return ((static_cast(character) <= maxControlChar)) || character == deleteChar; } -bool isControl(FudUtf8 character) +bool isControl(Utf8 character) { return impl::isAsciiPredicate(character, isControl); } @@ -253,7 +253,7 @@ bool isGraphical(utf8 character) return isAlphanumeric(character) || isPunctuation(character); } -bool isGraphical(FudUtf8 character) +bool isGraphical(Utf8 character) { return impl::isAsciiPredicate(character, isGraphical); } @@ -272,7 +272,7 @@ bool isSpace(utf8 character) return character == ' ' || character == '\t' || character == '\n' || character == '\r' || character == '\v'; } -bool isSpace(FudUtf8 character) +bool isSpace(Utf8 character) { return impl::isAsciiPredicate(character, isSpace); } @@ -291,7 +291,7 @@ bool isBlank(utf8 character) return character == ' ' || character == '\t'; } -bool isBlank(FudUtf8 character) +bool isBlank(Utf8 character) { return impl::isAsciiPredicate(character, isBlank); } @@ -310,7 +310,7 @@ bool isPrintable(utf8 character) return (character >= ' ' && character <= '~'); } -bool isPrintable(FudUtf8 character) +bool isPrintable(Utf8 character) { return impl::isAsciiPredicate(character, isPrintable); } @@ -330,7 +330,7 @@ bool isPunctuation(utf8 character) (character >= '[' && character <= '`') || (character >= '{' && character <= '~'); } -bool isPunctuation(FudUtf8 character) +bool isPunctuation(Utf8 character) { return impl::isAsciiPredicate(character, isPunctuation); } @@ -347,7 +347,7 @@ uint8_t charToLower(uint8_t character) return character; } -FudUtf8 utf8ToLower(FudUtf8 character) +Utf8 utf8ToLower(Utf8 character) { static_cast( character.transformAscii([](Ascii& ascii) { ascii = Ascii{charToLower(static_cast(ascii.asChar()))}; })); @@ -365,7 +365,7 @@ uint8_t charToUpper(uint8_t character) return character; } -FudUtf8 utf8ToUpper(FudUtf8 character) +Utf8 utf8ToUpper(Utf8 character) { static_cast( character.transformAscii([](Ascii& ascii) { ascii = Ascii{charToUpper(static_cast(ascii.asChar()))}; })); -- cgit v1.2.3