1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00

Codechange: rework StringFilter to not need MallocT anymore

This commit is contained in:
Rubidium
2025-02-15 22:23:56 +01:00
committed by rubidium42
parent ff6ae5b87b
commit 8b7460759a
3 changed files with 31 additions and 40 deletions

View File

@@ -76,7 +76,9 @@ inline size_t ttd_strnlen(const char *str, size_t maxlen)
bool IsValidChar(char32_t key, CharSetFilter afilter);
size_t Utf8Decode(char32_t *c, const char *s);
inline size_t Utf8Decode(char32_t *c, std::string::iterator &s) { return Utf8Decode(c, &*s); }
/* std::string_view::iterator might be char *, in which case we do not want this templated variant to be taken. */
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 Utf8Encode(char *buf, char32_t c);
size_t Utf8Encode(std::ostreambuf_iterator<char> &buf, char32_t c);
size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, char32_t c);