explicit directory_entry(const path& p);
directory_entry(const path& p, error_code& ec);
Effects: Constructs an object of type
directory_entry,
then
refresh() or
refresh(ec), respectively
. Postconditions: path() == p if no error occurs,
otherwise
path() == std::filesystem::path(). void assign(const path& p);
void assign(const path& p, error_code& ec);
Effects: Equivalent to
pathobject = p,
then
refresh() or
refresh(ec), respectively
. If an error occurs, the values of any cached attributes are unspecified
.void replace_filename(const path& p);
void replace_filename(const path& p, error_code& ec);
Effects: Equivalent to
pathobject.replace_filename(p),
then
refresh() or
refresh(ec), respectively
. If an error occurs, the values of any cached attributes are unspecified
.Throws: As specified in
[fs.err.report]. void refresh();
void refresh(error_code& ec) noexcept;
Effects: Stores the current values of any cached attributes of the file
p resolves to
. If an error occurs, an error is reported (
[fs.err.report])
and the values of any cached attributes are unspecified
.[
Note: Implementations of
directory_iterator (
[fs.class.directory_iterator])
are prohibited from directly or indirectly calling the
refresh function
since it must access the external file system,
and the objective of caching is to avoid unnecessary file system accesses
. —
end note ]
Unqualified function names in the
Returns: elements of the
directory_entry observers described below refer to members of the
std::filesystem namespace
. const path& path() const noexcept;
operator const path&() const noexcept;
bool exists() const;
bool exists(error_code& ec) const noexcept;
Returns: exists(this->status()) or
exists(this->status(), ec), respectively
. bool is_block_file() const;
bool is_block_file(error_code& ec) const noexcept;
Returns: is_block_file(this->status()) or
is_block_file(this->status(), ec), respectively
. bool is_character_file() const;
bool is_character_file(error_code& ec) const noexcept;
Returns: is_character_file(this->status()) or
is_character_file(this->status(), ec), respectively
. bool is_directory() const;
bool is_directory(error_code& ec) const noexcept;
Returns: is_directory(this->status()) or
is_directory(this->status(), ec), respectively
. bool is_fifo() const;
bool is_fifo(error_code& ec) const noexcept;
Returns: is_fifo(this->status()) or
is_fifo(this->status(), ec), respectively
. bool is_other() const;
bool is_other(error_code& ec) const noexcept;
Returns: is_other(this->status()) or
is_other(this->status(), ec), respectively
. bool is_regular_file() const;
bool is_regular_file(error_code& ec) const noexcept;
Returns: is_regular_file(this->status()) or
is_regular_file(this->status(), ec), respectively
. bool is_socket() const;
bool is_socket(error_code& ec) const noexcept;
Returns: is_socket(this->status()) or
is_socket(this->status(), ec), respectively
. bool is_symlink() const;
bool is_symlink(error_code& ec) const noexcept;
Returns: is_symlink(this->symlink_status()) or
is_symlink(this->symlink_status(), ec), respectively
. uintmax_t file_size() const;
uintmax_t file_size(error_code& ec) const noexcept;
Returns: If cached, the file size attribute value
. Otherwise,
file_size(path()) or
file_size(path(), ec), respectively
.uintmax_t hard_link_count() const;
uintmax_t hard_link_count(error_code& ec) const noexcept;
Returns: If cached, the hard link count attribute value
. Otherwise,
hard_link_count(path()) or
hard_link_count(path(), ec), respectively
.file_time_type last_write_time() const;
file_time_type last_write_time(error_code& ec) const noexcept;
Returns: If cached, the last write time attribute value
. Otherwise,
last_write_time(path()) or
last_write_time(path(), ec), respectively
.file_status status() const;
file_status status(error_code& ec) const noexcept;
Returns: If cached, the status attribute value
. Otherwise,
status(path()) or
status(path(), ec), respectively
.file_status symlink_status() const;
file_status symlink_status(error_code& ec) const noexcept;
Returns: If cached, the symlink status attribute value
. Otherwise,
symlink_status(path()) or
symlink_status(path(), ec), respectively
.bool operator==(const directory_entry& rhs) const noexcept;
Returns: pathobject == rhs.pathobject. bool operator!=(const directory_entry& rhs) const noexcept;
Returns: pathobject != rhs.pathobject. bool operator< (const directory_entry& rhs) const noexcept;
Returns: pathobject < rhs.pathobject. bool operator<=(const directory_entry& rhs) const noexcept;
Returns: pathobject <= rhs.pathobject. bool operator> (const directory_entry& rhs) const noexcept;
Returns: pathobject > rhs.pathobject. bool operator>=(const directory_entry& rhs) const noexcept;
Returns: pathobject >= rhs.pathobject.