directory_entry Class

directory_entry Class

 

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 Class. path can be either a path or a type that is derived from path. It also stores two file_type values; one that represents what is known about the status of the stored file name, and another that represents what is known about the symbolic link status of the file name.

For more information and code examples, see File System Navigation.

void assign(const PFX path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

The member function assigns pval to mypath, stat to mystat, and symstat to mysymstat.

directory_entry() = default;
directory_entry(const directory_entry&) = default;
directory_entry(directory_entry&&) noexcept = default;
explicit directory_entry(const PFX path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

The defaulted constructors behave as expected. The fourth constructor initializes mypath to pval, mystat to stat_arg, and mysymstat to symstat_arg.

bool operator!=(const directory_entry& right) const noexcept;

The member function returns !(*this == right).

directory_entry& operator=(const directory_entry&) = default;
directory_entry& operator=(directory_entry&&) noexcept = default;

The defaulted member assignment operators behave as expected.

bool operator==(const directory_entry& right) const noexcept;

The member function returns mypath == right.mypath.


bool operator<(const directory_entry& right) const noexcept;

The member function returns mypath < right.mypath.

bool operator<=(const directory_entry& right) const noexcept;

The member function returns !(right < *this).

bool operator>(const directory_entry& right) const noexcept;

The member function returns right < *this.

bool operator>=(const directory_entry& right) const noexcept;

The member function returns !(*this < right).

operator const path&() const; // retained

The member operator returns mypath.

const PFX path& path() const noexcept;

The member function returns mypath.

void replace_filename(const PFX path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

The member function replaces mypath with mypath.parent_path() / pval, mystat with stat_arg, and mysymstat with symstat_arg

file_status status() const;
file_status status(
    error_code& ec) const noexcept;
Otherwise, mystat = status(mypval).

Both member functions return mystat possibly first altered as follows:

  1. If status_known(mystat) then do nothing.

  2. Otherwise, if !status_known(mysymstat) && !is_symlink(mysymstat) then mystat = mysymstat.

file_status symlink_status() const;
file_status symlink_status(
    error_code& ec) const noexcept;

Both member functions return mysymstat possibly first altered as follows:If status_known(mysymstat) then do nothing. Otherwise, mysymstat = symlink_status(mypval).

Requirements

Header: filesystem

Namespace: std::tr2::sys

Show:
© 2016 Microsoft