Debian Codegraph @

src/mpt/path/native_path.hpp

raw
1 /* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */
2
3 #ifndef MPT_PATH_NATIVE_PATH_HPP
4 #define MPT_PATH_NATIVE_PATH_HPP
5
6
7
8 #include "mpt/base/detect.hpp"
9 #include "mpt/base/macros.hpp"
10 #include "mpt/base/namespace.hpp"
11 #include "mpt/path/basic_path.hpp"
12 #include "mpt/path/os_path.hpp"
13 #include "mpt/string/types.hpp"
14
15
16
17 namespace mpt {
18 inline namespace MPT_INLINE_NS {
19
20
21
22 struct NativePathStyleTag {
23 #if MPT_OS_WINDOWS_WINNT
24 static inline constexpr mpt::PathStyle path_style = mpt::PathStyle::WindowsNT;
25 #elif MPT_OS_WINDOWS_WIN9X
26 static inline constexpr mpt::PathStyle path_style = mpt::PathStyle::Windows9x;
27 #elif MPT_OS_WINDOWS
28 static inline constexpr mpt::PathStyle path_style = mpt::PathStyle::Windows9x;
29 #elif MPT_OS_DJGPP
30 static inline constexpr mpt::PathStyle path_style = mpt::PathStyle::DOS_DJGPP;
31 #else
32 static inline constexpr mpt::PathStyle path_style = mpt::PathStyle::Posix;
33 #endif
34 };
35
36 struct NativePathTraits : public PathTraits<mpt::os_path, NativePathStyleTag> {
37 };
38
39 struct Utf8PathTraits : public PathTraits<mpt::utf8string, NativePathStyleTag> {
40 };
41
42 using native_path = BasicPathString<NativePathTraits, true>;
43
44 #define MPT_NATIVE_PATH(x) \
45 mpt::native_path { \
46 MPT_OS_PATH(x) \
47 }
48
49
50
51 } // namespace MPT_INLINE_NS
52 } // namespace mpt
53
54
55
56 #endif // MPT_PATH_NATIVE_PATH_HPP