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
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Defined as empty because onnx-light does not require explicit
__declspec(dllexport)or__attribute__((visibility("default")))annotations — visibility is controlled at the shared-library level. The macro is provided so that vendored ONNX headers that decorate their declarations withONNX_APIcompile without modification.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.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)#