1
0
Fork 0

Codechange: Move IsUtf8Part to only file using it.

pull/14001/head
frosch 2025-04-02 10:04:46 +02:00 committed by frosch
parent 588fedb5db
commit d2c9828b4c
2 changed files with 7 additions and 8 deletions

View File

@ -13,11 +13,17 @@
#define UTF8_HPP #define UTF8_HPP
#include <iterator> #include <iterator>
#include "../string_func.h" #include "bitmath_func.hpp"
[[nodiscard]] std::pair<char[4], size_t> EncodeUtf8(char32_t c); [[nodiscard]] std::pair<char[4], size_t> EncodeUtf8(char32_t c);
[[nodiscard]] std::pair<size_t, char32_t> DecodeUtf8(std::string_view buf); [[nodiscard]] std::pair<size_t, char32_t> DecodeUtf8(std::string_view buf);
/* Check if the given character is part of a UTF8 sequence */
inline bool IsUtf8Part(char c)
{
return GB(c, 6, 2) == 2;
}
/** /**
* Constant span of UTF-8 encoded data. * Constant span of UTF-8 encoded data.
*/ */

View File

@ -72,13 +72,6 @@ inline bool StrEmpty(const char *s)
bool IsValidChar(char32_t key, CharSetFilter afilter); bool IsValidChar(char32_t key, CharSetFilter afilter);
/* Check if the given character is part of a UTF8 sequence */
inline bool IsUtf8Part(char c)
{
return GB(c, 6, 2) == 2;
}
size_t Utf8StringLength(std::string_view str); size_t Utf8StringLength(std::string_view str);
/** /**