diff --git a/doc/src/index.dox b/doc/src/index.dox index 0b6231b..323d210 100644 --- a/doc/src/index.dox +++ b/doc/src/index.dox @@ -54,6 +54,8 @@ \li \subpage dialog_helper + \li \subpage win_fct_helper + \li \subpage exception_helper diff --git a/doc/src/library_encoding.dox b/doc/src/library_encoding.dox index 960b231..8ba8096 100644 --- a/doc/src/library_encoding.dox +++ b/doc/src/library_encoding.dox @@ -96,6 +96,24 @@ This macro will do this automatically. In detail, this macro do a \c reinterpret_cast to change the type of given argument to \c const \c yycc_char8_t* forcely. This ensure that declared UTF8 literal is compatible with YYCC UTF8 types. +\subsection library_encoding__utf8_literal__char Single Char + +Same as UTF8 literal, YYCC allow you cast normal \c char into \c yycc_char8_t as following code: + +\code +YYCC_U8_CHAR('A') +\endcode + +YYCC_U8_CHAR is a macro. +It just simply use \c static_cast to cast given value to \c yycc_char8_t. +It doesn't mean that you can cast non-ASCII characters, +because the space these characters occupied usually more than the maximum value of \c char. +For example, following code is \b invalid: + +\code +YYCC_U8_CHAR('文') // INVALID! +\endcode + \subsection library_encoding__utf8_literal__concatenation Literal Concatenation YYCC_U8 macro also works for string literal concatenation: diff --git a/doc/src/win_fct_helper.dox b/doc/src/win_fct_helper.dox new file mode 100644 index 0000000..fec2415 --- /dev/null +++ b/doc/src/win_fct_helper.dox @@ -0,0 +1,17 @@ +/** + +\page win_fct_helper Windows Function Helper + +This helper give a more convenient way to call Windows functions. + +This namespace is Windows specific. +It will be entirely invisible in other platforms. + +Currently this namespace has following functions: + +\li YYCC::WinFctHelper::GetCurrentModule: Get the handle to current module. +\li YYCC::WinFctHelper::GetTempDirectory: Get temporary directory in Windows. +\li YYCC::WinFctHelper::GetModuleFileName: Get the path to module in file system by given handle. +\li YYCC::WinFctHelper::GetLocalAppData: Get the path inside \%LOCALAPPDATA\% + +*/ \ No newline at end of file diff --git a/src/EncodingHelper.hpp b/src/EncodingHelper.hpp index f590af5..db91ca8 100644 --- a/src/EncodingHelper.hpp +++ b/src/EncodingHelper.hpp @@ -19,6 +19,7 @@ namespace YYCC::EncodingHelper { #define _YYCC_U8(strl) u8 ## strl ///< The assistant macro for YYCC_U8. #define YYCC_U8(strl) (reinterpret_cast(_YYCC_U8(strl))) ///< The macro for creating UTF8 string literal. See \ref library_encoding. +#define YYCC_U8_CHAR(chr) (static_cast(chr)) ///< The macro for casting normal char into YYCC UTF8 char type. const yycc_char8_t* ToUTF8(const char* src); yycc_char8_t* ToUTF8(char* src); diff --git a/src/FsPathPatch.hpp b/src/FsPathPatch.hpp index 87fa0cd..3299b48 100644 --- a/src/FsPathPatch.hpp +++ b/src/FsPathPatch.hpp @@ -3,23 +3,6 @@ #include -/** - * @brief The patch namespace resolving \c std::filesystem::path encoding issue. - * @details - * This patch is Windows oriented. - * If you are in Windows, this patch will perform extra operations to achieve goals, - * and in other platforms, they just redirect request to corresponding vanilla C++ functions. - * - * As you know, the underlying char type of \c std::filesystem::path is \c wchar_t on Windows, - * and in other platforms, it is simple \c char. - * Due to this, if you passing UTF8 char sequence to \c std::filesystem::path on Windows, - * the library implementation will assume your input is based on current Windows code page, not UTF8. - * And the final path stored in \c std::filesystem::path is not what you expcected. - * - * This patch namespace always use UTF8 as its argument. There is no ambiguous issue. - * You should use the functions provided by this namespace on any platforms - * instead of vanilla \c std::filesystem::path functions. -*/ namespace YYCC::FsPathPatch { /**