1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-20 02:42:42 +01:00

Codechange: Remove unused Utf8TrimString, Utf8PrevChar.

This commit is contained in:
frosch
2025-04-04 21:41:33 +02:00
committed by frosch
parent b1582b815c
commit 14bab7d76b
2 changed files with 1 additions and 61 deletions

View File

@@ -39,7 +39,7 @@ bool strtolower(std::string &str, std::string::size_type offs = 0);
[[nodiscard]] bool StrValid(std::span<const char> str);
void StrTrimInPlace(std::string &str);
std::string_view StrTrimView(std::string_view str);
[[nodiscard]] std::string_view StrTrimView(std::string_view str);
[[nodiscard]] bool StrStartsWithIgnoreCase(std::string_view str, const std::string_view prefix);
[[nodiscard]] bool StrEndsWithIgnoreCase(std::string_view str, const std::string_view suffix);
@@ -91,9 +91,6 @@ size_t Utf8Decode(char32_t *c, const char *s);
template <typename T> requires (!std::is_same_v<T, char *> && (std::is_same_v<std::string_view::iterator, T> || std::is_same_v<std::string::iterator, T>))
inline size_t Utf8Decode(char32_t *c, T &s) { return Utf8Decode(c, &*s); }
size_t Utf8TrimString(char *s, size_t maxlen);
inline char32_t Utf8Consume(const char **s)
{
char32_t c;
@@ -151,36 +148,6 @@ inline bool IsUtf8Part(char c)
return GB(c, 6, 2) == 2;
}
/**
* Retrieve the previous UNICODE character in an UTF-8 encoded string.
* @param s char pointer pointing to (the first char of) the next character
* @return a pointer in 's' to the previous UNICODE character's first byte
* @note The function should not be used to determine the length of the previous
* encoded char because it might be an invalid/corrupt start-sequence
*/
inline char *Utf8PrevChar(char *s)
{
char *ret = s;
while (IsUtf8Part(*--ret)) {}
return ret;
}
inline const char *Utf8PrevChar(const char *s)
{
const char *ret = s;
while (IsUtf8Part(*--ret)) {}
return ret;
}
inline std::string::iterator Utf8PrevChar(std::string::iterator &s)
{
auto cur = s;
do {
cur = std::prev(cur);
} while (IsUtf8Part(*cur));
return cur;
}
size_t Utf8StringLength(std::string_view str);
/**