path.h#
UTF-8 / filesystem path conversion utilities.
Provides cross-platform helpers for converting between UTF-8 encoded std::string values and std::filesystem::path objects. On Windows, two additional helpers convert between UTF-8 std::string and std::wstring using the Win32 MultiByteToWideChar / WideCharToMultiByte APIs.
-
namespace ONNX_LIGHT_NAMESPACE
Functions
-
inline std::filesystem::path utf8_to_path(const std::string &utf8)#
Converts a UTF-8 encoded string to a
std::filesystem::path.On Windows the string is first widened via utf8str_to_wstring so that non-ASCII characters in the path are handled correctly. On all other platforms the path is constructed directly from the UTF-8 string.
- Parameters:
utf8 – UTF-8 encoded path string.
- Returns:
Corresponding
std::filesystem::path.
-
inline std::string path_to_utf8(const std::filesystem::path &p)#
Converts a
std::filesystem::pathto a UTF-8 encoded string.On Windows the path’s native wide string is converted to UTF-8 via wstring_to_utf8str. On all other platforms the path’s native string representation (already UTF-8) is returned directly.
- Parameters:
p – Filesystem path to convert.
- Returns:
UTF-8 encoded string representation of
p.
-
inline std::filesystem::path utf8_to_path(const std::string &utf8)#