40 #if CONFIG_ENABLE_BOOST 41 # include "boost/functional/hash.hpp" 88 : path((const unsigned char*)p, (const unsigned char*)p+strlen(p))
96 : path(p, p+wcslen(p))
102 : path((const unsigned char*)s.c_str(), (const unsigned char*)s.c_str()+s.length())
147 return path < rhs.
path;
152 return path == rhs.
path;
164 return path[path.length()-1] == separator;
169 const size_t idxSlash = path.find_last_of(separator);
170 if(idxSlash == String::npos)
172 return path.substr(0, idxSlash);
177 const size_t idxSlash = path.find_last_of(separator);
178 if(idxSlash == String::npos)
180 return path.substr(idxSlash+1);
185 const Path filename = Filename();
186 const size_t idxDot = filename.
string().find_last_of(
'.');
187 if(idxDot == String::npos)
189 return filename.
string().substr(0, idxDot);
195 const Path filename = Filename();
196 const size_t idxDot = filename.
string().find_last_of(
'.');
197 if(idxDot == String::npos)
199 return filename.
string().substr(idxDot);
204 return Parent() /
Path(Basename().
string() + extension.
string());
215 if(rhs.
path.find((ret.
separator ==
'/')?
'\\' :
'/') != String::npos)
217 PrintToDebugOutput();
240 const size_t idx = ret.
path.rfind(other.
path);
241 if(idx == String::npos)
244 return path.substr(0, idx);
247 static Status Validate(String::value_type c);
252 debug_printf(
"Path %s, separator %c\n", string8().c_str(), (
char)separator);
257 const size_t idxBackslash = path.find(
'\\');
259 if(path.find(
'/') != String::npos && idxBackslash != String::npos)
261 PrintToDebugOutput();
266 separator = (idxBackslash == String::npos)?
'/' :
'\\';
295 #if CONFIG_ENABLE_BOOST 300 struct hash<Path> : std::unary_function<Path, std::size_t>
302 std::size_t operator()(
const Path& path)
const 310 #endif // #if CONFIG_ENABLE_BOOST 312 #endif // #ifndef INCLUDED_PATH void DetectSeparator()
Definition: path.h:255
Path Filename() const
Definition: path.h:175
std::string string8() const
Return a UTF-8 version of the path, in a human-readable but potentially lossy form.
Definition: path.h:136
std::string utf8_from_wstring(const std::wstring &src, Status *err)
opposite of wstring_from_utf8
Definition: utf8.cpp:208
bool IsDirectory() const
Definition: path.h:160
const Status PATH_CHARACTER_ILLEGAL
Definition: path.h:50
bool operator==(const FCDJointWeightPair &a, const FCDJointWeightPair &b)
Definition: GeomReindex.cpp:59
Path Parent() const
Definition: path.h:167
Path(const char *p)
Definition: path.h:87
void PrintToDebugOutput() const
Definition: path.h:250
Path BeforeCommon(Path other) const
Return the path before the common part of both paths.
Definition: path.h:230
LIB_API bool path_is_subpath(const wchar_t *s1, const wchar_t *s2)
is s2 a subpath of s1, or vice versa? (equal counts as subpath)
Definition: path.cpp:51
Path Basename() const
Definition: path.h:183
const Status PATH_CHARACTER_UNSAFE
Definition: path.h:51
wchar_t separator
Definition: path.h:278
bool operator!=(const Path &rhs) const
Definition: path.h:155
String path
Definition: path.h:269
const String & string() const
Definition: path.h:125
Path(const wchar_t *p)
Definition: path.h:95
std::wstring String
Definition: path.h:80
bool operator==(const Path &rhs) const
Definition: path.h:150
i64 Status
Error handling system.
Definition: status.h:171
Path operator/(Path rhs) const
Definition: path.h:207
const Status PATH_MIXED_SEPARATORS
Definition: path.h:53
void debug_printf(const char *fmt,...)
write a formatted string to the debug channel, subject to filtering (see below).
Definition: debug.cpp:142
Path(const std::wstring &s)
Definition: path.h:107
Path(const std::string &s)
Definition: path.h:101
#define DEBUG_WARN_ERR(status)
display the error dialog with text corresponding to the given error code.
Definition: debug.h:336
Introduction
Definition: debug.h:404
const char * extension
Definition: mongoose.cpp:1733
bool empty() const
Definition: path.h:120
Path ChangeExtension(Path extension) const
Definition: path.h:202
Path Extension() const
Definition: path.h:193
static std::wistream & operator>>(std::wistream &s, Path &path)
Definition: path.h:287
bool operator<(const Path &rhs) const
Definition: path.h:145
Path & operator=(const Path &rhs)
Definition: path.h:113
LIB_API const wchar_t * path_name_only(const wchar_t *path)
Get the path component of a path.
Definition: path.cpp:85
Path()
Definition: path.h:82
size_t hash_value(const CVector4D &v)
Definition: ShaderDefines.cpp:28
static std::wostream & operator<<(std::wostream &s, const Path &path)
Definition: path.h:281
const Status PATH_NOT_FOUND
Definition: path.h:52