description | title | ms.date | f1_keywords | ms.assetid | helpviewer_keywords | ms.custom | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: directory_entry Class |
directory_entry Class |
06/10/2022 |
|
1827c67b-4137-4548-adb0-f955f7acaf08 |
|
devdivchpfy22 |
Describes an object that is returned by *X
, where X is a directory_iterator or a recursive_directory_iterator.
class directory_entry;
The class stores an object of type path. The stored path
can be an instance of the path Class or of a type that is derived from path
. It also stores two file_type values. One value represents the status of the stored file name. The other represents the symbolic link status of the file name.
For more information and code examples, see File System Navigation (C++).
Constructor | Description |
---|---|
directory_entry | The defaulted constructors behave as expected. The fourth constructor initializes mypath to pval, mystat to stat_arg, and mysymstat to symstat_arg. |
Member function | Description |
---|---|
assign | The member function assigns pval to mypath , stat to mystat , and symstat to mysymstat . |
path | The member function returns mypath . |
replace_filename | The member function replaces mypath with mypath.parent_path() / pval, mystat with stat_arg, and mysymstat with symstat_arg |
status | Both member functions return mystat possibly first altered. |
symlink_status | Both member functions return mysymstat possibly first altered. |
Operator | Description |
---|---|
operator!= | Replaces the elements of the list with a copy of another list. |
operator= | The defaulted member assignment operators behave as expected. |
operator== | Returns mypath == right.mypath . |
operator< | Returns mypath < right.mypath . |
operator<= | Returns !(right < *this) . |
operator> | Returns right < *this . |
operator>= | Returns !(*this < right) . |
operator const path_type& | Returns mypath . |
Header: <experimental/filesystem>
Namespace: std::experimental::filesystem
The member function assigns pval to mypath
, stat_arg to mystat
, and symstat_arg to mysymstat
.
void assign(const std::experimental::filesystem::path& pval,
file_status stat_arg = file_status(),
file_status symstat_arg = file_status());
pval
The stored file name path.
stat_arg
The status of the stored file name.
symstat_arg
The symbolic link status of the stored file name.
The defaulted constructors behave as expected. The fourth constructor initializes mypath
to pval, mystat
to stat_arg, and mysymstat
to symstat_arg.
directory_entry() = default;
directory_entry(const directory_entry&) = default;
directory_entry(directory_entry&&) noexcept = default;
explicit directory_entry(const std::experimental::filesystem::path& pval,
file_status stat_arg = file_status(),
file_status symstat_arg = file_status());
pval
The stored file name path.
stat_arg
The status of the stored file name.
symstat_arg
The symbolic link status of the stored file name.
The member function returns !(*this == right)
.
bool operator!=(const directory_entry& right) const noexcept;
right
The directory_entry being compared to the directory_entry
.
The defaulted member assignment operators behave as expected.
directory_entry& operator=(const directory_entry&) = default;
directory_entry& operator=(directory_entry&&) noexcept = default;
right
The directory_entry being copied into the directory_entry
.
The member function returns mypath == right.mypath
.
bool operator==(const directory_entry& right) const noexcept;
right
The directory_entry being compared to the directory_entry
.
The member function returns mypath < right.mypath
.
bool operator<(const directory_entry& right) const noexcept;
right
The directory_entry being compared to the directory_entry
.
The member function returns !(right < *this)
.
bool operator<=(const directory_entry& right) const noexcept;
right
The directory_entry being compared to the directory_entry
.
The member function returns right < *this
.
bool operator>(const directory_entry& right) const noexcept;
right
The directory_entry being compared to the directory_entry
.
The member function returns !(*this < right)
.
bool operator>=(const directory_entry& right) const noexcept;
right
The directory_entry being compared to the directory_entry
.
The member operator returns mypath
.
operator const std::experimental::filesystem::path&() const;
The member function returns mypath
.
const std::experimental::filesystem::path& path() const noexcept;
The member function replaces mypath
with mypath.parent_path()
/ pval, mystat
with stat_arg, and mysymstat
with symstat_arg
void replace_filename(
const std::experimental::filesystem::path& pval,
file_status stat_arg = file_status(),
file_status symstat_arg = file_status());
pval
The stored file name path.
stat_arg
The status of the stored file name.
symstat_arg
The symbolic link status of the stored file name.
Both member functions return mystat
possibly first altered as follows:
-
If
status_known(mystat)
then do nothing. -
Otherwise, if
!status_known(mysymstat) && !is_symlink(mysymstat)
thenmystat = mysymstat
.
file_status status() const;
file_status status(error_code& ec) const noexcept;
ec
The status error code.
Both member functions return mysymstat
possibly first altered as follows: If status_known(mysymstat)
then do nothing. Otherwise, mysymstat = symlink_status(mypval)
.
file_status symlink_status() const;
file_status symlink_status(error_code& ec) const noexcept;
ec
The status error code.