1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
The file system is a recursive data structure. Its top-level entry is a
directory (the root directory) containing plain directory entries (files,
(soft) links, named sockets, etc.) and possibly also (sub)directory
entries referring to nested directories which in turn may contiain plain-
and (sub)directory entries.
In the tt(std::filesystem) namespace the elements of directories are objects
of the class ti(directory_entry), containing names and statuses of the entries
of that directory.
bf(Constructors):
The class tt(directory_entry) supports all standard constructors (and
assignment operators) and also a constructor expecting a tt(path):
verb( directory_entry(path const &entry);)
Objects of the class tt(directory_entry) can be constructed by name, and do
not have to refer to existing entries in the file system.
bf(Operators):
itemization(
itt(ostream &operator<<(ostream &, directory_entry const &)) inserts the
object's tt(path) into the tt(ostream);
it() the comparsion operators (tt(==, <=>)) compare their tt(std::path)
data members;
itht(path)(path const &path() const), hi(operator path const &())
tt(operator path const &() const)
returns the current object's path name.
)
bf(Members):
itemization(
ithtq(assign)(void assign(path const &dest))
(the current path is replaced by tt(dest) (identical to
tt(directory_entry's) assignment operator);)
ithtq(replace_filename)(void replace_filename(path const &dest))
(the last element of the current object's path is replaced by
tt(dest). If that element is empty (e.g., when the object's path ends
in a directory separator) then tt(dest) is appended to the current
object's path;)
ithtq(status)(filesystem::file_status status([error_code &ec]))
(returns type and attributes of the directory entry referred to by the
current object. If the current object refers to a symlink then the
status of the entry the symlink refers to is returned. To obtain the
status of the entry itself, even if it's a symlink use
ti(symlink_status) (see also section ref(FSSTATUS) and ref(FSESTAT)
below).)
)
|