7#include "../required.hpp"
22[[nodiscard]]
constexpr std::endian guess_utf16_endianess(It first, It last, std::endian default_guess)
24 static_assert(
sizeof(*first) == 1,
"Expecting an array of 8-bit characters");
25 ttlet num_words = narrow_cast<size_t>(
std::distance(first, last) / 2);
33 ttlet c0 =
static_cast<uint8_t
>(*first);
34 ttlet c1 =
static_cast<uint8_t
>(*(first + 1));
35 if (c0 == 0xfe && c1 == 0xff) {
36 return std::endian::big;
37 }
else if (c1 == 0xfe and c0 == 0xff) {
38 return std::endian::little;
46 for (
auto i = 0; i != num_words; ++i) {
47 ttlet c0 =
static_cast<uint8_t
>(*(it++));
48 ttlet c1 =
static_cast<uint8_t
>(*(it++));
50 if (c0 == 0 and c0 != c1) {
52 }
else if (c1 == 0 and c0 != c1) {
58 if (count0 == count1) {
60 }
else if (count0 > count1 and count0 > (num_words / 8)) {
61 return std::endian::little;
62 }
else if (count1 > count0 and count1 > (num_words / 8)) {
63 return std::endian::big;
82[[nodiscard]]
std::u32string utf8_to_utf32(std::string_view rhs)
noexcept;
97[[nodiscard]]
std::u16string utf8_to_utf16(std::string_view rhs)
noexcept;
112[[nodiscard]]
std::string utf8_to_utf8(std::string_view rhs)
noexcept;
127[[nodiscard]]
std::wstring utf8_to_wide(std::string_view rhs)
noexcept;
139[[nodiscard]]
std::u32string utf16_to_utf32(std::u16string_view rhs)
noexcept;
151[[nodiscard]]
std::u16string utf16_to_utf16(std::u16string_view rhs)
noexcept;
163[[nodiscard]]
std::string utf16_to_utf8(std::u16string_view rhs)
noexcept;
175[[nodiscard]]
std::wstring utf16_to_wide(std::u16string_view rhs)
noexcept;
187[[nodiscard]]
std::u32string utf32_to_utf32(std::u32string_view rhs)
noexcept;
199[[nodiscard]]
std::u16string utf32_to_utf16(std::u32string_view rhs)
noexcept;
211[[nodiscard]]
std::string utf32_to_utf8(std::u32string_view rhs)
noexcept;
223[[nodiscard]]
std::wstring utf32_to_wide(std::u32string_view rhs)
noexcept;
233[[nodiscard]]
std::u32string wide_to_utf32(std::wstring_view rhs)
noexcept;
243[[nodiscard]]
std::u16string wide_to_utf16(std::wstring_view rhs)
noexcept;
253[[nodiscard]]
std::string wide_to_utf8(std::wstring_view rhs)
noexcept;
263[[nodiscard]]
std::wstring wide_to_wide(std::wstring_view rhs)
noexcept;
271[[nodiscard]]
std::u16string to_u16string(std::string_view rhs)
noexcept;
273[[nodiscard]]
std::u16string to_u16string(std::wstring_view rhs)
noexcept;
275[[nodiscard]]
std::u16string to_u16string(std::u32string_view rhs)
noexcept;
277[[nodiscard]]
std::u32string to_u32string(std::string_view rhs)
noexcept;
279[[nodiscard]]
std::u32string to_u32string(std::u16string_view rhs)
noexcept;
281[[nodiscard]]
std::u32string to_u32string(std::wstring_view rhs)
noexcept;