次の方法で共有


directory_entry クラス

*Xによって返されるオブジェクトを表します。ここで X は、 directory_iterator または recursive_directory_iteratorです。

構文

class directory_entry;

解説

このクラスは、path 型のオブジェクトを格納します。 格納できる path は、path クラスのインスタンスまたは path の派生型のインスタンスです。 また、2 つの file_type 値も格納されます。 1 つの値は、格納されているファイル名の状態を表します。 もう 1 つは、ファイル名のシンボリック リンクの状態を表します。

詳細およびコード例については、「ファイル システムのナビゲーション (C++)」をご覧ください。

コンストラクター

コンストラクター 説明
directory_entry 既定のコンストラクターは想定どおりの動作をします。 4 番目のコンストラクターは、mypathpval に、mystatstat_arg に、mysymstatsymstat_arg に初期化します。

メンバー関数

メンバー関数 説明
assign このメンバー関数は、pvalmypath に、statmystat に、symstatmysymstat に割り当てます。
path このメンバー関数は、mypath を返します。
replace_filename このメンバー関数は、mypathmypath.parent_path() / pval に、mystatstat_arg に、mysymstatsymstat_arg に置き換えます。
status どちらのメンバー関数も、最初に変更された可能性がある mystat を返します。
symlink_status どちらのメンバー関数も、最初に変更された可能性がある mysymstat を返します。

演算子

演算子 説明
operator!= 別のリストのコピーでリストの要素を置き換えます。
operator= この既定のメンバー代入演算子は想定どおりに動作します。
operator== mypath == right.mypath を返します。
演算子< mypath < right.mypath を返します。
operator<= !(right < *this) を返します。
演算子> right < *this を返します。
operator>= !(*this < right) を返します。
operator const path_type& mypath を返します。

要件

ヘッダー:<experimental/filesystem>

名前空間: std::experimental::filesystem

割り当て

このメンバー関数は、pvalmypath に、stat_argmystat に、symstat_argmysymstat に割り当てます。

void assign(const std::experimental::filesystem::path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

パラメーター

pval
保存されているファイル名のパス。

stat_arg
保存されているファイル名の状態。

symstat_arg
保存されているファイル名のシンボリック リンクの状態。

directory_entry

既定のコンストラクターは想定どおりの動作をします。 4 番目のコンストラクターは、mypathpval に、mystatstat_arg に、mysymstatsymstat_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
保存されているファイル名のパス。

stat_arg
保存されているファイル名の状態。

symstat_arg
保存されているファイル名のシンボリック リンクの状態。

operator!=

このメンバー関数は、!(*this == right) を返します。

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

パラメーター

right
directory_entry と比較する directory_entry

operator=

この既定のメンバー代入演算子は想定どおりに動作します。

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

パラメーター

right
directory_entry にコピーする directory_entry

operator==

このメンバー関数は、mypath == right.mypath を返します。

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

パラメーター

right
directory_entry と比較する directory_entry

operator<

このメンバー関数は、mypath < right.mypath を返します。

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

パラメーター

right
directory_entry と比較する directory_entry

operator<=

このメンバー関数は、!(right < *this) を返します。

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

パラメーター

right
directory_entry と比較する directory_entry

operator>

このメンバー関数は、right < *this を返します。

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

パラメーター

right
directory_entry と比較する directory_entry

operator>=

このメンバー関数は、!(*this < right) を返します。

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

パラメーター

right
directory_entry と比較する directory_entry

operator const path_type&

このメンバー演算子は、 mypathを返します。

operator const std::experimental::filesystem::path&() const;

path

このメンバー関数は、mypath を返します。

const std::experimental::filesystem::path& path() const noexcept;

replace_filename

このメンバー関数は、mypathmypath.parent_path() / pval に、mystatstat_arg に、mysymstatsymstat_arg に置き換えます。

void replace_filename(
    const std::experimental::filesystem::path& pval,
    file_status stat_arg = file_status(),
    file_status symstat_arg = file_status());

パラメーター

pval
保存されているファイル名のパス。

stat_arg
保存されているファイル名の状態。

symstat_arg
保存されているファイル名のシンボリック リンクの状態。

status

どちらのメンバー関数も、次のように最初に変更された可能性のある mystat を返します。

  1. status_known(mystat) の場合は、何も行いません。

  2. それ以外の場合で !status_known(mysymstat) && !is_symlink(mysymstat) の場合は、mystat = mysymstat です。

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

パラメーター

ec
状態のエラー コード。

どちらのメンバー関数も、次のように最初に変更された可能性のある mysymstat を返します。status_known(mysymstat) の場合は、何も行いません。 それ以外の場合は mysymstat = symlink_status(mypval)

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

パラメーター

ec
状態のエラー コード。

関連項目

ヘッダー ファイル リファレンス
<filesystem>