YSTest: FileSystem.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

YSLib/Service/FileSystem.h
浏览该文件的文档.
1 /*
2 © 2010-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_Service_FileSystem_h_
29 #define YSL_INC_Service_FileSystem_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Service_File // for TryRemove, TryUnlink;
33 #include YFM_YSLib_Core_YString
34 #include <ystdex/path.hpp>
35
36 namespace YSLib
37 {
38
39 namespace IO
40 {
41
46 template<class _tString>
47 inline ystdex::decay_t<_tString>
48 NormalizeDirectoryPathTail(_tString&& str, typename
49 ystdex::string_traits<_tString>::const_pointer tail = &ystdex::to_array<
50 typename ystdex::string_traits<_tString>::value_type>("/\\")[0])
51 {
52 return ystdex::rtrim(yforward(str), tail) + typename
53 ystdex::string_traits<_tString>::value_type(YCL_PATH_DELIMITER);
54 }
55
56
61 struct PathTraits
62 {
63 using value_type = YSLib::String;
64
65 template<typename _tChar>
66 static yconstfn bool
67 IsDelimiter(_tChar c) ynothrow
68 {
69 return YCL_FS_CharIsDelimiter(c, _tChar);
70 }
71
72 template<class _tString>
73 static yconstfn bool
74 is_parent(const _tString& str) ynothrow
75 {
76 return YCL_FS_StringIsParent(str, decltype(str[0]));
77 }
78
79 template<class _tString>
80 static yconstfn bool
81 is_root(const _tString& str) ynothrow
82 {
83 return ystdex::string_length(str) == FetchRootNameLength(str);
84 }
86 static bool
87 is_root(const String& str) ynothrow
88 {
89 return str.length() == FetchRootNameLength(u16string_view(str));
90 }
91
92 template<class _tString>
93 static yconstfn bool
94 is_self(const _tString& str) ynothrow
95 {
96 return YCL_FS_StringIsCurrent(str, decltype(str[0]));
97 }
98 };
99
100
102 using ypath = ystdex::path<vector<String>, PathTraits>;
103
104
109 class YF_API Path : private ypath, private ystdex::totally_ordered<Path>,
110 private ystdex::dividable<Path, String>, private ystdex::dividable<Path>
111 {
112 public:
113 using ypath::iterator;
114 using ypath::const_iterator;
116 using ypath::value_type;
117
118 public:
122 DefDeCtor(Path)
124
125 explicit
126 Path(ypath pth) ynothrow
127 : ypath(std::move(pth))
128 {}
130 explicit
131 Path(const u16string& str) ynothrow
132 : Path(Parse(str))
133 {}
134 template<typename _type,
135 yimpl(typename = ystdex::exclude_self_t<Path, _type>)>
136 explicit
137 Path(_type&& arg, Text::Encoding enc = Text::CS_Default)
138 : ypath(Parse(String(yforward(arg), enc)))
139 {}
141 template<typename _tIn>
143 Path(_tIn first, _tIn last)
144 : ypath(first, last)
145 {}
147 template<typename _tElem>
148 Path(std::initializer_list<_tElem> il)
149 : ypath(il)
150 {}
154 DefDeCopyCtor(Path)
158 DefDeMoveCtor(Path)
159 DefDeDtor(Path)
160
165 DefDeCopyAssignment(Path)
170 DefDeMoveAssignment(Path)
171
173
174 PDefHOp(Path&, /=, const String& fname)
176 ImplRet(GetBaseRef() /= fname, *this)
177 PDefHOp(Path&, /=, const Path& pth)
178 ImplRet(GetBaseRef() /= pth, *this)
180
181 friend PDefHOp(bool, ==, const Path& x, const Path& y)
182 ImplRet(x.GetBase() == y.GetBase())
183
184 friend PDefHOp(bool, <, const Path& x, const Path& y)
185 ImplRet(x.GetBase() < y.GetBase())
186
192 explicit
193 DefCvt(const, String, GetLeafString())
198 explicit
199 DefCvt(const, string, String(*this).GetMBCS())
200
202 DefGetter(const ynothrow, const ypath&, Base, *this)
204 DefGetter(ynothrow, ypath&, BaseRef, *this)
206
207 PDefH(String, GetLeafString,
209 char16_t delimiter = char16_t(YCL_PATH_DELIMITER)) const
210 ImplRet(ystdex::to_string(GetBase(), {delimiter}))
215 String
216 GetString(char16_t = char16_t(YCL_PATH_DELIMITER)) const;
218
222 PDefH(void, Normalize, )
223 ImplExpr(ystdex::normalize(*this))
224
230 static ypath
231 Parse(const u16string&);
232
240 String
241 Verify(char16_t = char16_t(YCL_PATH_DELIMITER)) const;
246 PDefH(string, VerifyAsMBCS, char16_t delimiter = char16_t(
247 YCL_PATH_DELIMITER), Text::Encoding enc = Text::CS_Default) const
248 ImplRet(Verify(delimiter).GetMBCS(enc))
249
251
252 using ypath::back;
253
254 using ypath::begin;
255
256 using ypath::cbegin;
257
258 using ypath::clear;
259
260 using ypath::cend;
261
262 using ypath::empty;
263
264 using ypath::end;
265
266 using ypath::erase;
267
269 using ypath::filter_self;
270
271 using ypath::front;
272
273 using ypath::insert;
274
275 using ypath::is_absolute;
276
277 using ypath::is_relative;
278
280 using ypath::max_size;
281
283 using ypath::merge_parents;
284
286 using ypath::pop_back;
287
289 using ypath::push_back;
290
292 using ypath::size;
293
294 using ypath::swap;
295 PDefH(void, swap, Path& pth)
296 ImplExpr(pth.GetBaseRef().swap(*this))
297
299 friend PDefH(String, to_string, const Path& pth)
300 ImplRet(to_string(pth.GetBase(), {char16_t(YCL_PATH_DELIMITER)}))
302 };
303
308 inline DefSwap(ynothrow, Path)
309
310
311
317 template<class _tString>
319 _tString
320 GetExtensionOf(const _tString& fname)
321 {
322 return ystdex::find_suffix(fname, typename _tString::value_type('.'));
323 }
324 inline PDefH(String, GetExtensionOf, const Path& pth)
325 ImplRet(pth.empty() ? String() : GetExtensionOf(pth.back()))
327
328
334 yconstexpr const size_t MaxPathLength(yimpl(1 << 10));
335
342 YF_API String
343 FetchCurrentWorkingDirectory(size_t = MaxPathLength);
344
346
347
349 inline PDefH(bool, IsAbsolute, const string& path)
350 ImplRet(IsAbsolute(path.c_str()))
351 inline PDefH(bool, IsAbsolute, const String& path)
352 ImplRet(IsAbsolute(path.GetMBCS()))
353 inline PDefH(bool, IsAbsolute, const Path& pth)
354 ImplRet(!pth.empty() && IsAbsolute(pth.GetString()))
356
362 template<typename _type>
363 inline bool
364 IsRelative(const _type& arg)
365 {
366 return !IsAbsolute(arg);
367 }
368
377 YF_API Path
378 MakeNormalizedAbsolute(const Path&, size_t = MaxPathLength);
379
380
386 YF_API YB_NONNULL(1) bool
387 VerifyDirectory(const char*);
389 YF_API YB_NONNULL(1) bool
390 VerifyDirectory(const char16_t*);
391 inline PDefH(bool, VerifyDirectory, const string& path)
392 ImplRet(VerifyDirectory(path.c_str()))
394 inline PDefH(bool, VerifyDirectory, const u16string& path)
395 ImplRet(VerifyDirectory(path.c_str()))
396 inline PDefH(bool, VerifyDirectory, const String& path)
397 ImplRet(VerifyDirectory(path.c_str()))
398 inline PDefH(bool, VerifyDirectory, const Path& pth)
399 ImplRet(!pth.empty() && VerifyDirectory(pth.GetString()))
401
402
403
411 YF_API void
412 EnsureDirectory(const Path&);
413 inline PDefH(void, EnsureDirectory, const char* path)
414 ImplExpr(EnsureDirectory(Path(path)))
415 inline PDefH(void, EnsureDirectory, const string& path)
416 ImplExpr(EnsureDirectory(path.c_str()))
417 inline PDefH(void, EnsureDirectory, const String& path)
418 ImplExpr(EnsureDirectory(path.GetMBCS()))
420
421
427 template<typename _func>
428 void
429 Traverse(HDirectory& dir, _func f)
430 {
431 std::for_each(FileIterator(&dir), FileIterator(), [&, f](NativePathView npv)
432 ynoexcept_spec(f(dir.GetNodeCategory(), npv)){
433 YAssert(!npv.empty(), "Empty name found.");
434 if(!PathTraits::is_self(npv))
435 // TODO: Simplify.
436 f(dir.GetNodeCategory(), npv);
437 });
438 }
440
441 template<typename _func>
443 inline YB_NONNULL(1) void
444 Traverse(const char* path, _func f)
445 {
446 // NOTE: Separators at end of path is allowed by %HDirectory::HDirectory.
447 HDirectory dir(path);
448
449 IO::Traverse(dir, f);
450 }
452 template<typename _func>
453 inline void
454 Traverse(const string& path, _func f)
455 {
456 IO::Traverse(path.c_str(), f);
457 }
459 template<typename _func>
460 inline void
461 Traverse(const Path& pth, _func f)
462 {
463 IO::Traverse(string(pth), f);
464 }
465
467
468
472 template<typename _func>
473 YB_NONNULL(1) void
474 TraverseChildren(const char* path, _func f)
475 {
476 IO::Traverse(path, [f](NodeCategory c, NativePathView npv)
477 ynoexcept_spec(f(c, npv)){
478 if(!PathTraits::is_parent(npv))
479 f(c, npv);
480 });
481 }
483 template<typename _func>
484 void
485 TraverseChildren(const string& path, _func f)
486 {
487 IO::TraverseChildren(path.c_str(), f);
488 }
490 template<typename _func>
492 inline void
493 TraverseChildren(const Path& pth, _func f)
494 {
495 IO::TraverseChildren(string(pth), f);
496 }
498
506 template<typename _func, typename... _tParams>
507 auto
508 TraverseTree(_func f, const Path& dst, const Path& src, _tParams&&... args)
509 -> decltype(f(std::declval<Path&>(), std::declval<Path&>(),
510 std::forward<_tParams>(args)...))
511 {
512 EnsureDirectory(dst);
513 TraverseChildren(src, [&](NodeCategory c, NativePathView npv){
514 const String name(npv);
515 // NOTE: Allowed to be modified.
516 auto dname(dst / name), sname(src / name);
517
518 // XXX: Blocked. 'yforward' cause G++ 5.2 crash: internal compiler
519 // error: Aborted (program cc1plus) or crash silently.
520 return c == NodeCategory::Directory
521 ? IO::TraverseTree(f, dname, sname, std::forward<_tParams>(args)...)
522 : f(dname, sname, std::forward<_tParams>(args)...);
523 });
524 }
525
526
528
529
534 using CopyFileHandler = std::function<void(FileDescriptor, FileDescriptor)>;
535
537
538 const auto PreserveModificationTime(ystdex::bind_forward(
540 &FileDescriptor::SetModificationTime, &FileDescriptor::GetModificationTime));
542 const auto PreserveModificationAndAccessTime(ystdex::bind_forward(
543 &FileDescriptor::SetModificationAndAccessTime,
544 &FileDescriptor::GetModificationAndAccessTime));
546
547
562 YF_API void
563 CopyFile(UniqueFile, FileDescriptor);
565
566 YF_API YB_NONNULL(2) void
568 CopyFile(UniqueFile, const char*);
570
571
573 YF_API YB_NONNULL(1) void
575 CopyFile(const char*, FileDescriptor, mode_t = DefaultPMode(),
576 size_t = 1, bool = {});
577 YF_API YB_NONNULL(1, 2) void
578 CopyFile(const char*, const char*, mode_t = DefaultPMode(), size_t = 1,
579 bool = {});
581
588 YF_API YB_NONNULL(1) void
589 CopyFile(const char*, FileDescriptor, CopyFileHandler, mode_t = DefaultPMode(),
590 size_t = 1, bool = {});
591 YF_API YB_NONNULL(1, 2) void
592 CopyFile(const char*, const char*, CopyFileHandler, mode_t = DefaultPMode(),
593 size_t = 1, bool = {});
595
596
597
598
600
601
607 template<typename... _tParams>
608 void
609 CopyTree(const Path& dst, const Path& src, _tParams&&... args)
610 {
611 // XXX: Blocked. 'yforward' may cause G++ 5.2 silently crash.
612 IO::TraverseTree([](const Path& dname, const Path& sname,
613 _tParams&&... fargs){
614 IO::CopyFile(string(dname).c_str(), string(sname).c_str(),
615 std::forward<_tParams>(fargs)...);
616 }, dst, src, std::forward<_tParams>(args)...);
617 }
618
620
621
626 YF_API void
627 ClearTree(const Path&);
628 inline PDefH(void, ClearTree, const string& pth)
629 ImplRet(ClearTree(Path(pth)))
631
633
634 inline PDefH(void, DeleteTree, const Path& pth)
635 ImplExpr(ClearTree(pth), TryRemove(string(pth).c_str()))
637 inline PDefH(void, DeleteTree, const string& pth)
638 ImplExpr(DeleteTree(Path(pth)))
640
641
647 YF_API void
648 ListFiles(const Path&, vector<String>&);
650
651
657 YF_API NodeCategory
658 ClassifyNode(const Path&);
659
660 } // namespace IO;
661
662 } // namespace YSLib;
663
664 #endif
665
platform::DefaultPMode
YF_API YB_STATELESS mode_t DefaultPMode() ynothrow
取默认权限。
Definition: FileIO.cpp:716
CHRLib::enc
enc
Definition: CharacterProcessing.h:81
YSLib::Drawing::x
The boundary is out of the const Rect SDst SPos x
Definition: YDraw.h:127
YSLib::IO::MakeNormalizedAbsolute
YF_API Path MakeNormalizedAbsolute(const Path &, size_t=MaxPathLength)
根据当前工作目录和指定路径取绝对路径。
Definition: YSLib/Service/FileSystem.cpp:90
platform::mode_t
::mode_t mode_t
文件模式类型。
Definition: FileIO.h:108
ystdex::to_string
std::string to_string(const std::thread::id &)
转换 thread::id 为字符串表示。
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:653
ystdex::path::iterator
typename base::iterator iterator
Definition: path.hpp:141
YSLib::IO::Traverse
void Traverse(const string &path, _func f)
Definition: YSLib/Service/FileSystem.h:454
YSLib::IO::YB_NONNULL
YF_API YB_NONNULL(1) UniqueFile OpenFile(const char *
打开文件。
Definition: File.h:60
YSLib::IO::TraverseTree
auto TraverseTree(_func f, const Path &dst, const Path &src, _tParams &&...args) -> decltype(f(std::declval< Path & >(), std::declval< Path & >(), std::forward< _tParams >(args)...))
递归遍历目录树。
Definition: YSLib/Service/FileSystem.h:508
YSLib::IO::FetchCurrentWorkingDirectory
PDefH(String, GetExtensionOf, const Path &pth) ImplRet(pth.empty()?String() YF_API String FetchCurrentWorkingDirectory(size_t=MaxPathLength)
默认目录路径长度。
Definition: YSLib/Service/FileSystem.h:343
ystdex::swap
void swap(container_adaptor< _tSeqCon > &x, container_adaptor< _tSeqCon > &y)
Definition: container.hpp:179
ystdex::cpp2014::cend
auto cend(const _tRange &c) -> decltype(std::end(c))
Definition: range.hpp:87
platform::containers::u16string
basic_string< char16_t > u16string
Definition: Container.h:103
platform::FileDescriptor::GetModificationAndAccessTime
array< FileTime, 2 > GetModificationAndAccessTime() const
取修改和访问时间。
Definition: FileIO.cpp:465
YSLib::yimpl
YF_API yimpl(GUIApplication &) FetchGlobalInstance()
取全局应用程序实例。
ystdex::path::const_iterator
typename base::const_iterator const_iterator
Definition: path.hpp:142
NPL::A1::name
ctx const string & name
Definition: NPLA1.h:248
YSLib::IO::FileDescriptor
YF_API const char *YF_API FileDescriptor
Definition: YSLib/Service/FileSystem.h:575
ystdex::string_traits::value_type
remove_rcv_t< decltype(std::declval< string_type >()[0])> value_type
Definition: string.hpp:58
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YCL_FS_StringIsCurrent
#define YCL_FS_StringIsCurrent(_s, _p)
判断字符串是否是当前路径。
Definition: YCLib/FileSystem.h:55
platform::NodeCategory
NodeCategory
文件节点类别。
Definition: FileIO.h:117
YSLib::IO::PreserveModificationTime
const auto PreserveModificationTime(ystdex::bind_forward(&FileDescriptor::SetModificationTime,&FileDescriptor::GetModificationTime))
保持修改时间。
DefDeCopyAssignment
#define DefDeCopyAssignment(_t)
Definition: YBaseMacro.h:185
YSLib::IO::Path::Path
Path(_tIn first, _tIn last)
Definition: YSLib/Service/FileSystem.h:143
ystdex::path::value_type
typename _tSeqCon::value_type value_type
Definition: path.hpp:134
YSLib::IO::CopyFileHandler
std::function< void(FileDescriptor, FileDescriptor)> CopyFileHandler
复制文件处理器：通知文件复制事件。
Definition: YSLib/Service/FileSystem.h:534
YCL_FS_StringIsParent
#define YCL_FS_StringIsParent(_s, _p)
判断字符串是否是父目录。
Definition: YCLib/FileSystem.h:62
ystdex::normalize
auto normalize(_tString &str) -> decltype(str.resize(ystdex::ntctslen(str.c_str())))
NTCTS 正规化：保留空字符之前的字符。
Definition: string.hpp:412
CHRLib::CS_Default
yconstexpr const Encoding CS_Default(CharSet::UTF_8)
默认字符编码。
YSLib::IO::bool
YF_API const char *YF_API bool
Definition: YSLib/Service/FileSystem.h:576
platform_ex::Windows::Directory
Definition: MinGW32.h:442
ystdex::dep_ops::dividable
_t< details::ops_seq< _type, _type2, _tOpt, details::ops_bin_id_seq< 3, 0, 1 >>> dividable
Definition: operators.hpp:280
YSLib::IO::EnsureDirectory
EnsureDirectory
Definition: YSLib/Service/FileSystem.h:415
YSLib::Text::String
YSLib 标准字符串（使用 UCS-2 作为内部编码）。
Definition: YString.h:46
YSLib::IO::Path::DefSwap
#define DefSwap(_q, _t)
交换。
Definition: YSLib/Service/FileSystem.h:308
ystdex::exclude_self_t
enable_if_t<!is_same< _tClass &, decay_t< _tParam > & >::value, _type > exclude_self_t
移除选择类类型的特定重载避免构造模板和复制/转移特殊成员函数冲突。
Definition: type_traits.hpp:708
CHRLib::c
c
Definition: CharacterProcessing.h:81
YSLib::IO::DeleteTree
DeleteTree
Definition: YSLib/Service/FileSystem.h:634
CHRLib::CharSet::Encoding
Encoding
字符流编码标识。
Definition: Encoding.h:58
YSLib::IO::VerifyDirectory
VerifyDirectory
Definition: YSLib/Service/FileSystem.h:394
YSLib::IO::ImplRet
const String &path ImplRet(IsAbsolute(path.GetMBCS())) inline PDefH(bool
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:240
DefCvt
#define DefCvt(_q, _t,...)
Definition: YBaseMacro.h:205
CHRLib::char16_t
char16_t((*c_ptr<< CHAR_BIT)|c_ptr[1])) inline PDefH(char16_t
取 c_ptr 指向的小端序双字节字符。
YSLib::IO::PreserveModificationAndAccessTime
const auto PreserveModificationAndAccessTime(ystdex::bind_forward(&FileDescriptor::SetModificationAndAccessTime,&FileDescriptor::GetModificationAndAccessTime))
保持修改和访问时间。
platform::UniqueFile
unique_ptr_from< FileDescriptor::Deleter > UniqueFile
Definition: FileIO.h:427
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
ynoexcept_spec
#define ynoexcept_spec(...)
表达式 noexcept 异常规范。
Definition: ydef.h:768
YSLib::IO::PathTraits::is_parent
static yconstfn bool is_parent(const _tString &str) ynothrow
Definition: YSLib/Service/FileSystem.h:74
YSLib::IO::mode_t
YF_API mode_t
Definition: File.h:49
YSLib::IO::PathTraits::is_root
static yconstfn bool is_root(const _tString &str) ynothrow
Definition: YSLib/Service/FileSystem.h:81
NPL::dst
YF_API const char src const string const char * dst
Definition: Dependency.h:93
YModules.h
ystdex::rtrim
_tString && rtrim(_tString &&str, typename string_traits< _tString >::value_type c)
删除字符串中指定的连续后缀字符。
Definition: string.hpp:618
YSLib::IO::ListFiles
void ListFiles(const Path &pth, vector< String > &lst)
Definition: YSLib/Service/FileSystem.cpp:222
std
Definition: memory.hpp:1100
YSLib::IO::ClearTree
YF_API void ClearTree(const Path &)
路径指向的不是一个目录或删除失败。
Definition: YSLib/Service/FileSystem.cpp:210
YSLib::IO::PathTraits::is_root
static bool is_root(const String &str) ynothrow
Definition: YSLib/Service/FileSystem.h:87
platform::FileDescriptor::SetModificationTime
void SetModificationTime(FileTime) const
设置修改时间。
Definition: FileIO.cpp:572
path.hpp
抽象路径模板。
DefDeMoveAssignment
#define DefDeMoveAssignment(_t)
Definition: YBaseMacro.h:190
ystdex::size
auto size(const _tRange &c) -> decltype(c.size())
类容器访问。
Definition: range.hpp:233
ystdex::basic_string_view
Definition: string_view.hpp:49
YSLib::IO::CopyTree
void CopyTree(const Path &dst, const Path &src, _tParams &&...args)
复制目录树。
Definition: YSLib/Service/FileSystem.h:609
YSLib::YAssert
YAssert(!(v< Deref(a)),"Value less than lower bound found.")
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:161
YSLib::path
YF_API const char * path
Definition: Initialization.h:74
ystdex::path
一般路径模板。
Definition: path.hpp:123
IO
ystdex
特性测试宏。
Definition: ydef.h:796
YSLib::Text::str
const char const char * str
Definition: TextFile.h:77
YSLib::IO::Path::Path
Path(std::initializer_list< _tElem > il)
Definition: YSLib/Service/FileSystem.h:148
DefDeMoveCtor
#define DefDeMoveCtor(_t)
Definition: YBaseMacro.h:166
YSLib::IO::TraverseChildren
void TraverseChildren(const string &path, _func f)
Definition: YSLib/Service/FileSystem.h:485
YSLib::IO::ClassifyNode
const Path &pth const string &pth vector< String > &YF_API NodeCategory ClassifyNode(const Path &)
按文件系统节点类别对路径分类。
Definition: YSLib/Service/FileSystem.cpp:233
ystdex::basic_string_view::empty
bool empty() const
Definition: string_view.hpp:163
platform::FileDescriptor::SetModificationAndAccessTime
void SetModificationAndAccessTime(array< FileTime, 2 >) const
设置修改和访问时间。
Definition: FileIO.cpp:585
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
ystdex::string_traits::const_pointer
const value_type * const_pointer
Definition: string.hpp:70
ystdex::u16string_view
basic_string_view< char16_t > u16string_view
Definition: string_view.hpp:416
platform::FileDescriptor::GetModificationTime
FileTime GetModificationTime() const
取修改时间。
Definition: FileIO.cpp:460
YSLib::IO::PDefH
PDefH(bool, IsAbsolute, const string &path) ImplRet(IsAbsolute(path.c_str())) inline PDefH(bool
判断路径表示绝对路径。
YSLib::IO::PathTraits::is_self
static yconstfn bool is_self(const _tString &str) ynothrow
Definition: YSLib/Service/FileSystem.h:94
DefDeDtor
#define DefDeDtor(_t)
Definition: YBaseMacro.h:176
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:654
Text
NPL::c_str
YF_API const char src c_str())) YF_API void InstallDirectory(const string &
安装目录：复制目录树。
YSLib::IO::Path::DefDeCtor
DefDeCtor(Path) explicit Path(ypath pth) ynothrow
无参数构造：默认实现。
Definition: YSLib/Service/FileSystem.h:122
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:969
YSLib::IO::size_t
YF_API const char *YF_API size_t
Definition: YSLib/Service/FileSystem.h:576
YSLib::IO::Path
路径。
Definition: YSLib/Service/FileSystem.h:109
YF_API
#define YF_API
Definition: Platform.h:56
ystdex::cpp2011::begin
_type * begin(_type(&&array)[_vN])
Definition: range.hpp:46
YSLib::IO::PathTraits
文件路径特征。
Definition: YSLib/Service/FileSystem.h:61
ystdex::dep_ops::totally_ordered
details::flat_ops< _type, _type2, _tOpt, less_than_comparable, equality_comparable > totally_ordered
Definition: operators.hpp:367
YSLib::IO::f
const string &path const String &path _func f
Definition: YSLib/Service/FileSystem.h:430
CHRLib::args
_tParams && args
Definition: CharacterProcessing.h:538
ystdex::cpp2014::cbegin
auto cbegin(const _tRange &c) -> decltype(std::begin(c))
Definition: range.hpp:79
YSLib::IO::CopyFile
YF_API void CopyFile(UniqueFile, FileDescriptor)
复制文件。
Definition: YSLib/Service/FileSystem.cpp:166
ystdex::bind_forward
auto bind_forward(_func &&f, _func2 &&f2, _tParams &&...args) -> decltype(ystdex::bind1(std::forward< decltype(f)>(f), std::bind(std::forward< decltype(f2)>(f2), std::placeholders::_2, std::forward< decltype(args)>(args)...)))
复合调用 ystdex::bind1 和 std::placeholders::_2 以实现值的设置。
Definition: functional.hpp:606
YSLib::IO::ImplExpr
const string &path ImplExpr(EnsureDirectory(path.c_str())) inline PDefH(void
YSLib::IO::Path::Path
Path(const u16string &str) ynothrow
Definition: YSLib/Service/FileSystem.h:131
platform::HDirectory
目录句柄：表示打开的目录和内容迭代状态。
Definition: YCLib/FileSystem.h:500
ystdex::string_length
size_t string_length(const _type *str)
计算字符串长度。
Definition: string.hpp:309
ystdex::to_array
std::array< _type, _vN > to_array(const _tSrc &src)
转换指定参数为 std::array 对象。
Definition: array.hpp:87
ystdex::find_suffix
_tString find_suffix(const _tString &str, _tParams &&...args)
取后缀子字符串。
Definition: string.hpp:700
ystdex::cpp2011::end
_type * end(_type(&&array)[_vN])
Definition: range.hpp:54
platform::FileDescriptor
文件描述符包装类。
Definition: FileIO.h:171
YSLib::IO::PathTraits::IsDelimiter
static yconstfn bool IsDelimiter(_tChar c) ynothrow
Definition: YSLib/Service/FileSystem.h:67
YSLib::IO::Path::Path
Path(_type &&arg, Text::Encoding enc=Text::CS_Default)
Definition: YSLib/Service/FileSystem.h:137
YSLib::IO::IsAbsolute
IsAbsolute
Definition: YSLib/Service/FileSystem.h:351
YSLib::IO::NormalizeDirectoryPathTail
ystdex::decay_t< _tString > NormalizeDirectoryPathTail(_tString &&str, typename ystdex::string_traits< _tString >::const_pointer tail=&ystdex::to_array< typename ystdex::string_traits< _tString >::value_type >("/\\")[0])
目录路径结尾正规化。
Definition: YSLib/Service/FileSystem.h:48