mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Move IsUtf8Part to only file using it.
parent
588fedb5db
commit
d2c9828b4c
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue