28 #ifndef YSL_INC_Service_FileSystem_h_
29 #define YSL_INC_Service_FileSystem_h_ 1
32 #include YFM_YSLib_Core_YString
51 ImplRet(YCL_FS_CharIsDelimiter(str[0], u))
57 ImplRet(YCL_FS_StringIsRoot(str, u))
100 template<
typename _type,
131 operator/=(const String&);
133 operator/=(const
Path&);
137 operator==(const Path&, const Path&);
140 operator<(const Path&, const Path&);
147 operator String() const;
152 DefCvt(const,
string, GetMBCS(CS_Path))
172 PDefH(
void, Normalize, )
197 using ypath::filter_self;
202 using ypath::get_norm;
206 using ypath::is_absolute;
208 using ypath::is_relative;
211 using ypath::merge_parents;
214 using ypath::pop_back;
217 using ypath::push_back;
220 PDefH(
void, swap, Path& pth)
221 ImplExpr(static_cast<ypath&>(pth).swap(*this))
225 ImplRet(to_string(static_cast<const ypath&>(pth),
226 ucs2string{YCL_PATH_DELIMITER}))
232 inline PDefHOp(
bool, ==,
const Path& x,
const Path& y)
233 ImplRet(static_cast<const ypath&>(x) == static_cast<const ypath&>(y))
234 inline PDefHOp(
bool, !=, const
Path& x, const
Path& y)
236 inline PDefHOp(
bool, <, const
Path& x, const
Path& y)
238 inline PDefHOp(
bool, <=, const
Path& x, const
Path& y)
240 inline PDefHOp(
bool, >, const
Path& x, const
Path& y)
242 inline PDefHOp(
bool, >=, const
Path& x, const
Path& y)
245 inline PDefHOp(
Path, /, const Path& x, const Path& y)
246 ImplRet(std::move(Path(x) /= y))
266 inline
PDefH(String, GetExtensionOf, const Path& pth)
267 ImplRet(pth.empty() ? String() : GetExtensionOf(pth.back()))
286 ImplRet(IsAbsolute(path.c_str()))
287 inline
PDefH(
bool, IsAbsolute, const String& path)
289 inline
PDefH(
bool, IsAbsolute, const Path& pth)
290 ImplRet(!pth.empty() && IsAbsolute(pth.GetString()))
297 inline
PDefH(
bool, IsRelative, const
string& path)
299 inline
PDefH(
bool, IsRelative, const String& path)
301 inline
PDefH(
bool, IsRelative, const Path& pth)
311 ImplRet(VerifyDirectory(path.c_str()))
312 inline
PDefH(
bool, VerifyDirectory, const String& path)
313 ImplRet(VerifyDirectory(path.GetMBCS(CS_Path)))
314 inline
PDefH(
bool, VerifyDirectory, const Path& pth)
315 ImplRet(!pth.empty() && VerifyDirectory(pth.GetString()))
331 ImplExpr(EnsureDirectory(Path(path)))
332 inline
PDefH(
void, EnsureDirectory, const
string& path)
334 ImplExpr(EnsureDirectory(path.c_str()))
335 inline
PDefH(
void, EnsureDirectory, const String& path)
337 ImplExpr(EnsureDirectory(path.GetMBCS(CS_Path)))
const String &path const Path &pth ImplRet(!pth.empty()&&VerifyDirectory(pth.GetString())) YF_API void EnsureDirectory(const Path &) ythrow(std PDefH(void, EnsureDirectory, const char *path) ythrow(std YF_API PathCategor ClassifyPath)(const String &, ypath::norm &&=PathNorm())
验证路径表示的目录是否存在,若不存在则逐级创建。
#define DefDeDtor(_t)
定义默认析构函数。
#define YCL_FS_StringIsParent(_s, _p)
void ListFiles(const Path &pth, vector< String > &lst)
Path(const ucs2string &str)
#define DefDeCopyCtor(_t)
typename _tSeqCon::value_type value_type
String FetchCurrentWorkingDirectory(size_t len)
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
GSStringTemplate< CHRLib::ucs2_t >::basic_string ucs2string
CS_Path PDefH(String, GetExtensionOf, const Path &pth) ImplRet(pth.empty()?String() const String &path const Path &pth IsRelative
String GetExtensionOf(const String &fname)
void swap(any &x, any &y)
交换对象。
Path(_type &&arg, Text::Encoding enc=CS_Path)
CS_Path PDefH(String, GetExtensionOf, const Path &pth) ImplRet(pth.empty()?String() PDefH(bool, IsAbsolute, const string &path) ImplRet(IsAbsolute(path.c_str())) inline PDefH(bool
取当前工作目录。
YSLib 标准字符串(使用 UCS-2 作为内部编码)。
#define DefDeMoveCtor(_t)
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
#define ythrow(...)
YSLib 动态异常规范:根据是否使用异常规范宏指定或忽略动态异常规范。
void EnsureDirectory(const Path &pth)
enable_if_t<!is_same< _tClass &, remove_rcv_t< _tParam > & >::value, _type > exclude_self_ctor_t
移除选择类类型的特定重载避免构造模板和复制/转移构造函数冲突。
typename base::const_iterator const_iterator
#define DefClone(_q, _t)
动态复制。
std::string to_string(unsigned char val)
转换为字符串。
char16_t ucs2_t
UCS-2 字符类型。
DefDeCtor(Path) Path(const ucs2_t *str)
无参数构造:默认实现。
#define DefDeMoveAssignment(_t)
#define DefCvt(_q, _t,...)
CS_Path PDefH(String, GetExtensionOf, const Path &pth) ImplRet(pth.empty()?String() const String &path ImplRet(IsAbsolute(path.GetMBCS(CS_Path))) inline PDefH(bool
判断路径表示相对路径(包括空路径)。
CS_Path PDefH(String, GetExtensionOf, const Path &pth) ImplRet(pth.empty()?String() IsAbsolute
#define DefDeCopyAssignment(_t)
typename base::iterator iterator
YF_API NodeCategory ClassifyNode(const Path &)
按文件系统节点类别对路径分类。
#define YCL_FS_StringIsCurrent(_s, _p)