foobar2000 SDK  2015-08-03
pathUtils.h
Go to the documentation of this file.
1 namespace pfc {
2  namespace io {
3  namespace path {
4 #ifdef _WINDOWS
6 #else
7  typedef string::comparatorCaseSensitive comparator; // wild assumption
8 #endif
9 
10 
11  string getFileName(string path);
12  string getFileNameWithoutExtension(string path);
13  string getFileExtension(string path);
14  string getParent(string filePath);
15  string getDirectory(string filePath);//same as getParent()
16  string combine(string basePath,string fileName);
17  char getDefaultSeparator();
18  string getSeparators();
19  bool isSeparator(char c);
20  string getIllegalNameChars(bool allowWC = false);
21  string replaceIllegalNameChars(string fn, bool allowWC = false);
22  string replaceIllegalPathChars(string fn);
23  bool isInsideDirectory(pfc::string directory, pfc::string inside);
24  bool isDirectoryRoot(string path);
25  string validateFileName(string name, bool allowWC = false);//removes various illegal things from the name, exact effect depends on the OS, includes removal of the invalid characters
26 
27  template<typename t1, typename t2> inline bool equals(const t1 & v1, const t2 & v2) {return comparator::compare(v1,v2) == 0;}
28 
29  template<typename t1, typename t2> inline int compare( t1 const & p1, t2 const & p2 ) {return comparator::compare(p1, p2); }
30  }
31  }
32 }
string getDirectory(string filePath)
Definition: pathUtils.cpp:28
int compare(t1 const &p1, t2 const &p2)
Definition: pathUtils.h:29
string combine(string basePath, string fileName)
Definition: pathUtils.cpp:41
string getFileName(string path)
Definition: pathUtils.cpp:11
string getSeparators()
Definition: pathUtils.cpp:56
string validateFileName(string name, bool allowWC)
Definition: pathUtils.cpp:155
string getFileNameWithoutExtension(string path)
Definition: pathUtils.cpp:16
bool isSeparator(char c)
Definition: pathUtils.cpp:53
bool isDirectoryRoot(string path)
Definition: pathUtils.cpp:118
string getParent(string filePath)
Definition: pathUtils.cpp:30
bool isInsideDirectory(pfc::string directory, pfc::string inside)
Definition: pathUtils.cpp:109
string getIllegalNameChars(bool allowWC)
Definition: pathUtils.cpp:145
string getFileExtension(string path)
Definition: pathUtils.cpp:22
static int compare(T1 const &v1, T2 const &v2)
Definition: stringNew.h:170
string replaceIllegalNameChars(string fn, bool allowWC)
Definition: pathUtils.cpp:93
string replaceIllegalPathChars(string fn)
Definition: pathUtils.cpp:74
char getDefaultSeparator()
Definition: pathUtils.cpp:124
string::comparatorCaseInsensitive comparator
Definition: pathUtils.h:5
New EXPERIMENTAL string class, allowing efficient copies and returning from functions. Does not implement the string_base interface so you still need string8 in many cases. Safe to pass between DLLs, but since a reference is used, objects possibly created by other DLLs must be released before owning DLLs are unloaded.
Definition: stringNew.h:19
bool equals(const t1 &v1, const t2 &v2)
Definition: pathUtils.h:27