19 #ifndef IRCCD_JS_UNICODE_HPP
20 #define IRCCD_JS_UNICODE_HPP
31 #include <string_view>
44 void encode(char32_t point,
char res[5]) noexcept;
52 void decode(char32_t& c,
const char* res) noexcept;
81 auto length(std::string_view str) -> unsigned;
93 template <
typename Func>
94 void for_each(std::string_view str, Func
function)
96 for (
size_t i = 0; i < str.size(); ) {
101 throw std::invalid_argument(
"invalid sequence");
103 decode(point, str.data() + i);
117 auto to_utf8(std::u32string_view array) -> std::string;
126 auto to_utf32(std::string_view str) -> std::u32string;
182 auto toupper(char32_t c) noexcept -> char32_t;
190 auto tolower(char32_t c) noexcept -> char32_t;
198 auto totitle(char32_t c) noexcept -> char32_t;
206 auto toupper(std::u32string_view str) -> std::u32string;
215 auto toupper(std::string_view str) -> std::string;
223 auto tolower(std::u32string_view str) -> std::u32string;
232 auto tolower(std::string_view str) -> std::string;
236 #endif // !IRCCD_JS_UNICODE_HPP