converter¶
- group turbo_unicode_converter
Functions
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf8_to_utf16(const char *input, size_t length, char16_t *utf16_output) noexcept¶ convert utf8 to utf16 with auto detect endian.
Example:
char16_t utf16_buffer[1024]; auto utf16_length = convert_utf8_to_utf16(input, length, utf16_buffer); // utf16_length is utf16 buffer length
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf16_output – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf8_to_utf16le(const char *input, size_t length, char16_t *utf16_output) noexcept¶ convert utf8 to utf16 with little endian.
Example:
char16_t utf16_buffer[1024]; auto utf16_length = convert_utf8_to_utf16_le(input, length, utf16_buffer); // utf16_length is utf16 buffer length
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf16_output – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf8_to_utf16be(const char *input, size_t length, char16_t *utf16_output) noexcept¶ convert utf8 to utf16 with big endian.
Example:
char16_t utf16_buffer[1024]; auto utf16_length = convert_utf8_to_utf16_be(input, length, utf16_buffer); // utf16_length is utf16 buffer length
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf16_output – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf8_to_utf16_with_errors(const char *input, size_t length, char16_t *utf16_output) noexcept¶ convert utf8 to utf16 with auto detect endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf8_to_utf16_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf8, otherwise result is error and error position is set.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf16_output – utf16 output buffer
- Returns:
result, if valid utf8, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf8_to_utf16le_with_errors(const char *input, size_t length, char16_t *utf16_output) noexcept¶ convert utf8 to utf16 with little endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf8_to_utf16_le_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf8, otherwise result is error and error position is set.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf16_output – utf16 output buffer
- Returns:
result, if valid utf8, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf8_to_utf16be_with_errors(const char *input, size_t length, char16_t *utf16_output) noexcept¶ convert utf8 to utf16 with big endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf8_to_utf16_be_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf8, otherwise result is error and error position is set.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf16_output – utf16 output buffer
- Returns:
result, if valid utf8, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf8_to_utf32(const char *input, size_t length, char32_t *utf32_output) noexcept¶ convert utf8 to utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf32_output – utf32 output buffer
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf8_to_utf32_with_errors(const char *input, size_t length, char32_t *utf32_output) noexcept¶ convert utf8 to utf32 with little endian.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf32_output – utf32 output buffer
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
size_t convert_valid_utf8_to_utf16(const char *input, size_t length, char16_t *utf16_buffer) noexcept¶ convert utf8 to utf16 with host endian.
assume input buffer is valid utf8. using this function is faster than convert_valid_utf8_to_utf16_with_errors.
Note
this function will auto set utf16 endian as host endian. make sure that utf8 input buffer is valid utf8.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf32_output – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf8_to_utf16le(const char *input, size_t length, char16_t *utf16_buffer) noexcept¶ convert utf8 to utf16 with little endian.
assume input buffer is valid utf8. using this function is faster than convert_valid_utf8_to_utf16_le_with_errors.
Note
this function will auto set utf16 endian as little endian. make sure that utf8 input buffer is valid utf8.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf32_output – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf8_to_utf16be(const char *input, size_t length, char16_t *utf16_buffer) noexcept¶ convert utf8 to utf16 with big endian.
assume input buffer is valid utf8. using this function is faster than convert_valid_utf8_to_utf16_be_with_errors.
Note
this function will auto set utf16 endian as big endian. make sure that utf8 input buffer is valid utf8.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf32_output – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf8_to_utf32(const char *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf8 to utf32.
assume input buffer is valid utf8. using this function is faster than convert_valid_utf8_to_utf32_with_errors.
Note
this function will auto set utf32 endian as host endian. make sure that utf8 input buffer is valid utf8.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
utf32_output – utf32 output buffer
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf16_length_from_utf8(const char *input, size_t length) noexcept¶ get utf16 length from utf8 input buffer.
Example:
auto utf16_length = utf16_length_from_utf8(input, length); // utf16_length is utf16 buffer length
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf32_length_from_utf8(const char *input, size_t length) noexcept¶ get utf32 length from utf8 input buffer.
Example:
auto utf32_length = utf32_length_from_utf8(input, length); // utf32_length is utf32 buffer length
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf16_to_utf8(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 to utf8 with auto detect endian.
Example:
char utf8_buffer[1024]; auto utf8_length = convert_utf16_to_utf8(input, length, utf8_buffer); // utf8_length is utf8 buffer length
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_output – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf16le_to_utf8(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 to utf8 with little endian.
Example:
char utf8_buffer[1024]; auto utf8_length = convert_utf16_to_utf8_le(input, length, utf8_buffer); // utf8_length is utf8 buffer length
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_output – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf16be_to_utf8(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 to utf8 with big endian.
Example:
char utf8_buffer[1024]; auto utf8_length = convert_utf16_to_utf8_be(input, length, utf8_buffer); // utf8_length is utf8 buffer length
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_output – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf16_to_utf8_with_errors(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 to utf8 with auto detect endian.
Example:
char utf8_buffer[1024]; auto result = convert_utf16_to_utf8_with_errors(input, length, utf8_buffer); // result is ok if input is valid utf16, otherwise result is error and error position is set.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_output – utf8 output buffer
- Returns:
result, if valid utf16, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf16le_to_utf8_with_errors(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 to utf8 with little endian.
Example:
char utf8_buffer[1024]; auto result = convert_utf16_to_utf8_le_with_errors(input, length, utf8_buffer); // result is ok if input is valid utf16, otherwise result is error and error position is set.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_output – utf8 output buffer
- Returns:
result, if valid utf16, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf16be_to_utf8_with_errors(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 to utf8 with big endian.
Example:
char utf8_buffer[1024]; auto result = convert_utf16_to_utf8_be_with_errors(input, length, utf8_buffer); // result is ok if input is valid utf16, otherwise result is error and error position is set.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_output – utf8 output buffer
- Returns:
result, if valid utf16, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf16_to_utf8(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 to utf32 with auto detect endian.
Example:
char32_t utf32_buffer[1024]; auto utf32_length = convert_utf16_to_utf32(input, length, utf32_buffer); // utf32_length is utf32 buffer length
Note
guard that input buffer is host endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf16le_to_utf8(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 with little endian to utf8, and assume input buffer is valid utf16.
using this function is faster than convert_valid_utf16_to_utf8_le_with_errors.
Note
guard that input buffer is little endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf16be_to_utf8(const char16_t *input, size_t length, char *utf8_buffer) noexcept¶ convert utf16 with big endian to utf8, and assume input buffer is valid utf16.
using this function is faster than convert_valid_utf16_to_utf8_be_with_errors.
Note
guard that input buffer is big endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf16_to_utf32(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf16 to utf32 with auto detect endian.
Example:
char32_t utf32_buffer[1024]; auto result = convert_utf16_to_utf32_with_errors(input, length, utf32_buffer); // result is ok if input is valid utf16, otherwise result is error and error position is set.
Note
guard that input buffer is host endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
result, if valid utf16, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf16le_to_utf32(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf16 with little endian to utf32, and assume input buffer is valid utf16.
using this function is faster than convert_valid_utf16_to_utf32_le_with_errors.
Note
guard that input buffer is little endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf32_buffer – utf32 output buffer
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf16be_to_utf32(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf16 with big endian to utf32, and assume input buffer is valid utf16.
using this function is faster than convert_valid_utf16_to_utf32_be_with_errors.
Note
guard that input buffer is big endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf32_buffer – utf32 output buffer
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf16_to_utf32_with_errors(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf16 to utf32 with auto detect endian.
Example:
char32_t utf32_buffer[1024]; auto result = convert_utf16_to_utf32_with_errors(input, length, utf32_buffer); // result is ok if input is valid utf16, otherwise result is error and error position is set.
Note
guard that input buffer is host endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
result, if valid utf16, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf16le_to_utf32_with_errors(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf16 with little endian to utf32, and assume input buffer is valid utf16.
using this function is faster than convert_valid_utf16_to_utf32_le_with_errors.
Note
guard that input buffer is little endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf32_buffer – utf32 output buffer
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf16be_to_utf32_with_errors(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf16 with big endian to utf32, and assume input buffer is valid utf16.
using this function is faster than convert_valid_utf16_to_utf32_be_with_errors.
Note
guard that input buffer is big endian. input buffer must be valid utf16.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
utf32_buffer – utf32 output buffer
- Returns:
utf32 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf16_to_utf32(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf32 to utf16 with auto detect endian.
Example:
char16_t utf16_buffer[1024]; auto utf16_length = convert_utf32_to_utf16(input, length, utf16_buffer); // utf16_length is utf16 buffer length
Note
guard that input buffer is host endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf16le_to_utf32(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf32 with little endian to utf16, and assume input buffer is valid utf32.
using this function is faster than convert_valid_utf32_to_utf16_le_with_errors.
Note
guard that input buffer is little endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf16be_to_utf32(const char16_t *input, size_t length, char32_t *utf32_buffer) noexcept¶ convert utf32 with big endian to utf16, and assume input buffer is valid utf32.
using this function is faster than convert_valid_utf32_to_utf16_be_with_errors.
Note
guard that input buffer is big endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf8_length_from_utf16(const char16_t *input, size_t length) noexcept¶ get utf8 length from utf16 input buffer.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf8_length_from_utf16le(const char16_t *input, size_t length) noexcept¶ get utf8 length from utf16 little endian input buffer.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf8_length_from_utf16be(const char16_t *input, size_t length) noexcept¶ get utf8 length from utf16 big endian input buffer.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf32_to_utf8(const char32_t *input, size_t length, char *utf8_buffer) noexcept¶ @Brief convert utf32 to utf8.
Example:
char utf8_buffer[1024]; auto utf8_length = convert_utf32_to_utf8(input, length, utf8_buffer); // utf8_length is utf8 buffer length
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf32_to_utf8_with_errors(const char32_t *input, size_t length, char *utf8_buffer) noexcept¶ @Brief convert utf32 to utf8 with little endian.
Example:
char utf8_buffer[1024]; auto utf8_length = convert_utf32_to_utf8_le(input, length, utf8_buffer); // utf8_length is utf8 buffer length
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf32_to_utf8(const char32_t *input, size_t length, char *utf8_buffer) noexcept¶ @Brief convert utf32 to utf8 with host endian.
Example:
char utf8_buffer[1024]; auto utf8_length = convert_utf32_to_utf8_le(input, length, utf8_buffer); // utf8_length is utf8 buffer length
Note
guard that input buffer is host endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf8_buffer – utf8 output buffer
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf32_to_utf16(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 host endian.
Example:
char16_t utf16_buffer[1024]; auto utf16_length = convert_utf32_to_utf16(input, length, utf16_buffer); // utf16_length is utf16 buffer length
Note
guard that input buffer is host endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf32_to_utf16le(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 little endian.
Example:
char16_t utf16_buffer[1024]; auto utf16_length = convert_utf32_to_utf16_le(input, length, utf16_buffer); // utf16_length is utf16 buffer length
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_utf32_to_utf16be(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 big endian.
Example:
char16_t utf16_buffer[1024]; auto utf16_length = convert_utf32_to_utf16_be(input, length, utf16_buffer); // utf16_length is utf16 buffer length
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf32_to_utf16_with_errors(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 with auto detect endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf32_to_utf16_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf32, otherwise result is error and error position is set.
Note
guard that input buffer is host endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
result, if valid utf32, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf32_to_utf16le_with_errors(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 with little endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf32_to_utf16_le_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf32, otherwise result is error and error position is set.
Note
guard that input buffer is little endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
result, if valid utf32, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline UnicodeResult convert_utf32_to_utf16be_with_errors(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 with big endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf32_to_utf16_be_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf32, otherwise result is error and error position is set.
Note
guard that input buffer is big endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
result, if valid utf32, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf32_to_utf16(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 with auto detect endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf32_to_utf16_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf32, otherwise result is error and error position is set.
Note
guard that input buffer is host endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
result, if valid utf32, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf32_to_utf16le(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 with little endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf32_to_utf16_le_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf32, otherwise result is error and error position is set.
Note
guard that input buffer is little endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
result, if valid utf32, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t convert_valid_utf32_to_utf16be(const char32_t *input, size_t length, char16_t *utf16_buffer) noexcept¶ @Brief convert utf32 to utf16 with big endian.
Example:
char16_t utf16_buffer[1024]; auto result = convert_utf32_to_utf16_be_with_errors(input, length, utf16_buffer); // result is ok if input is valid utf32, otherwise result is error and error position is set.
Note
guard that input buffer is big endian. input buffer must be valid utf32.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
utf16_buffer – utf16 output buffer
- Returns:
result, if valid utf32, result is ok, otherwise result is error and error position is set.
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline void change_endianness_utf16(const char16_t *input, size_t length, char16_t *output) noexcept¶ convert utf16 endian ro reverse endian.
Note
guard that input buffer is host endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
output – utf16 output buffer
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf8_length_from_utf32(const char32_t *input, size_t length) noexcept¶ get utf8 length from utf32 input buffer.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
- Returns:
utf8 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf16_length_from_utf32(const char32_t *input, size_t length) noexcept¶ get utf16 length from utf32 input buffer.
Note
guard that input buffer is host endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf32_length_from_utf16(const char16_t *input, size_t length) noexcept¶ get utf16 length from utf32 host endian input buffer.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf32_length_from_utf16le(const char16_t *input, size_t length) noexcept¶ get utf16 length from utf32 little endian input buffer.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t utf32_length_from_utf16be(const char16_t *input, size_t length) noexcept¶ get utf16 length from utf32 big endian input buffer.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf32 input buffer
length – utf32 input buffer length
- Returns:
utf16 output buffer length
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t count_utf16(const char16_t *input, size_t length) noexcept¶ count utf16 code points.
Note
guard that input buffer is host endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
- Returns:
utf16 code points count
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t count_utf16le(const char16_t *input, size_t length) noexcept¶ count utf16 code points from utf16 little endian input buffer.
Note
guard that input buffer is little endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
- Returns:
utf16 code points count
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t count_utf16be(const char16_t *input, size_t length) noexcept¶ count utf16 code points from utf16 big endian input buffer.
Note
guard that input buffer is big endian.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf16 input buffer
length – utf16 input buffer length
- Returns:
utf16 code points count
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>
inline size_t count_utf8(const char *input, size_t length) noexcept¶ count utf8 code points.
- Template Parameters:
Engine – default is turbo::unicode::default_engine
- Parameters:
input – utf8 input buffer
length – utf8 input buffer length
- Returns:
utf8 code points count
-
template<typename Engine = turbo::unicode::default_engine, typename turbo::check_requires<turbo::unicode::is_unicode_engine<Engine>> = 0>