refactor: refactor old IOHelper.

- move pointer left padding macro into single header file.
- move utf8 fopen into single header but not finished.
- add testbench for pointer left padding macro.
- add system pointer size detector according to new migrated features requested.
This commit is contained in:
2025-08-05 10:54:15 +08:00
parent b9f81c16a0
commit 27baf2a080
15 changed files with 137 additions and 506 deletions

View File

@ -1,7 +1,7 @@
#pragma once
// Check OS macro
#if (defined(YYCC_OS_WINDOWS) + defined(YYCC_OS_LINUX)) != 1
#if (defined(YYCC_OS_WINDOWS) + defined(YYCC_OS_LINUX) + defined(YYCC_OS_MACOS)) != 1
#error "Current operating system is not supported!"
#endif
@ -11,6 +11,7 @@ namespace yycc::macro::os {
enum class OsKind {
Windows, ///< Microsoft Windows
Linux, ///< GNU/Linux
MacOs, ///< Apple macOS
};
/**
@ -20,8 +21,10 @@ namespace yycc::macro::os {
inline constexpr OsKind get_os() {
#if defined(YYCC_OS_WINDOWS)
return OsKind::Windows;
#else
#elif defined(YYCC_OS_LINUX)
return OsKind::Linux;
#else
return OsKind::MacOs;
#endif
}

View File

@ -0,0 +1,6 @@
#pragma once
// Check pointer size macro
#if (defined(YYCC_PTRSIZE_32) + defined(YYCC_PTRSIZE_64)) != 1
#error "Current environment used pointer size is not supported!"
#endif