20 #ifndef MPD_FS_TRAITS_HXX
21 #define MPD_FS_TRAITS_HXX
38 #define PATH_LITERAL(s) _T(s)
40 #define PATH_LITERAL(s) (s)
48 typedef std::wstring
string;
59 static constexpr value_type
SEPARATOR =
'\\';
61 static constexpr value_type SEPARATOR =
'/';
76 #if !CLANG_CHECK_VERSION(3,6)
82 const_pointer_type pos = p +
GetLength(p);
93 static constexpr
bool IsDrive(const_pointer_type p) {
100 #if !CLANG_CHECK_VERSION(3,6)
102 assert(p !=
nullptr);
118 static const_pointer_type
Find(const_pointer_type p, value_type ch) {
127 static const_pointer_type
GetBase(const_pointer_type p);
135 static string GetParent(const_pointer_type p);
144 static const_pointer_type
Relative(const_pointer_type base,
145 const_pointer_type other);
154 static string Build(const_pointer_type a,
size_t a_size,
155 const_pointer_type b,
size_t b_size);
158 static string Build(const_pointer_type a, const_pointer_type b) {
183 #if !CLANG_CHECK_VERSION(3,6)
185 assert(p !=
nullptr);
188 return strrchr(p, SEPARATOR);
193 static constexpr
bool IsDrive(const_pointer_type p) {
200 #if !CLANG_CHECK_VERSION(3,6)
202 assert(p !=
nullptr);
218 static const_pointer_type
Find(const_pointer_type p, value_type ch) {
227 static const_pointer_type
GetBase(const_pointer_type p);
235 static string GetParent(const_pointer_type p);
244 static const_pointer_type
Relative(const_pointer_type base,
245 const_pointer_type other);
254 static string Build(const_pointer_type a,
size_t a_size,
255 const_pointer_type b,
size_t b_size);
258 static string Build(const_pointer_type a, const_pointer_type b) {
gcc_pure static gcc_nonnull_all string Build(const_pointer_type a, const_pointer_type b)
Simple OO wrapper for a const string pointer.
static constexpr bool IsSeparator(value_type ch)
gcc_pure static gcc_nonnull_all size_t GetLength(const_pointer_type p)
gcc_pure static gcc_nonnull_all const_pointer_type GetBase(const_pointer_type p)
Determine the "base" file name of the given UTF-8 path.
This class describes the nature of a MPD internal filesystem path.
gcc_pure static gcc_nonnull_all const_pointer_type FindLastSeparator(const_pointer_type p)
This class describes the nature of a native filesystem path.
string::traits_type char_traits
static constexpr bool IsAlphaASCII(char ch)
string::traits_type char_traits
static constexpr const_pointer_type CURRENT_DIRECTORY
static constexpr value_type SEPARATOR
gcc_pure static gcc_nonnull_all const_pointer_type Relative(const_pointer_type base, const_pointer_type other)
Determine the relative part of the given path to this object, not including the directory separator...
value_type * pointer_type
gcc_pure static gcc_nonnull_all const char * StringFindLast(const char *haystack, char needle)
gcc_pure static gcc_nonnull_all const_pointer_type Relative(const_pointer_type base, const_pointer_type other)
Determine the relative part of the given path to this object, not including the directory separator...
Pointer::pointer_type pointer_type
gcc_pure static gcc_nonnull_all const_pointer_type GetBase(const_pointer_type p)
Determine the "base" file name of the given native path.
Pointer::const_pointer_type const_pointer_type
gcc_pure static gcc_nonnull_all const_pointer_type Find(const_pointer_type p, value_type ch)
const value_type * const_pointer_type
gcc_pure static gcc_nonnull_all const_pointer_type Find(const_pointer_type p, value_type ch)
const T * const_pointer_type
static constexpr bool IsSeparator(value_type ch)
static constexpr const_pointer_type CURRENT_DIRECTORY
gcc_pure static gcc_nonnull_all size_t GetLength(const_pointer_type p)
gcc_pure static gcc_nonnull_all string Build(const_pointer_type a, const_pointer_type b)
gcc_pure static gcc_nonnull_all string Build(const_pointer_type a, size_t a_size, const_pointer_type b, size_t b_size)
Constructs the path from the given components.
gcc_pure static gcc_nonnull_all string GetParent(const_pointer_type p)
Determine the "parent" file name of the given UTF-8 path.
gcc_pure static gcc_nonnull_all string GetParent(const_pointer_type p)
Determine the "parent" file name of the given native path.
static constexpr value_type SEPARATOR
gcc_pure static gcc_nonnull_all const_pointer_type FindLastSeparator(const_pointer_type p)
StringPointer< value_type > Pointer
char_traits::char_type value_type
gcc_pure static gcc_nonnull_all const char * StringFind(const char *haystack, const char *needle)
gcc_pure static gcc_nonnull_all bool IsAbsolute(const_pointer_type p)
gcc_pure static gcc_nonnull_all bool IsAbsolute(const_pointer_type p)
gcc_pure static gcc_nonnull_all size_t StringLength(const char *p)
char_traits::char_type value_type
gcc_pure static gcc_nonnull_all string Build(const_pointer_type a, size_t a_size, const_pointer_type b, size_t b_size)
Constructs the path from the given components.