doc: add documentation for win fct helper
- add documentation for win fct helper - add new macro YYCC_U8_CHAR for casting ordinary char to yycc utf8 char. - add documentation for new added YYCC_U8_CHAR.
This commit is contained in:
parent
ed549592dd
commit
1ccea1290e
|
@ -54,6 +54,8 @@
|
|||
|
||||
\li \subpage dialog_helper
|
||||
|
||||
\li \subpage win_fct_helper
|
||||
|
||||
\li \subpage exception_helper
|
||||
|
||||
</TD>
|
||||
|
|
|
@ -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:
|
||||
|
|
17
doc/src/win_fct_helper.dox
Normal file
17
doc/src/win_fct_helper.dox
Normal file
|
@ -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\%
|
||||
|
||||
*/
|
|
@ -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<const ::YYCC::yycc_char8_t*>(_YYCC_U8(strl))) ///< The macro for creating UTF8 string literal. See \ref library_encoding.
|
||||
#define YYCC_U8_CHAR(chr) (static_cast<YYCC::yycc_char8_t>(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);
|
||||
|
|
|
@ -3,23 +3,6 @@
|
|||
|
||||
#include <filesystem>
|
||||
|
||||
/**
|
||||
* @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 {
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user