Mercurial > foo_out_sdl
comparison foosdk/sdk/pfc/pathUtils.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 | |
| 3 #include <functional> | |
| 4 #include "string_base.h" | |
| 5 | |
| 6 namespace pfc { | |
| 7 namespace io { | |
| 8 namespace path { | |
| 9 #ifdef _WINDOWS | |
| 10 typedef string::comparatorCaseInsensitive comparator; | |
| 11 #else | |
| 12 typedef string::comparatorCaseSensitive comparator; // wild assumption | |
| 13 #endif | |
| 14 | |
| 15 | |
| 16 typedef std::function<const char* (char)> charReplace_t; | |
| 17 | |
| 18 const char * charReplaceDefault(char); | |
| 19 const char * charReplaceModern(char); | |
| 20 | |
| 21 string getFileName(string path); | |
| 22 string getFileNameWithoutExtension(string path); | |
| 23 string getFileExtension(string path); | |
| 24 string getParent(string filePath); | |
| 25 string getDirectory(string filePath);//same as getParent() | |
| 26 string combine(string basePath,string fileName); | |
| 27 char getDefaultSeparator(); | |
| 28 string getSeparators(); | |
| 29 bool isSeparator(char c); | |
| 30 string getIllegalNameChars(bool allowWC = false); | |
| 31 string replaceIllegalNameChars(string fn, bool allowWC = false, charReplace_t replace = charReplaceDefault); | |
| 32 string replaceIllegalPathChars(string fn, charReplace_t replace = charReplaceDefault); | |
| 33 bool isInsideDirectory(pfc::string directory, pfc::string inside); | |
| 34 bool isDirectoryRoot(string path); | |
| 35 string validateFileName(string name, bool allowWC = false, bool preserveExt = false, charReplace_t replace = charReplaceDefault);//removes various illegal things from the name, exact effect depends on the OS, includes removal of the invalid characters | |
| 36 | |
| 37 template<typename t1, typename t2> inline bool equals(const t1 & v1, const t2 & v2) {return comparator::compare(v1,v2) == 0;} | |
| 38 | |
| 39 template<typename t1, typename t2> inline int compare( t1 const & p1, t2 const & p2 ) {return comparator::compare(p1, p2); } | |
| 40 } | |
| 41 } | |
| 42 } |
