#pragma once #include #include #include namespace yycc::encoding::stl { /// @brief Possible convertion error occurs in this module. struct ConvError {}; /// @brief The result type of this module. template using ConvResult = std::expected; /** * @brief UTF8 -> UTF16 * @param[in] src The string to be converted. * @return The converted string, or error occurring. */ ConvResult to_utf16(const std::u8string_view& src); /** * @brief UTF16 -> UTF8 * @param[in] src The string to be converted. * @return The converted string, or error occurring. */ ConvResult to_utf8(const std::u16string_view& src); /** * @brief UTF8 -> UTF32 * @param[in] src The string to be converted. * @return The converted string, or error occurring. */ ConvResult to_utf32(const std::u8string_view& src); /** * @brief UTF32 -> UTF8 * @param[in] src The string to be converted. * @return The converted string, or error occurring. */ ConvResult to_utf8(const std::u32string_view& src); }