doc: add Doxygen comment
This commit is contained in:
@ -14,29 +14,29 @@ namespace yycc::encoding::stl {
|
||||
|
||||
/**
|
||||
* @brief UTF8 -> UTF16
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u16string> to_utf16(const std::u8string_view& src);
|
||||
|
||||
/**
|
||||
* @brief UTF16 -> UTF8
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u8string> to_utf8(const std::u16string_view& src);
|
||||
|
||||
/**
|
||||
* @brief UTF8 -> UTF32
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u32string> to_utf32(const std::u8string_view& src);
|
||||
|
||||
/**
|
||||
* @brief UTF32 -> UTF8
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u8string> to_utf8(const std::u32string_view& src);
|
||||
|
||||
|
@ -30,61 +30,61 @@ namespace yycc::encoding::windows {
|
||||
|
||||
/**
|
||||
* @brief WChar -> Char
|
||||
* @param src
|
||||
* @param code_page
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @param[in] code_page The code page of native string.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::string> to_char(const std::wstring_view& src, CodePage code_page);
|
||||
|
||||
/**
|
||||
* @brief Char -> WChar
|
||||
* @param src
|
||||
* @param code_page
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @param[in] code_page The code page of native string.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::wstring> to_wchar(const std::string_view& src, CodePage code_page);
|
||||
|
||||
/**
|
||||
* @brief Char -> Char
|
||||
* @details This is the combination of "WChar -> Char" and "Char -> WChar"
|
||||
* @param src
|
||||
* @param src_code_page
|
||||
* @param dst_code_page
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @param[in] src_code_page The code page of source string.
|
||||
* @param[in] dst_code_page The code page of destination string.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::string> to_char(const std::string_view& src, CodePage src_code_page, CodePage dst_code_page);
|
||||
|
||||
/**
|
||||
* @brief WChar -> UTF8
|
||||
* @details This is the specialization of "WChar -> Char"
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u8string> to_utf8(const std::wstring_view& src);
|
||||
|
||||
/**
|
||||
* @brief UTF8 -> WChar
|
||||
* @details This is the specialization of "Char -> WChar"
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::wstring> to_wchar(const std::u8string_view& src);
|
||||
|
||||
/**
|
||||
* @brief Char -> UTF8
|
||||
* @details This is the specialization of "Char -> Char"
|
||||
* @param src
|
||||
* @param code_page
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @param[in] code_page The code page of native string.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u8string> to_utf8(const std::string_view& src, CodePage code_page);
|
||||
|
||||
/**
|
||||
* @brief UTF8 -> Char
|
||||
* @details This is the specialization of "Char -> Char"
|
||||
* @param src
|
||||
* @param code_page
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @param[in] code_page The code page of native string.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::string> to_char(const std::u8string_view& src, CodePage code_page);
|
||||
|
||||
@ -96,29 +96,29 @@ namespace yycc::encoding::windows {
|
||||
|
||||
/**
|
||||
* @brief UTF8 -> UTF16
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u16string> to_utf16(const std::u8string_view& src);
|
||||
|
||||
/**
|
||||
* @brief UTF16 -> UTF8
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u8string> to_utf8(const std::u16string_view& src);
|
||||
|
||||
/**
|
||||
* @brief UTF8 -> UTF32
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u32string> to_utf32(const std::u8string_view& src);
|
||||
|
||||
/**
|
||||
* @brief UTF32 -> UTF8
|
||||
* @param src
|
||||
* @return
|
||||
* @param[in] src The string to be converted.
|
||||
* @return The converted string, or error occurring.
|
||||
*/
|
||||
ConvResult<std::u8string> to_utf8(const std::u32string_view& src);
|
||||
|
||||
|
@ -142,49 +142,6 @@ namespace YYCCTestbench {
|
||||
|
||||
}
|
||||
|
||||
static void EncodingTestbench() {
|
||||
// get test tuple size
|
||||
size_t count = c_UTF8TestStrTable.size();
|
||||
|
||||
// check the convertion between given string
|
||||
for (size_t i = 0u; i < count; ++i) {
|
||||
// get item
|
||||
const auto& u8str = c_UTF8TestStrTable[i];
|
||||
const auto& u16str = c_UTF16TestStrTable[i];
|
||||
const auto& u32str = c_UTF32TestStrTable[i];
|
||||
|
||||
// create cache variables
|
||||
YYCC::yycc_u8string u8cache;
|
||||
std::u16string u16cache;
|
||||
std::u32string u32cache;
|
||||
|
||||
// do convertion check
|
||||
Assert(YYCC::EncodingHelper::UTF8ToUTF16(u8str, u16cache) && u16cache == u16str, YYCC_U8("YYCC::EncodingHelper::UTF8ToUTF16"));
|
||||
Assert(YYCC::EncodingHelper::UTF8ToUTF32(u8str, u32cache) && u32cache == u32str, YYCC_U8("YYCC::EncodingHelper::UTF8ToUTF32"));
|
||||
|
||||
Assert(YYCC::EncodingHelper::UTF16ToUTF8(u16str, u8cache) && u8cache == u8str, YYCC_U8("YYCC::EncodingHelper::UTF16ToUTF8"));
|
||||
Assert(YYCC::EncodingHelper::UTF32ToUTF8(u32str, u8cache) && u8cache == u8str, YYCC_U8("YYCC::EncodingHelper::UTF32ToUTF8"));
|
||||
}
|
||||
|
||||
// check wstring convertion on windows
|
||||
#if defined(YYCC_OS_WINDOWS)
|
||||
for (size_t i = 0u; i < count; ++i) {
|
||||
// get item
|
||||
const auto& u8str = c_UTF8TestStrTable[i];
|
||||
const auto& wstr = c_WStrTestStrTable[i];
|
||||
|
||||
// create cache variables
|
||||
YYCC::yycc_u8string u8cache;
|
||||
std::wstring wcache;
|
||||
|
||||
// do convertion check
|
||||
Assert(YYCC::EncodingHelper::UTF8ToWchar(u8str.c_str(), wcache) && wcache == wstr, YYCC_U8("YYCC::EncodingHelper::UTF8ToWchar"));
|
||||
Assert(YYCC::EncodingHelper::WcharToUTF8(wstr.c_str(), u8cache) && u8cache == u8str, YYCC_U8("YYCC::EncodingHelper::WcharToUTF8"));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void DialogTestbench() {
|
||||
#if defined(YYCC_OS_WINDOWS)
|
||||
|
||||
|
Reference in New Issue
Block a user